Halt-And-Catch-Fire macro
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user