aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/interrupt/mod.rs
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-06-05 23:24:01 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:14 +0200
commitca8bc76fd5319842954508484542f4beb6b591d0 (patch)
tree5f096dc62e9bbb65056ee772cb7bbf17bc646107 /src/arch/x86_64/interrupt/mod.rs
parent38883485c80841f15365d0502418dcc224f01d45 (diff)
interrupt: set up dummy pagefault handler
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
Diffstat (limited to 'src/arch/x86_64/interrupt/mod.rs')
-rw-r--r--src/arch/x86_64/interrupt/mod.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/arch/x86_64/interrupt/mod.rs b/src/arch/x86_64/interrupt/mod.rs
index 6663b23..ed08223 100644
--- a/src/arch/x86_64/interrupt/mod.rs
+++ b/src/arch/x86_64/interrupt/mod.rs
@@ -1,6 +1,7 @@
pub mod pic_8259;
pub mod pit;
use crate::arch::x86_64::arch_regs::TrapFrame;
+use crate::arch::x86_64::paging::fault;
use crate::io::*;
use core::arch::asm;
use core::slice;
@@ -71,13 +72,19 @@ extern "C" fn trap_gate(_nr: u16, fp: u64) {
// able to release the lock if the interrupt handler blocks on it. Try
// spamming the keyboard with the following line of code uncommented: it
// will deadlock!
- println!("interrupt received 0x{:x}", _nr);
- if _nr < 0x20 {
- let _frame = unsafe { &mut *(fp as *mut TrapFrame) };
- println!("trap: @{:#X} {:#X?}", fp, _frame);
+ // TODO this is only a POC, use proper defines and match later
+ let _frame = unsafe { &mut *(fp as *mut TrapFrame) };
+ if _nr == 0xe {
+ // Pagefault
+ let fault_address = fault::get_fault_addr();
+ fault::page_fault_handler(_frame, fault_address)
+ } else if _nr < 0x20 {
+ println!("[trap[ {:#X?}", _frame);
unsafe {
asm!("hlt");
}
+ } else {
+ // deal with irq
}
interrupt_enable();
}