diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2025-09-26 13:17:41 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2025-09-26 13:17:41 -0400 |
commit | 2dadbfc899df4179ca70c4ea04f74a5e190c2ae7 (patch) | |
tree | b166aaa9af42406cd07fbaf150f93aefeb2fbe33 /arch/x86_64/ivt.s | |
parent | ddc4fbc15223e362896a9f42beca73f05f48e664 (diff) | |
download | jove-kernel-2dadbfc899df4179ca70c4ea04f74a5e190c2ae7.tar.gz jove-kernel-2dadbfc899df4179ca70c4ea04f74a5e190c2ae7.tar.bz2 jove-kernel-2dadbfc899df4179ca70c4ea04f74a5e190c2ae7.zip |
fix usermode interrupts. add ability to define custom interrupt handlersmain
Diffstat (limited to 'arch/x86_64/ivt.s')
-rw-r--r-- | arch/x86_64/ivt.s | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arch/x86_64/ivt.s b/arch/x86_64/ivt.s index a64f6b7..a1592be 100644 --- a/arch/x86_64/ivt.s +++ b/arch/x86_64/ivt.s @@ -1,14 +1,13 @@ .section .text -.global idt_load -.type idt_load @function -idt_load: - lidt (%rdi) - sti - retq -.size idt_load, . - idt_load - .include "arch/x86_64/savestate.s" +.macro swapgs_if_necessary + cmp $0x08, 0x8(%rsp) + je 1f + swapgs +1: +.endm + .extern isr_handle .type __isr_head @function __isr_head: @@ -20,14 +19,13 @@ __isr_head: popall addq $16, %rsp + swapgs_if_necessary iretq -.extern __isr_err -.extern __isr_num - .macro defn_isr_err num:req .type __isr\num @function __isr\num: + swapgs_if_necessary pushq $\num jmp __isr_head .size __isr\num, . - __isr\num @@ -36,6 +34,7 @@ __isr\num: .macro defn_isr num:req .type __isr\num @function __isr\num: + swapgs_if_necessary pushq $0 pushq $\num jmp __isr_head |