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