1 #include <klibc/strfmt.h>
2 #include <lunaix/spike.h>
3 #include <lunaix/pcontext.h>
5 static char buffer[1024];
8 __assert_fail(const char* expr, const char* file, unsigned int line)
10 ksprintf(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 cpu_trap_panic(buffer);
18 spin(); // never reach
22 panick(const char* msg)
29 panickf(const char* fmt, ...)
33 ksnprintfv(buffer, fmt, 1024, args);
36 asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(buffer));