Change switch_exit() to use the *current* proc0 stack pointer, instead of

the *initial* stack pointer.  The proc0 stack is being used by proc0 (i.e.
uvm_scheduler).  This had been working because switch_exit() wasn't
overwriting any critical areas of the stack - unless kernel profiling
was turned on.
This commit is contained in:
mhitch 1999-02-28 20:36:31 +00:00
parent aade0aa230
commit cb8e3b18a7
1 changed files with 5 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.63 1999/01/16 08:45:53 nisimura Exp $ */
/* $NetBSD: locore.S,v 1.64 1999/02/28 20:36:31 mhitch Exp $ */
/*
* Copyright (c) 1992, 1993
@ -358,14 +358,13 @@ END(cpu_switch)
* released by the reaper thread. MUST BE CALLED AT SPLHIGH.
*/
LEAF(switch_exit)
la v0, _C_LABEL(proc0)
lw v0, P_ADDR(v0) # v0 = proc0.p_addr
lw v0, _C_LABEL(proc0paddr) # get proc0 p_addr
nop
sw v0, _C_LABEL(curpcb)
addu sp, v0, USPACE - FRAME_SIZ - CALLFRAME_SIZ
sw v0, _C_LABEL(curpcb) # set current pcb
lw sp, U_PCB_CONTEXT+SF_REG_SP(v0) # restore stack pointer
la ra, sw1 # rathole to cpu_switch()
j _C_LABEL(exit2) # proc already in a0
nop
sub sp, sp, CALLFRAME_SIZ #BDSlot: set stack call frame
END(switch_exit)
/*