diff options
Diffstat (limited to 'src/arch/amd64/idt.S')
-rw-r--r-- | src/arch/amd64/idt.S | 36 |
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 |