Pass CPU state as a pointer

Previously CPU statue was passed on the stack, but the compiler is
allowed to clobber values passed to it on the stack in the SysV x86 ABI.
So now leave the state on the stack but pass a pointer to it into the
ISR functions.
This commit is contained in:
Justin C. Miller
2019-02-07 17:47:42 -08:00
parent 79711be46a
commit 8c32471e0d
5 changed files with 39 additions and 37 deletions

View File

@@ -6,6 +6,7 @@ isr_handler_prelude:
push_all_and_segments
mov rdi, rsp
mov rsi, rsp
call isr_handler
mov rsp, rax
@@ -21,6 +22,7 @@ irq_handler_prelude:
push_all_and_segments
mov rdi, rsp
mov rsi, rsp
call irq_handler
mov rsp, rax
@@ -56,8 +58,8 @@ irq_handler_prelude:
jmp irq_handler_prelude
%endmacro
%define EISR(i, name) EMIT_EISR name, i
%define UISR(i, name) EMIT_ISR name, i
%define EISR(i, name) EMIT_EISR name, i ; ISR with error code
%define UISR(i, name) EMIT_ISR name, i ; ISR callable from user space
%define ISR(i, name) EMIT_ISR name, i
%define IRQ(i, q, name) EMIT_IRQ name, i