From 45db1523a02730a172564ca8c2be55422d5d2f0b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 22 Aug 2020 01:10:59 +0200 Subject: Fixed some TODOs --- libc/inc/assert.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/inc/assert.h b/libc/inc/assert.h index a553444..758c91b 100644 --- a/libc/inc/assert.h +++ b/libc/inc/assert.h @@ -6,17 +6,22 @@ #include #ifdef kernel +#include #define assert(exp) \ if (!(exp)) { \ printf("%s:%d: %s: Assertion '%s' failed\n", __FILE__, __LINE__, __func__, #exp); \ - __asm__ volatile("cli\nhlt"); \ + struct proc *proc = proc_current(); \ + if (proc) \ + proc_exit(proc, 1); \ + else \ + __asm__ volatile("cli\nhlt"); \ } #elif defined(userspace) #include #define assert(exp) \ if (!(exp)) { \ printf("%s:%d: %s: Assertion '%s' failed\n", __FILE__, __LINE__, __func__, #exp); \ - sys0(SYS_LOOP); \ + sys1(SYS_EXIT, 1); \ } #else #error "No lib target specified. Please use -Dkernel or -Duserspace" -- cgit v1.2.3