summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/ivt.s
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/ivt.s')
-rw-r--r--arch/x86_64/ivt.s21
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