summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 8be1080..d85384f 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -309,7 +309,7 @@ void proc_tryreap(Proc *dead) {
if (parent->awaited_death.pid && parent->awaited_death.pid != pid) {
return; /* we're not The One */
}
- regs_savereturn(&parent->regs, pid);
+ proc_savereturn(parent, pid);
if (parent->awaited_death.out) {
struct sys_wait2 __user *out = parent->awaited_death.out;
struct sys_wait2 data;
@@ -417,14 +417,14 @@ static void proc_intr_deliver(Proc *p) {
// one more because the buffer itself isn't NUL terminated
// TODO ensure NUL termination
- void __user *sp = p->regs.rsp - 128 - sizeof(d) - intr->len - 1;
+ void __user *sp = (void __user*)(p->regs.rsp - 128 - sizeof(d) - intr->len - 1);
pcpy_to(p, sp, &d, sizeof(d));
pcpy_to(p, sp + sizeof(d), intr->buf, intr->len);
pcpy_to(p, sp + sizeof(d) + intr->len, "", 1);
/* switch to intr handler */
p->regs.rip = (uint64_t)p->intr_fn;
- p->regs.rsp = sp;
+ p->regs.rsp = (uint64_t)sp;
kfree(p->queuedintr);
p->queuedintr = NULL;
@@ -518,6 +518,10 @@ Proc *proc_next(Proc *root, Proc *p) {
return p->sibling;
}
+void proc_savereturn(Proc *p, uint64_t val) {
+ p->regs.rax = val;
+}
+
void proc_setstate(Proc *p, enum proc_state state) {
assert(p->state != PS_FREED);
if (state == PS_FREED) {