From 8d3ef773f8daea3a0c2b110ab48f235f5d2bf22d Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 5 Oct 2021 20:57:01 +0200 Subject: kill the process that caused an exception instead of panicking --- src/init/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/init') 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 -- cgit v1.2.3