|
|
|
/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
|
|
|
|
|
|
|
|
#include <arch/cpufunc.h>
|
|
|
|
#include <arch/trap.h>
|
|
|
|
|
|
|
|
#include <gay/kprintf.h>
|
|
|
|
#include <gay/systm.h>
|
|
|
|
|
|
|
|
void x86_isr_divide_error(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Divide Error\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_debug_exception(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Debug Exception\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_nmi(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Nonmaskable Interrupt\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_breakpoint(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Breakpoint\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_overflow(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Overflow\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_bound_range_exceeded(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Bound Range Exceeded\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_invalid_opcode(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Invalid Opcode\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_device_not_available(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Device Not Available\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_double_fault(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
disable_intr();
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Double Fault (error_code = %#08x)", error_code);
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_invalid_tss(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("Invalid TSS (error = 0x%08x)\n", error_code);
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_segment_not_present(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("Segment Not Present (error = 0x%08x)\n", error_code);
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_stack_segment_fault(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("Stack Segment Fault (error = 0x%08x)\n", error_code);
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_general_protection(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("General Protection Fault (external = %d, table = %d, index = %d)\n",
|
|
|
|
error_code & 1, (error_code >> 1) & 3, (error_code >> 3));
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_x87_fpu_error(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("x87 FPU Error\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_alignment_check(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("Alignment Check (error_code = %#08x)\n", error_code);
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_machine_check(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Machine Check\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_simd_floating_point_exception(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("SIMD Floating Point Exception\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_virtualization_exception(trap_frame_t *frame)
|
|
|
|
{
|
|
|
|
kprintf("Virtualization Exception\n");
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|
|
|
|
|
|
|
|
void x86_isr_control_protection_exception(trap_frame_t *frame, u32 error_code)
|
|
|
|
{
|
|
|
|
kprintf("Control Protection Exception (error_code = %#08x)\n", error_code);
|
|
|
|
print_regs(frame);
|
|
|
|
panic("Unexpected interrupt");
|
|
|
|
}
|