From 83ec75327c1ec35f25b6aee24f616a41858be539 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 1 Nov 2024 11:43:14 +0200 Subject: move stack modifications to be earlier in rpc --- arch/riscv64/kernel/vmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'arch/riscv64') diff --git a/arch/riscv64/kernel/vmem.c b/arch/riscv64/kernel/vmem.c index bd7906b..4556593 100644 --- a/arch/riscv64/kernel/vmem.c +++ b/arch/riscv64/kernel/vmem.c @@ -605,6 +605,10 @@ stat_t setup_rpc_stack(struct tcb *t) vmflags_t flags = VM_V | VM_R | VM_W; /* note how VM_U is missing, userspace messing about will be done later */ + /* don't generate interrupt on first access, since it'll come from + * inside the kernel and we can't handle that */ + flags |= VM_A | VM_D; + pm_t page = alloc_page(MM_O1); if (!page) return ERR_OOMEM; @@ -751,7 +755,7 @@ void destroy_rpc(struct tcb *t) set_bits(*pte, vp_flags(VM_U)); } - t->arch.rpc_idx = ctx - 1; + t->arch.rpc_idx = ctx - 2; } void grow_rpc(struct tcb *t, vm_t top) -- cgit v1.3