This is a very large patch. Don't feel like splitting it up. Deal with it, :P Signed-off-by: Michael Shaw <m@michaelsshaw.com>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#include <kernel/common.h>
|
|
#include <lib/stdio.h>
|
|
#include <arch/proc.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, u64 rip)
|
|
{
|
|
if (no == 0x0e) {
|
|
panic("(Page fault) cpu%d ip:0x%016lx addr:0x%016lx err:%x\n", cpu_id(), rip, cr2_read(), err);
|
|
}
|
|
|
|
panic("(Exception) cpu%d ip:0x%016lx %s(%02xh) err: %x\n", cpu_id(), rip, exception_names[no], no, err);
|
|
}
|