1 #include <arch/x86/interrupts.h>
2 #include <klibc/stdio.h>
3 #include <lunaix/spike.h>
5 static char buffer[1024];
8 __assert_fail(const char* expr, const char* file, unsigned int line)
10 sprintf(buffer, "%s (%s:%u)", expr, file, line);
12 // Here we load the buffer's address into %edi ("D" constraint)
13 // This is a convention we made that the LUNAIX_SYS_PANIC syscall will
14 // print the panic message passed via %edi. (see
15 // kernel/asm/x86/interrupts.c)
16 asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(buffer));
18 spin(); // never reach
22 panick(const char* msg)
24 asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(msg));