Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Basically revert r1.246 of locore.s...



details:   https://anonhg.NetBSD.org/src/rev/7bb9c628fcff
branches:  trunk
changeset: 341445:7bb9c628fcff
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Nov 06 15:30:59 2015 +0000

description:
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:

        Remove special case handling for userland lwps from cpu_lwp_fork,
        instead do it in lwp_trampoline when we first return to userland.

which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.

Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.

diffstat:

 sys/arch/sparc64/sparc64/locore.s     |   8 +-------
 sys/arch/sparc64/sparc64/vm_machdep.c |  12 ++++++++++--
 2 files changed, 11 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r 2511b8d00680 -r 7bb9c628fcff sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Fri Nov 06 15:30:47 2015 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Fri Nov 06 15:30:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.385 2015/11/05 10:11:51 martin Exp $      */
+/*     $NetBSD: locore.s,v 1.386 2015/11/06 15:30:59 martin Exp $      */
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -5958,12 +5958,6 @@
         mov    %l1, %o0
 
        /*
-        * Going to userland - set proper tstate in trap frame
-        */
-       set     (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT)|((PSTATE_USER)<<TSTATE_PSTATE_SHIFT), %g1
-       stx     %g1, [%sp + CC64FSZ + STKB + TF_TSTATE]
-
-       /*
         * Here we finish up as in syscall, but simplified.
         */
        b       return_from_trap
diff -r 2511b8d00680 -r 7bb9c628fcff sys/arch/sparc64/sparc64/vm_machdep.c
--- a/sys/arch/sparc64/sparc64/vm_machdep.c     Fri Nov 06 15:30:47 2015 +0000
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c     Fri Nov 06 15:30:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.100 2013/09/15 16:04:16 martin Exp $ */
+/*     $NetBSD: vm_machdep.c,v 1.101 2015/11/06 15:30:59 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.100 2013/09/15 16:04:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2015/11/06 15:30:59 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -247,6 +247,14 @@
                tf2->tf_out[6] = (uint64_t)(u_long)stack + stacksize;
 
        /*
+        * Need to create a %tstate if we are forking our first userland
+        * process - in all other cases we inherit from the parent.
+        */
+       if (l2->l_proc->p_pid == 1)
+               tf2->tf_tstate = (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT) |
+                   ((PSTATE_USER)<<TSTATE_PSTATE_SHIFT);
+
+       /*
         * Set return values in child mode and clear condition code,
         * in case we end up running a signal handler before returning
         * to userland.



Home | Main Index | Thread Index | Old Index