Halt-And-Catch-Fire macro

This commit is contained in:
thomas committed 2018-03-20 14:11:21 +01:00
1 parent 2da088f031
commit 9e2483d78e
3 files changed
+34

No files matched your search

+14
View File
@@ -22,3 +22,17 @@ void debug_printf(char *fmt, ...);
void debug_puts(char *s);
void debug_putsn(char *s, size_t n);
void debug_putch(char c);
#define S(x) #x
#define S_(x) S(x)
#define S__LINE__ S_(__LINE__)
#define PANIC(...) \
do{ \
debug("\n\nKernel panic!\n%s:%d\n", __FILE__, __LINE__); \
debug(__VA_ARGS__); \
volatile int _override = 0; \
while(1){ \
asm("panic_breakpoint_" S__LINE__ ":"); \
if(_override) break; \
} \
}while(0)