summaryrefslogtreecommitdiff
path: root/kernel/lib/panic.c
blob: 3a6e0291441a5cb3496dc50492058a601259dd7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <lib.h>
#include <stdarg.h>
#include <comus/asm.h>

__attribute__((noreturn)) void __panic(unsigned int line, const char *file,
									   const char *format, ...)
{
	cli();
#if LOG_LEVEL >= LOG_LVL_PANIC
	va_list list;
	va_start(list, format);
	kprintf("\n\n!!! PANIC !!!\n");
	kprintf("In file %s at line %d:\n", file, line);
	kvprintf(format, list);
	kprintf("\n\n");
	log_backtrace();
#endif

	while (1)
		halt();
}