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 cpu_switch: values in global registers ...



details:   https://anonhg.NetBSD.org/src/rev/a45082572a71
branches:  trunk
changeset: 555025:a45082572a71
user:      pk <pk%NetBSD.org@localhost>
date:      Fri Nov 07 14:54:29 2003 +0000

description:
cpu_switch: values in global registers are not preserved across function calls.

diffstat:

 sys/arch/sparc/sparc/locore.s |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r e9d727bd3089 -r a45082572a71 sys/arch/sparc/sparc/locore.s
--- a/sys/arch/sparc/sparc/locore.s     Fri Nov 07 14:52:27 2003 +0000
+++ b/sys/arch/sparc/sparc/locore.s     Fri Nov 07 14:54:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.190 2003/10/15 07:49:41 pk Exp $  */
+/*     $NetBSD: locore.s,v 1.191 2003/11/07 14:54:29 pk Exp $  */
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -4953,6 +4953,10 @@
        /* finally, enable traps and continue at splsched() */
        wr      %g2, IPL_SCHED << 8 , %psr      ! psr = newpsr;
 
+       mov     %g3, %l3                ! restore p and lastproc from globals
+       mov     %g4, %l4                ! (globals will get clobbered by the
+                                       !  sched_unlock_idle() below)
+
        sethi   %hi(_WANT_RESCHED), %o0         ! want_resched = 0;
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
        /* Done with the run queues; release the scheduler lock */
@@ -4968,14 +4972,14 @@
         * On multi-processor machines, the context might have changed
         * (e.g. by exec(2)) even if we pick up the same process here.
         */
-       subcc   %g3, %g4, %l0           ! p == lastproc?
+       subcc   %l3, %l4, %l0           ! p == lastproc?
 #if !defined(MULTIPROCESSOR)
        be      Lsw_sameproc            ! yes, context is still set for p
         EMPTY
 #endif
 
+       ld      [%l3 + L_PROC], %o2     ! p = l->l_proc;
        INCR(_C_LABEL(nswitchdiff))     ! clobbers %o0,%o1
-       ld      [%g3 + L_PROC], %o2     ! p = l->l_proc;
        ld      [%o2 + P_VMSPACE], %o3  ! vm = p->p_vmspace;
        ld      [%o3 + VM_PMAP], %o3    ! pm = vm->vm_map.vm_pmap;
 #if defined(MULTIPROCESSOR)



Home | Main Index | Thread Index | Old Index