summaryrefslogtreecommitdiff
path: root/src/arch/amd64/idt.S
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-01-29 18:05:26 -0500
committerFreya Murphy <freya@freyacat.org>2024-01-29 18:05:26 -0500
commit36d7dad0708039ee94fcfd7ed4b21d5cc76634e1 (patch)
treed5c9ac5de709c7884fe9d7071d6dec5506958102 /src/arch/amd64/idt.S
parentadd interrupts (not yet fully working) (diff)
downloadcorn-36d7dad0708039ee94fcfd7ed4b21d5cc76634e1.tar.gz
corn-36d7dad0708039ee94fcfd7ed4b21d5cc76634e1.tar.bz2
corn-36d7dad0708039ee94fcfd7ed4b21d5cc76634e1.zip
things
Diffstat (limited to 'src/arch/amd64/idt.S')
-rw-r--r--src/arch/amd64/idt.S36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/arch/amd64/idt.S b/src/arch/amd64/idt.S
index 43f4fd2..afb1149 100644
--- a/src/arch/amd64/idt.S
+++ b/src/arch/amd64/idt.S
@@ -1,15 +1,49 @@
extern idt_exception_handler
global isr_stub_table
+%macro PUSHALL 0
+ push rbx
+ push rcx
+ push rdx
+ push rsi
+ push rdi
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+%endmacro
+
+%macro POPALL 0
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rdx
+ pop rcx
+ pop rbx
+%endmacro
+
; call the exception handler with the interrupt number
; args: interrupt number
%macro ISRException 1
align 8
isr_stub_%+%1:
+ PUSHALL
cld
mov rdi, %1
mov rsi, 0
call idt_exception_handler
+ POPALL
iretq
%endmacro
@@ -19,10 +53,12 @@ isr_stub_%+%1:
%macro ISRExceptionCode 1
align 8
isr_stub_%+%1:
+ PUSHALL
cld
mov rdi, %1
pop rsi
call idt_exception_handler
+ POPALL
iretq
%endmacro