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

@@ -35,7 +35,7 @@ syscall_enable()
}
uintptr_t
syscall_dispatch(uintptr_t return_rsp, const cpu_state &regs)
syscall_dispatch(uintptr_t return_rsp, cpu_state &regs)
{
console *cons = console::get();
syscall call = static_cast<syscall>(regs.rax);
@@ -65,7 +65,7 @@ syscall_dispatch(uintptr_t return_rsp, const cpu_state &regs)
auto *p = s.current();
p->wait_on_signal(-1ull);
cons->printf("\nReceived PAUSE syscall\n");
return_rsp = s.tick(return_rsp);
return_rsp = s.schedule(return_rsp);
cons->set_color();
}
break;
@@ -78,7 +78,7 @@ syscall_dispatch(uintptr_t return_rsp, const cpu_state &regs)
auto *p = s.current();
p->wait_on_time(regs.rbx);
cons->printf("\nReceived SLEEP syscall\n");
return_rsp = s.tick(return_rsp);
return_rsp = s.schedule(return_rsp);
cons->set_color();
}
break;