trios/kernel/panic.c

24 lines
447 B
C

#include <sys.h>
#include <stdarg.h>
#include <stdlib.h>
#include "term.h"
#include "panic.h"
__attribute__((noreturn))
void _panic_impl(char* msg, int line, char* file, ...) {
int_disable();
printf("BBBBBBBB\n");
va_list args;
va_start(args, file);
term_clear();
term_setpos(0, 0);
term_setcol(0x0c);
puts("!!!PANIC!!!\n");
term_setcol(0x0f);
vprintf(msg, args);
printf("\nin %s at line %d\n", file, line);
while(1) {
halt();
}
}