AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
panic.h
Go to the documentation of this file.
1#ifndef _PANIC_H
2#define _PANIC_H
3
4#include <core/system.h>
5#include <core/arch.h>
6#include <core/printk.h>
7
8/* x86's panic(): the message, where it happened, a stack trace (unless
9 * the trace itself panicked), then the CPU stops with interrupts off. */
10
11#define __PANIC_MSG "Bailing out. You are on your own. Good luck."
12
13extern int __printing_trace;
14
15#define panic(s) \
16{\
17 printk("KERNEL PANIC: %s\n%s[%d]: %s\n", \
18 s, __FILE__, __LINE__, __func__);\
19 if (__printing_trace) {\
20 printk("Panicked while panicking :)\n"); \
21 } else {\
22 arch_stack_trace(); \
23 printk("%s\n", __PANIC_MSG); \
24 } \
25 asm("cli"); \
26 for(;;); \
27}\
28
29#endif /* ! _PANIC_H */
int __printing_trace
Definition trace.c:11