When getting the lwp to switch to, test to see if the scheduling queue is
empty, and if so panic. Change references to "proc/process" to lwp.
This commit is contained in:
parent
9ec3d05b38
commit
3527dc3950
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: locore_subr.S,v 1.15 2003/08/04 00:32:49 matt Exp $ */
|
/* $NetBSD: locore_subr.S,v 1.16 2003/08/11 15:39:24 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||||
|
@ -129,10 +129,14 @@
|
||||||
GLOBAL(powersave)
|
GLOBAL(powersave)
|
||||||
.long -1
|
.long -1
|
||||||
|
|
||||||
|
.rodata
|
||||||
|
.Lqspanic:
|
||||||
|
.string "cpu_switch: queue %d [%08x] is empty!"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 2
|
.align 2
|
||||||
/*
|
/*
|
||||||
* No processes are runnable, so loop waiting for one.
|
* No lwps are runnable, so loop waiting for one.
|
||||||
* Separate label here for accounting purposes.
|
* Separate label here for accounting purposes.
|
||||||
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
|
* When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
|
||||||
*/
|
*/
|
||||||
|
@ -200,7 +204,7 @@ ENTRY(switch_exit)
|
||||||
*/
|
*/
|
||||||
addi %r1,%r6,USPACE-CALLFRAMELEN
|
addi %r1,%r6,USPACE-CALLFRAMELEN
|
||||||
/*
|
/*
|
||||||
* Schedule the vmspace and stack to be freed (the proc arg is
|
* Schedule the vmspace and stack to be freed (the lwp arg is
|
||||||
* already in r3). Function to call is in r4.
|
* already in r3). Function to call is in r4.
|
||||||
*/
|
*/
|
||||||
mtctr %r4
|
mtctr %r4
|
||||||
|
@ -210,12 +214,12 @@ ENTRY(switch_exit)
|
||||||
bl _C_LABEL(sched_lock_idle)
|
bl _C_LABEL(sched_lock_idle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fall through to cpu_switch to actually select another proc */
|
/* Fall through to cpu_switch to actually select another lwp */
|
||||||
li %r3,0 /* indicate exited process */
|
li %r3,0 /* indicate exited lwp */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void cpu_switch(struct lwp *l)
|
* void cpu_switch(struct lwp *l)
|
||||||
* Find a runnable process and switch to it.
|
* Find a runnable lwp and switch to it.
|
||||||
*/
|
*/
|
||||||
ENTRY_NOPROFILE(cpu_switch)
|
ENTRY_NOPROFILE(cpu_switch)
|
||||||
mflr %r0 /* save lr */
|
mflr %r0 /* save lr */
|
||||||
|
@ -228,7 +232,7 @@ ENTRY_NOPROFILE(cpu_switch)
|
||||||
#if defined(MULTIPROCESSOR)
|
#if defined(MULTIPROCESSOR)
|
||||||
/* Switch to the idle PCB unless we're already running on it. */
|
/* Switch to the idle PCB unless we're already running on it. */
|
||||||
GET_CPUINFO(%r7)
|
GET_CPUINFO(%r7)
|
||||||
cmpwi %r30,0 /* old process was exiting? */
|
cmpwi %r30,0 /* old lwp was exiting? */
|
||||||
beq 1f
|
beq 1f
|
||||||
|
|
||||||
#if defined(PPC_OEA) && !defined(PPC_OEA64)
|
#if defined(PPC_OEA) && !defined(PPC_OEA64)
|
||||||
|
@ -286,7 +290,7 @@ ENTRY_NOPROFILE(cpu_switch)
|
||||||
bl _C_LABEL(sched_lock_idle)
|
bl _C_LABEL(sched_lock_idle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Find a new process */
|
/* Find a new lwp */
|
||||||
lis %r8,_C_LABEL(sched_whichqs)@ha
|
lis %r8,_C_LABEL(sched_whichqs)@ha
|
||||||
ldint %r9,_C_LABEL(sched_whichqs)@l(%r8)
|
ldint %r9,_C_LABEL(sched_whichqs)@l(%r8)
|
||||||
|
|
||||||
|
@ -299,10 +303,19 @@ ENTRY_NOPROFILE(cpu_switch)
|
||||||
slwi %r3,%r10,3
|
slwi %r3,%r10,3
|
||||||
add %r3,%r3,%r4 /* select queue */
|
add %r3,%r3,%r4 /* select queue */
|
||||||
|
|
||||||
ldptr %r31,L_FORW(%r3) /* unlink first proc from queue */
|
ldptr %r31,L_FORW(%r3) /* get first lwp from queue */
|
||||||
ldptr %r4,L_FORW(%r31)
|
cmplw %r31,%r3 /* empty queue? */
|
||||||
streg %r4,L_FORW(%r3)
|
bne+ 1f /* nope. skip panic */
|
||||||
streg %r3,L_BACK(%r4)
|
mr %r5,%r9 /* save sched_whichqs value */
|
||||||
|
mr %r4,%r10 /* save the bit # */
|
||||||
|
lis %r8,.Lqspanic@ha /* get panic string (HI) */
|
||||||
|
addi %r3,%r8,.Lqspanic@l /* get panic string (LO) */
|
||||||
|
bl _C_LABEL(panic) /* now panic */
|
||||||
|
1:
|
||||||
|
/* unlink first lwp from queue */
|
||||||
|
ldptr %r4,L_FORW(%r31) /* next = l->l_forw */
|
||||||
|
streg %r4,L_FORW(%r3) /* qh->qh_flink = next; */
|
||||||
|
streg %r3,L_BACK(%r4) /* next->l_back = qh */
|
||||||
|
|
||||||
cmpl %cr0,%r3,%r4 /* queue empty? */
|
cmpl %cr0,%r3,%r4 /* queue empty? */
|
||||||
bne 1f
|
bne 1f
|
||||||
|
@ -324,11 +337,11 @@ switch_common:
|
||||||
streg %r4,L_CPU(%r31) /* l->l_cpu = curcpu() */
|
streg %r4,L_CPU(%r31) /* l->l_cpu = curcpu() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Process now running on a processor. */
|
/* lwp now running on a processor. */
|
||||||
li %r3,LSONPROC /* l->l_stat = LSONPROC */
|
li %r3,LSONPROC /* l->l_stat = LSONPROC */
|
||||||
stint %r3,L_STAT(%r31)
|
stint %r3,L_STAT(%r31)
|
||||||
|
|
||||||
/* record new process */
|
/* record new lwp */
|
||||||
stptr %r31,CI_CURLWP(%r4)
|
stptr %r31,CI_CURLWP(%r4)
|
||||||
ldptr %r4,L_ADDR(%r31)
|
ldptr %r4,L_ADDR(%r31)
|
||||||
|
|
||||||
|
@ -369,7 +382,7 @@ switch_exited:
|
||||||
#endif
|
#endif
|
||||||
isync
|
isync
|
||||||
|
|
||||||
ldreg %r1,PCB_SP(%r4) /* get new procs SP */
|
ldreg %r1,PCB_SP(%r4) /* get new lwp's SP */
|
||||||
SWITCHFRAME_RESTORE(%r1) /* get non-volatile, CR, R2, USER_SR */
|
SWITCHFRAME_RESTORE(%r1) /* get non-volatile, CR, R2, USER_SR */
|
||||||
ldreg %r1,0(%r1) /* get saved SP */
|
ldreg %r1,0(%r1) /* get saved SP */
|
||||||
mr %r2,%r12 /* get saved r2 */
|
mr %r2,%r12 /* get saved r2 */
|
||||||
|
@ -444,7 +457,7 @@ ENTRY(cpu_switchto)
|
||||||
#if defined(MULTIPROCESSOR)
|
#if defined(MULTIPROCESSOR)
|
||||||
/* Switch to the idle PCB unless we're already running on it. */
|
/* Switch to the idle PCB unless we're already running on it. */
|
||||||
GET_CPUINFO(%r7)
|
GET_CPUINFO(%r7)
|
||||||
cmpwi %r30,0 /* old process was exiting? */
|
cmpwi %r30,0 /* old lwp was exiting? */
|
||||||
beq 1f
|
beq 1f
|
||||||
|
|
||||||
#if defined(PPC_OEA) && !defined(PPC_OEA64)
|
#if defined(PPC_OEA) && !defined(PPC_OEA64)
|
||||||
|
|
Loading…
Reference in New Issue