Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha In cpu_lwp_fork(), make sure that the P...



details:   https://anonhg.NetBSD.org/src/rev/af5aa7285ce1
branches:  trunk
changeset: 937364:af5aa7285ce1
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Aug 16 18:05:52 2020 +0000

description:
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.

diffstat:

 sys/arch/alpha/alpha/vm_machdep.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r b5a453fd7b54 -r af5aa7285ce1 sys/arch/alpha/alpha/vm_machdep.c
--- a/sys/arch/alpha/alpha/vm_machdep.c Sun Aug 16 18:04:33 2020 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c Sun Aug 16 18:05:52 2020 +0000
@@ -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 @@
                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



Home | Main Index | Thread Index | Old Index