Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc * proc_trampoline: call `proc_trampolin...



details:   https://anonhg.NetBSD.org/src/rev/e92c1617696d
branches:  trunk
changeset: 504435:e92c1617696d
user:      pk <pk%NetBSD.org@localhost>
date:      Fri Mar 02 10:27:00 2001 +0000

description:
* proc_trampoline: call `proc_trampoline_mp()' #if MULTIPROCESSOR;
  currently necessary to acquire the `running in kernel mode' lock;
  pointed out by Bill Sommerfeld/Simon Gerraty.

* remove reference to `cpu_set_kpc()' from comments, as we don't have it.

diffstat:

 sys/arch/sparc/sparc/locore.s |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r 637352d16052 -r e92c1617696d sys/arch/sparc/sparc/locore.s
--- a/sys/arch/sparc/sparc/locore.s     Fri Mar 02 09:48:13 2001 +0000
+++ b/sys/arch/sparc/sparc/locore.s     Fri Mar 02 10:27:00 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.135 2001/03/02 09:48:13 pk Exp $  */
+/*     $NetBSD: locore.s,v 1.136 2001/03/02 10:27:00 pk Exp $  */
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -4836,23 +4836,36 @@
 
 
 /*
- * cpu_set_kpc() and cpu_fork() arrange for proc_trampoline() to run
- * after after a process gets chosen in switch(). The stack frame will
- * contain a function pointer in %l0, and an argument to pass to it in %l2.
+ * cpu_fork() arrange for proc_trampoline() to run after a process gets
+ * chosen in switch(). The stack frame will contain a function pointer
+ * in %l0, and an argument to pass to it in %l2.
  *
  * If the function *(%l0) returns, we arrange for an immediate return
  * to user mode. This happens in two known cases: after execve(2) of init,
  * and when returning a child to user mode after a fork(2).
+ *
+ * If were setting up a kernel thread, the function *(%l0) will not return.
  */
 ENTRY(proc_trampoline)
-       call    %l0                     ! re-use current frame
+       /*
+        * Note: cpu_fork() has set up a stack frame for us to run in,
+        * so we can call other functions from here without using
+        * `save ... restore'.
+        */
+#ifdef MULTIPROCESSOR
+       /* Finish setup in SMP environment: acquire locks etc. */
+       call _C_LABEL(proc_trampoline_mp)
+        nop
+#endif
+
+       call    %l0
         mov    %l1, %o0
 
        /*
         * Here we finish up as in syscall, but simplified.  We need to
-        * fiddle pc and npc a bit, as execve() / setregs() /cpu_set_kpc()
-        * have only set npc, in anticipation that trap.c will advance past
-        * the trap instruction; but we bypass that, so we must do it manually.
+        * fiddle pc and npc a bit, as execve() / setregs() will have
+        * set npc only, anticipating that trap.c will advance past the
+        * trap instruction; but we bypass that, so we must do it manually.
         */
        mov     PSR_S, %l0              ! user psr (no need to load it)
        !?wr    %g0, 2, %wim            ! %wim = 2



Home | Main Index | Thread Index | Old Index