43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#include "exceptions.h"
|
|
#include "../panic.h"
|
|
|
|
static const char* exception_messages[32] = {
|
|
"divide by zero",
|
|
"debug",
|
|
"non maskable interrupt",
|
|
"breakpoint",
|
|
"overflow",
|
|
"bound range exceeded",
|
|
"invalid opcode",
|
|
"device not available",
|
|
"double fault",
|
|
"coprocessor segment overrun",
|
|
"invalid tss",
|
|
"segment not present",
|
|
"stack-segment fault",
|
|
"general protection fault",
|
|
"page fault",
|
|
"reserved",
|
|
"x87 floating point exception",
|
|
"alignment check",
|
|
"machine check",
|
|
"simd floating point exception",
|
|
"virtualization exception",
|
|
"control protection exception",
|
|
"reserved",
|
|
"reserved",
|
|
"reserved",
|
|
"reserved",
|
|
"reserved",
|
|
"reserved",
|
|
"hypervisor injection exception",
|
|
"vmm communication exception",
|
|
"security exception",
|
|
"reserved",
|
|
};
|
|
|
|
void handle_exception(const isr_frame_t* frame)
|
|
{
|
|
printf("exception[%d]: %s, error code: %d\n", frame->int_no, exception_messages[frame->int_no], frame->err_code);
|
|
panic("An unhandled exception occurred");
|
|
} |