[Zion] Add an invalid opcode handler.

This commit is contained in:
Drew Galbraith 2023-11-22 12:06:37 -08:00
parent 2efa13ab43
commit a93aa3a426
2 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,12 @@ extern "C" void interrupt_divide_by_zero(InterruptFrame* frame) {
panic("DIV0");
}
extern "C" void isr_invalid_opcode();
extern "C" void interrupt_invalid_opcode(InterruptFrame* frame) {
dbgln("RIP: {x}", frame->rip);
panic("INVALID OPCODE");
}
extern "C" void isr_protection_fault();
extern "C" void interrupt_protection_fault(InterruptFrame* frame) {
dbgln("General Protection Fault");
@ -183,6 +189,7 @@ extern "C" void interrupt_pci4(InterruptFrame*) {
void InitIdt() {
gIdt[0] = CreateDescriptor(isr_divide_by_zero);
gIdt[0x6] = CreateDescriptor(isr_invalid_opcode);
gIdt[0xD] = CreateDescriptor(isr_protection_fault);
gIdt[0xE] = CreateDescriptor(isr_page_fault);
gIdt[0x13] = CreateDescriptor(isr_fpe_fault);

View File

@ -56,6 +56,7 @@ isr_\name:
.endm
isr_handler divide_by_zero
isr_handler invalid_opcode
isr_handler protection_fault,1
isr_handler page_fault,1
isr_handler fpe_fault