| version 1.57, 2007/11/14 17:54:59 |
version 1.58, 2007/12/03 19:06:36 |
|
|
| ret |
ret |
| |
|
| /* |
/* |
| * struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp) |
* struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp, |
| |
* bool returning) |
| * |
* |
| * 1. if (oldlwp != NULL), save its context. |
* 1. if (oldlwp != NULL), save its context. |
| * 2. then, restore context of newlwp. |
* 2. then, restore context of newlwp. |
| Line 738 ENTRY(cpu_switchto) |
|
| Line 739 ENTRY(cpu_switchto) |
|
| |
|
| movl 16(%esp),%esi # oldlwp |
movl 16(%esp),%esi # oldlwp |
| movl 20(%esp),%edi # newlwp |
movl 20(%esp),%edi # newlwp |
| |
movl 24(%esp),%edx # returning |
| testl %esi,%esi |
testl %esi,%esi |
| jz 1f |
jz 1f |
| |
|
| Line 751 ENTRY(cpu_switchto) |
|
| Line 753 ENTRY(cpu_switchto) |
|
| movl PCB_EBP(%ebx),%ebp |
movl PCB_EBP(%ebx),%ebp |
| movl PCB_ESP(%ebx),%esp |
movl PCB_ESP(%ebx),%esp |
| |
|
| |
/* Set curlwp. */ |
| |
movl %edi,CPUVAR(CURLWP) |
| |
|
| |
/* Skip the rest if returning to a pinned LWP. */ |
| |
testl %edx,%edx |
| |
jnz 4f |
| |
|
| /* Switch TSS. Reset "task busy" flag before loading. */ |
/* Switch TSS. Reset "task busy" flag before loading. */ |
| movl %cr3,%eax |
movl %cr3,%eax |
| movl %eax,PCB_CR3(%ebx) # for TSS gates |
movl %eax,PCB_CR3(%ebx) # for TSS gates |
| Line 759 ENTRY(cpu_switchto) |
|
| Line 768 ENTRY(cpu_switchto) |
|
| andl $~0x0200,4(%ecx,%edx, 1) |
andl $~0x0200,4(%ecx,%edx, 1) |
| ltr %dx |
ltr %dx |
| |
|
| /* Set curlwp. */ |
|
| movl %edi,CPUVAR(CURLWP) |
|
| |
|
| /* Don't bother with the rest if switching to a system process. */ |
/* Don't bother with the rest if switching to a system process. */ |
| testl $LW_SYSTEM,L_FLAG(%edi) |
testl $LW_SYSTEM,L_FLAG(%edi) |
| jnz 4f |
jnz 4f |
|
|
| pushl $4f |
pushl $4f |
| call _C_LABEL(printf) |
call _C_LABEL(printf) |
| addl $4,%esp |
addl $4,%esp |
| #ifdef DDB |
pushl $IPL_NONE |
| int $3 |
call _C_LABEL(spllower) |
| #endif /* DDB */ |
addl $4,%esp |
| movl $IPL_NONE,CPUVAR(ILEVEL) |
|
| jmp .Lsyscall_checkast |
jmp .Lsyscall_checkast |
| 4: .asciz "WARNING: SPL NOT LOWERED ON SYSCALL EXIT\n" |
4: .asciz "WARNING: SPL NOT LOWERED ON SYSCALL EXIT\n" |
| 5: .asciz "WARNING: SPL NOT ZERO ON SYSCALL ENTRY\n" |
5: .asciz "WARNING: SPL NOT ZERO ON SYSCALL ENTRY\n" |