aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/proc.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-10-30 00:57:33 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2024-10-30 00:57:33 +0200
commit44a73ecab6e91519627786a5101cd4f1a2f2b0d7 (patch)
treef5c811050a4d5ee832f5883c4d0c27efddd60817 /arch/riscv64/kernel/proc.c
parent5976ad390a15726c3ddfacf8c8b282c8350f9554 (diff)
downloadkmi-44a73ecab6e91519627786a5101cd4f1a2f2b0d7.tar.gz
kmi-44a73ecab6e91519627786a5101cd4f1a2f2b0d7.zip
most of the way to passing tests
Diffstat (limited to 'arch/riscv64/kernel/proc.c')
-rw-r--r--arch/riscv64/kernel/proc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c
index f012b20..3ae2e15 100644
--- a/arch/riscv64/kernel/proc.c
+++ b/arch/riscv64/kernel/proc.c
@@ -81,7 +81,7 @@ void set_thread(struct tcb *t)
struct riscv_regs *r = (struct riscv_regs *)(t->regs) - 1;
/* insert important values into register slots */
- r->sp = (long)t->thread_stack + t->thread_stack_size;
+ r->sp = (long)t->rpc_stack - BASE_PAGE_SIZE;
}
void set_stack(struct tcb *t, vm_t s)
@@ -99,9 +99,15 @@ vm_t get_stack(struct tcb *t)
void copy_regs(struct tcb *d, struct tcb *s)
{
- struct riscv_regs *rd = (struct riscv_regs *)(d->regs) - 1;
- struct riscv_regs *rs = (struct riscv_regs *)(s->regs) - 1;
- *rd = *rs;
+ struct riscv_regs rs = *((struct riscv_regs *)(s->regs) - 1);
+ /* again, not a fan of this, I guess we could query the underlying
+ * physical page? Would that be any faster? */
+ use_vmem(d->rpc.vmem);
+
+ struct riscv_regs *rd = ((struct riscv_regs *)(d->regs) - 1);
+ *rd = rs;
+
+ use_vmem(s->rpc.vmem);
}
void adjust_ipi(struct tcb *t)