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

@@ -10,7 +10,7 @@ class lapic;
struct page_table;
struct cpu_state;
extern "C" uintptr_t isr_handler(uintptr_t, cpu_state);
extern "C" uintptr_t isr_handler(uintptr_t, cpu_state*);
/// The task scheduler
@@ -59,8 +59,8 @@ public:
static scheduler & get() { return s_instance; }
private:
friend uintptr_t syscall_dispatch(uintptr_t, const cpu_state &);
friend uintptr_t isr_handler(uintptr_t, cpu_state);
friend uintptr_t syscall_dispatch(uintptr_t, cpu_state &);
friend uintptr_t isr_handler(uintptr_t, cpu_state*);
/// Handle a timer tick
/// \arg rsp0 The stack pointer of the current interrupt handler