Module Name: src
Committed By: thorpej
Date: Sun Aug 16 18:05:52 UTC 2020
Modified Files:
src/sys/arch/alpha/alpha: vm_machdep.c
Log Message:
In cpu_lwp_fork(), make sure that the PTBR field in l2's HWPCB references
the lev1map associated with l2's pmap. Otherwise, the first time we
SWPCTX to l2, we'll be on l1's page tables until the first pmap_activate()
call for l2.
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/alpha/alpha/vm_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/alpha/alpha/vm_machdep.c
diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.114 src/sys/arch/alpha/alpha/vm_machdep.c:1.115
--- src/sys/arch/alpha/alpha/vm_machdep.c:1.114 Mon Mar 19 10:31:56 2018
+++ src/sys/arch/alpha/alpha/vm_machdep.c Sun Aug 16 18:05:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.115 2020/08/16 18:05:52 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.115 2020/08/16 18:05:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -109,9 +109,15 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
pcb2->pcb_hw.apcb_usp = alpha_pal_rdusp();
/*
- * Arrange for a non-local goto when the new process
- * is started, to resume here, returning nonzero from setjmp.
+ * Put l2's lev1map into its PTBR so that it will be on its
+ * own page tables as the SWPCTX to its PCB is made. ASN
+ * doesn't matter at this point; that will be handled on l2's
+ * first pmap_activate() call.
*/
+ pmap_t const pmap2 = l2->l_proc->p_vmspace->vm_map.pmap;
+ pcb2->pcb_hw.apcb_ptbr =
+ ALPHA_K0SEG_TO_PHYS((vaddr_t)pmap2->pm_lev1map) >> PGSHIFT;
+
#ifdef DIAGNOSTIC
/*
* If l1 != curlwp && l1 == &lwp0, we are creating a kernel