version 1.1.2.4, 2002/12/12 12:43:07 |
version 1.1.2.5, 2002/12/19 00:33:48 |
|
|
|
|
/*****************************************************************************/ |
/*****************************************************************************/ |
|
|
/* |
|
* The following primitives manipulate the run queues. |
|
* _whichqs tells which of the 32 queues _qs |
|
* have processes in them. Setrq puts processes into queues, Remrq |
|
* removes them from queues. The running process is on no queue, |
|
* other processes are on a queue related to p->p_pri, divided by 4 |
|
* actually to shrink the 0-127 range of priorities into the 32 available |
|
* queues. |
|
*/ |
|
.globl _C_LABEL(sched_whichqs),_C_LABEL(sched_qs) |
.globl _C_LABEL(sched_whichqs),_C_LABEL(sched_qs) |
.globl _C_LABEL(uvmexp),_C_LABEL(panic) |
.globl _C_LABEL(uvmexp),_C_LABEL(panic) |
|
|
/* |
|
* void setrunqueue(struct lwp *p); |
|
* Insert a process on the appropriate queue. Should be called at splclock(). |
|
* See setrunqueue(9) for more details. |
|
*/ |
|
/* LINTSTUB: Func: void setrunqueue(struct lwp *p) */ |
|
NENTRY(setrunqueue) |
|
movl 4(%esp),%eax |
|
#ifdef DIAGNOSTIC |
|
cmpl $0,L_BACK(%eax) # should not be on q already |
|
jne 1f |
|
cmpl $0,L_WCHAN(%eax) |
|
jne 1f |
|
cmpb $LSRUN,L_STAT(%eax) |
|
jne 1f |
|
#endif /* DIAGNOSTIC */ |
|
movzbl L_PRIORITY(%eax),%edx |
|
shrl $2,%edx |
|
btsl %edx,_C_LABEL(sched_whichqs) # set q full bit |
|
leal _C_LABEL(sched_qs)(,%edx,8),%edx # locate q hdr |
|
movl L_BACK(%edx),%ecx |
|
movl %edx,L_FORW(%eax) # link process on tail of q |
|
movl %eax,L_BACK(%edx) |
|
movl %eax,L_FORW(%ecx) |
|
movl %ecx,L_BACK(%eax) |
|
ret |
|
#ifdef DIAGNOSTIC |
|
1: pushl $2f |
|
call _C_LABEL(panic) |
|
/* NOTREACHED */ |
|
2: .asciz "setrunqueue" |
|
#endif /* DIAGNOSTIC */ |
|
|
|
/* |
|
* void remrunqueue(struct lwp *p); |
|
* Remove a process from its queue. Should be called at splclock(). |
|
* See remrunqueue(9) for more details. |
|
*/ |
|
/* LINTSTUB: Func: void remrunqueue(struct lwp *p) */ |
|
NENTRY(remrunqueue) |
|
movl 4(%esp),%ecx |
|
movzbl L_PRIORITY(%ecx),%eax |
|
#ifdef DIAGNOSTIC |
|
shrl $2,%eax |
|
btl %eax,_C_LABEL(sched_whichqs) |
|
jnc 1f |
|
#endif /* DIAGNOSTIC */ |
|
movl L_BACK(%ecx),%edx # unlink process |
|
movl $0,L_BACK(%ecx) # zap reverse link to indicate off list |
|
movl L_FORW(%ecx),%ecx |
|
movl %ecx,L_FORW(%edx) |
|
movl %edx,L_BACK(%ecx) |
|
cmpl %ecx,%edx # q still has something? |
|
jne 2f |
|
#ifndef DIAGNOSTIC |
|
shrl $2,%eax |
|
#endif |
|
btrl %eax,_C_LABEL(sched_whichqs) # no; clear bit |
|
2: ret |
|
#ifdef DIAGNOSTIC |
|
1: pushl $3f |
|
call _C_LABEL(panic) |
|
/* NOTREACHED */ |
|
3: .asciz "remrunqueue" |
|
#endif /* DIAGNOSTIC */ |
|
|
|
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
NENTRY(switch_error) |
NENTRY(switch_error) |
pushl $1f |
pushl $1f |
Line 2020 switch_restored: |
|
Line 1945 switch_restored: |
|
|
|
/* |
/* |
* Check for restartable atomic sequences (RAS) |
* Check for restartable atomic sequences (RAS) |
* XXX %edi reloads are not necessary here as %edi is callee-saved! |
|
*/ |
*/ |
movl CPUVAR(CURLWP),%edi |
movl CPUVAR(CURLWP),%edi |
movl L_PROC(%edi),%esi |
movl L_PROC(%edi),%esi |
cmpl $0,P_NRAS(%esi) |
cmpl $0,P_NRAS(%esi) |
je 1f |
je 1f |
movl L_MD_REGS(%edi),%edx |
movl L_MD_REGS(%edi),%ebx |
movl TF_EIP(%edx),%eax |
movl TF_EIP(%ebx),%eax |
pushl %eax |
pushl %eax |
pushl %esi |
pushl %esi |
call _C_LABEL(ras_lookup) |
call _C_LABEL(ras_lookup) |
addl $8,%esp |
addl $8,%esp |
cmpl $-1,%eax |
cmpl $-1,%eax |
je 1f |
je 1f |
movl CPUVAR(CURLWP),%edi |
movl %eax,TF_EIP(%ebx) |
movl L_MD_REGS(%edi),%edx |
|
movl %eax,TF_EIP(%edx) |
|
1: |
1: |
xor %eax,%eax |
xor %eax,%eax |
|
|