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 Idle(), only switch to the idle PCB ...



details:   https://anonhg.NetBSD.org/src/rev/6cd6b7fde127
branches:  trunk
changeset: 499438:6cd6b7fde127
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Nov 20 02:44:45 2000 +0000

description:
In Idle(), only switch to the idle PCB if we're not already running
on it, and make sure to deactivate the old process's address space,
as this will not otherwise be done by cpu_switch() later once we're
on the idle PCB.

Also, update some comments related to when s0 (i.e. the old process)
is NULL in the context switching code.

diffstat:

 sys/arch/alpha/alpha/locore.s |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r dbc9602f1ee4 -r 6cd6b7fde127 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Mon Nov 20 02:00:46 2000 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Mon Nov 20 02:44:45 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.82 2000/11/19 20:11:12 sommerfeld Exp $ */
+/* $NetBSD: locore.s,v 1.83 2000/11/20 02:44:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.82 2000/11/19 20:11:12 sommerfeld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.83 2000/11/20 02:44:45 thorpej Exp $");
 
 #include "assym.h"
 
@@ -773,9 +773,17 @@
        GET_CURPROC
        stq     zero, 0(v0)                     /* curproc <- NULL for stats */
 #if defined(MULTIPROCESSOR)
+       /*
+        * Switch to the idle PCB unless we're already running on it
+        * (if s0 == NULL, we're already on it...)
+        */
+       beq     s0, 1f                          /* skip if s0 == NULL */
+       mov     s0, a0
+       CALL(pmap_deactivate)                   /* pmap_deactivate(oldproc) */
        GET_IDLE_PCB(a0)
        SWITCH_CONTEXT
-       mov     zero,s0                         /* no outgoing proc */
+       mov     zero, s0                        /* no outgoing proc */
+1:
 #endif
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
        CALL(sched_unlock_idle)                 /* release sched_lock */
@@ -889,11 +897,11 @@
         * do this after we activate, then we might end up
         * incorrectly marking the pmap inactive!
         *
-        * We don't deactivate if we came here from switch_exit
-        * (old pmap no longer exists; vmspace has been freed).
-        * oldproc will be NULL in this case.  We have actually
-        * taken care of calling pmap_deactivate() in cpu_exit(),
-        * before the vmspace went away.
+        * Note that don't deactivate if we don't have to...
+        * We know this if oldproc (s0) == NULL.  This is the
+        * case if we've come from switch_exit() (pmap no longer
+        * exists; vmspace has been freed), or if we switched to
+        * the Idle PCB in the MULTIPROCESSOR case.
         */
        beq     s0, 6f
 



Home | Main Index | Thread Index | Old Index