summaryrefslogtreecommitdiff
path: root/kc/core/cpu/exceptions.S
diff options
context:
space:
mode:
Diffstat (limited to 'kc/core/cpu/exceptions.S')
-rw-r--r--kc/core/cpu/exceptions.S21
1 files changed, 8 insertions, 13 deletions
diff --git a/kc/core/cpu/exceptions.S b/kc/core/cpu/exceptions.S
index 087cf12..8aa109e 100644
--- a/kc/core/cpu/exceptions.S
+++ b/kc/core/cpu/exceptions.S
@@ -1,32 +1,26 @@
#include "exceptions.h"
#include "interrupt.h"
-.macro EXCEPTION_BEGIN vec:req, code=0
+.macro EXCEPTION_BEGIN vec:req, code
// just in case something tried to be clever before
- cld
+ pushq $\vec
+ .ifb \code
+ pushq $0
+ .endif
// push param registers
ISR_STORE_PARAM_REGS
- // store certain parameters
- movb $\vec,%dil
- .if \code
- movq ISR_PARAM_REGS_SIZE(%rsp), %rsi
- .else
- xor %rsi, %rsi
- .endif
// caller-saved registers
ISR_STORE_CALLER_REGS
// callee-saved registers
ISR_STORE_CALLEE_REGS
.endm
-.macro EXCEPTION_END vec:req, code=0
+.macro EXCEPTION_END vec:req, code
// restore all the registers
ISR_RESTORE_CALLEE_REGS
ISR_RESTORE_CALLER_REGS
ISR_RESTORE_PARAM_REGS
- .if \code
- add $8, %rsp
- .endif
+ add $16, %rsp
iretq
.endm
@@ -37,6 +31,7 @@
.else
EXCEPTION_BEGIN \vec
.endif
+ movq %rsp, %rdi
ISR_CALL \name\()_handler
.if \vec > 9 && \vec < 15 || \vec == 17 || \vec == 21 || \vec > 28 && \vec < 31
EXCEPTION_END \vec, 1