rulimine/stage23/lib/panic.s2.c

26 lines
441 B
C
Raw Normal View History

#include <lib/print.h>
#include <lib/real.h>
#include <lib/trace.h>
__attribute__((noreturn)) void panic(const char *fmt, ...) {
asm volatile ("cli" ::: "memory");
va_list args;
va_start(args, fmt);
print("\033[31mPANIC\033[37;1m\033[40m: ");
vprint(fmt, args);
va_end(args);
print("\n");
print_stacktrace(NULL);
2021-03-02 12:23:43 +03:00
#if defined (bios)
rm_hcf();
2021-03-02 12:23:43 +03:00
#elif defined (uefi)
for (;;) asm ("hlt");
#endif
}