2021-03-02 01:38:55 +03:00
|
|
|
#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)
|
2021-03-02 01:38:55 +03:00
|
|
|
rm_hcf();
|
2021-03-02 12:23:43 +03:00
|
|
|
#elif defined (uefi)
|
|
|
|
for (;;) asm ("hlt");
|
|
|
|
#endif
|
2021-03-02 01:38:55 +03:00
|
|
|
}
|