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@
-/* $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.
tf = (struct trapframe *)((u_long)p2->p_addr
+ USPACE
- sizeof(struct trapframe)
+ - sizeof(register_t) /* for holding curcpu */
- 0x10);
tf = (struct trapframe *)STACKALIGN(tf);