summaryrefslogtreecommitdiff
path: root/src/init/main.c
diff options
context:
space:
mode:
authordzwdz2021-10-05 20:57:01 +0200
committerdzwdz2021-10-05 20:57:01 +0200
commit8d3ef773f8daea3a0c2b110ab48f235f5d2bf22d (patch)
tree7e21974cf6eb51439ac402902f92c418e72d3863 /src/init/main.c
parentbb2c65663dd03aaf1948c36c7e6006af7e3840a6 (diff)
kill the process that caused an exception instead of panicking
Diffstat (limited to 'src/init/main.c')
-rw-r--r--src/init/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 71a2d4e..ec6d5be 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -85,9 +85,22 @@ void fs_test(void) {
void test_await(void) {
int ret;
+ // regular exit()s
if (!_syscall_fork()) _syscall_exit(69);
if (!_syscall_fork()) _syscall_exit(420);
+ // faults
+ if (!_syscall_fork()) { // invalid memory access
+ asm volatile("movb $69, 0" ::: "memory");
+ log("this shouldn't happen");
+ _syscall_exit(-1);
+ }
+ if (!_syscall_fork()) { // #GP
+ asm volatile("hlt" ::: "memory");
+ log("this shouldn't happen");
+ _syscall_exit(-1);
+ }
+
while ((ret = _syscall_await()) != ~0) {
log("await returned: ");
//_syscall_write(tty_fd, buf, len, 0); TODO printf