vbos/amd64/exception.c
Michael Shaw 70d171fed8 amd64: add extra information on fault
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-07-14 23:34:49 -04:00

46 lines
1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <kernel/common.h>
#include <lib/stdio.h>
#include "arch/reg.h"
static const char *exception_names[] = {
"Divide-by-zero Error",
"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",
"Invalid exception",
"Invalid exception",
"Invalid exception",
"Invalid exception",
"Invalid exception",
"Invalid exception",
"Invalid exception",
"Security Exception",
"Reserved",
"Triple Fault",
};
void exception_handler(u64 no, u64 err)
{
if (no == 0x0e)
kerr("(Page fault): 0x%16x\n", cr2_read());
if (!kernel_init_ready)
panic("(Exception) %s(%02xh)\n", exception_names[no], no);
}