17static void panic_message_impl(
const char*
message,
uint64_t rbp,
bool rbp_given) {
19 logf(
"panic",
"An error occured and LF OS has to be halted. More info below:");
21 logf(
"panic",
"LF OS build: %s", BUILD_ID);
28 asm(
"mov %%rbp,%0":
"=r"(frame));
35 logi(
"panic",
"Stack trace that led to this error:");
38 while(frame && frame->
rip > 0xFFFF800000000000 && --i) {
40 size_t symbol_size =
sizeof(symbol);
45 logi(
"panic",
" 0x%016x %s", frame->
rip, symbol);
47 if(frame->
prev != frame) {
66 panic_message_impl(
message, 0,
false);
75 const char* exceptions[] = {
81 "Bound range exceeded",
83 "Device not available",
85 "Coprocessor segment overrun",
87 "Segment not present",
88 "Stack-segment fault",
89 "General protection fault",
92 "x87 floating point exception",
95 "SIMD floating point exception",
96 "Virtualization exception",
105 "Security exception",
109 char cr2_msg[256] = { 0 };
113 asm(
"mov %%cr2, %0":
"=r"(cr2));
116 size_t symbol_size =
sizeof(symbol);
118 ksnprintf(cr2_msg, 256,
" @ 0x%016x, %s", cr2, symbol);
121 ksnprintf(cr2_msg, 256,
" @ 0x%016x", cr2);
131 size_t symbol_size =
sizeof(symbol);
136 logi(
"panic",
"RIP: 0x%016x %s", cpu->
rip, symbol);
bool elf_symbolize(void *symbol_data, ptr_t addr, size_t *symbol_size, char *symbol)
void fbconsole_back_to_kernel(void)
size_t ksnprintf(char *buffer, size_t buffer_size, const char *format,...)
#define logi(component, fmt,...)
#define logf(component, fmt,...)
void panic_message(const char *message)
void panic_cpu(const cpu_state *cpu)
const char * LAST_INIT_STEP
static bool struct Message * message