From 2a984a93ec25e7633dbbe9945ccf45a9f0ece2fd Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Tue, 21 Nov 2023 15:17:32 -0800 Subject: [PATCH] [Zion] Add a shim Floating Point Exception handler. --- zion/interrupt/interrupt.cpp | 10 ++++++++-- zion/interrupt/interrupt_enter.s | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/zion/interrupt/interrupt.cpp b/zion/interrupt/interrupt.cpp index b67f26e..9022b89 100644 --- a/zion/interrupt/interrupt.cpp +++ b/zion/interrupt/interrupt.cpp @@ -130,6 +130,11 @@ extern "C" void interrupt_page_fault(InterruptFrame* frame) { panic("PF"); } +extern "C" void isr_fpe_fault(); +extern "C" void interrupt_fpe_fault(InterruptFrame* frame) { + panic("Floating point exception"); +} + extern "C" void isr_timer(); extern "C" void interrupt_timer(InterruptFrame*) { gApicTimer->Calibrate(); @@ -178,8 +183,9 @@ extern "C" void interrupt_pci4(InterruptFrame*) { void InitIdt() { gIdt[0] = CreateDescriptor(isr_divide_by_zero); - gIdt[13] = CreateDescriptor(isr_protection_fault); - gIdt[14] = CreateDescriptor(isr_page_fault); + gIdt[0xD] = CreateDescriptor(isr_protection_fault); + gIdt[0xE] = CreateDescriptor(isr_page_fault); + gIdt[0x13] = CreateDescriptor(isr_fpe_fault); gIdt[0x20] = CreateDescriptor(isr_timer); gIdt[0x21] = CreateDescriptor(isr_apic_timer); diff --git a/zion/interrupt/interrupt_enter.s b/zion/interrupt/interrupt_enter.s index cd425dc..9acbe64 100644 --- a/zion/interrupt/interrupt_enter.s +++ b/zion/interrupt/interrupt_enter.s @@ -58,6 +58,7 @@ isr_\name: isr_handler divide_by_zero isr_handler protection_fault,1 isr_handler page_fault,1 +isr_handler fpe_fault isr_handler timer isr_handler apic_timer