diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-04-17 21:09:09 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:16:33 +0200 |
| commit | 01a23bfd8d32510bacb22af9d8c5bef803758779 (patch) | |
| tree | be52bb2425d0560f4c31b6f3e15cbfa9690eea63 | |
| parent | 9a7b6f6c61aad48e654c915077a5954957477a7a (diff) | |
interrupt: rename `guardian` to `interrupt_gate`
| -rw-r--r-- | boot/startup-x86_64.s | 9 | ||||
| -rw-r--r-- | src/arch/x86_64/interrupt/mod.rs | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/boot/startup-x86_64.s b/boot/startup-x86_64.s index 9198a9f..9b994de 100644 --- a/boot/startup-x86_64.s +++ b/boot/startup-x86_64.s @@ -49,7 +49,7 @@ MULTIBOOT_EAX_MAGIC equ 0x2badb002 ; functions from the C parts of the system [EXTERN _entry] -[EXTERN guardian] +[EXTERN interrupt_gate] ; addresses provided by the compiler [EXTERN ___BSS_START__] @@ -242,12 +242,9 @@ wrapper_body: ; the generated wrapper only gives us 8 bits, mask the rest and rax, 0xff - - ; pass interrupt number as the first parameter + ; call the interrupt handling code with interrupt number as parameter mov rdi, rax - ; call the interrupt handler wrapper here. - ; TODO implement it in rust then uncomment the line - call guardian + call interrupt_gate ; restore volatile registers pop r11 diff --git a/src/arch/x86_64/interrupt/mod.rs b/src/arch/x86_64/interrupt/mod.rs index ef050b0..410996a 100644 --- a/src/arch/x86_64/interrupt/mod.rs +++ b/src/arch/x86_64/interrupt/mod.rs @@ -5,9 +5,14 @@ use core::arch::asm; #[no_mangle] #[cfg(target_arch = "x86_64")] -extern "C" fn guardian(slot: u16) { +extern "C" fn interrupt_gate(slot: u16) { interrupt_disable(); - println!("interrupt received {:x}", slot); + // NOTE: the interrupt handler should NEVER block on a lock; in this case + // the CGA screen is protected by a spinlock. The lock holder will never be + // 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 {:x}", slot); interrupt_enable(); } |
