From: visa Date: Thu, 24 Feb 2022 14:16:53 +0000 (+0000) Subject: Reserve room for holding curcpu pointer in u-area X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d2727645f3baf87db21e273afee766a911778509;p=openbsd Reserve room for holding curcpu pointer in u-area The tp register contains the curcpu pointer in kernel mode. The pointer has to be saved and replaced with the TCB pointer in the register when entering user mode. These steps are reversed when returning to kernel. The curcpu pointer is saved in the u-area. Explicitly reserve room for the pointer to make the saving more visible. OK kettenis@ --- diff --git a/sys/arch/riscv64/riscv64/vm_machdep.c b/sys/arch/riscv64/riscv64/vm_machdep.c index d5868a341c1..f94b7c2777b 100644 --- a/sys/arch/riscv64/riscv64/vm_machdep.c +++ b/sys/arch/riscv64/riscv64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.8 2022/02/22 07:47:46 visa Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.9 2022/02/24 14:16:53 visa Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -74,6 +74,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, tf = (struct trapframe *)((u_long)p2->p_addr + USPACE - sizeof(struct trapframe) + - sizeof(register_t) /* for holding curcpu */ - 0x10); tf = (struct trapframe *)STACKALIGN(tf);