cpu_switch.S (22975) | cpu_switch.S (24691) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * $Id$ | 36 * $Id: swtch.s,v 1.43 1997/02/22 09:32:51 peter Exp $ |
37 */ 38 39#include "apm.h" 40#include "npx.h" 41#include "opt_user_ldt.h" 42 43#include <sys/rtprio.h> 44 --- 184 unchanged lines hidden (view full) --- 229 * to wait for something to come ready. 230 */ 231 ALIGN_TEXT 232_idle: 233 xorl %ebp,%ebp 234 movl $tmpstk,%esp 235 movl _IdlePTD,%ecx 236 movl %ecx,%cr3 | 37 */ 38 39#include "apm.h" 40#include "npx.h" 41#include "opt_user_ldt.h" 42 43#include <sys/rtprio.h> 44 --- 184 unchanged lines hidden (view full) --- 229 * to wait for something to come ready. 230 */ 231 ALIGN_TEXT 232_idle: 233 xorl %ebp,%ebp 234 movl $tmpstk,%esp 235 movl _IdlePTD,%ecx 236 movl %ecx,%cr3 |
237 238 /* update common_tss.tss_esp0 pointer */ 239 movl $_common_tss, %eax 240 movl %esp, TSS_ESP0(%eax) 241 242#ifdef TSS_IS_CACHED /* example only */ 243 /* Reload task register to force reload of selector */ 244 movl _tssptr, %ebx 245 andb $~0x02, 5(%ebx) /* Flip 386BSY -> 386TSS */ 246 movl _gsel_tss, %ebx 247 ltr %bx 248#endif 249 |
|
237 sti 238 239 /* 240 * XXX callers of cpu_switch() do a bogus splclock(). Locking should 241 * be left to cpu_switch(). 242 */ 243 movl $SWI_AST_MASK,_cpl 244 testl $~SWI_AST_MASK,_ipending --- 156 unchanged lines hidden (view full) --- 401 402 movl %eax,P_BACK(%ecx) /* isolate process to run */ 403 movl P_ADDR(%ecx),%edx 404 movl PCB_CR3(%edx),%ebx 405 406 /* switch address space */ 407 movl %ebx,%cr3 408 | 250 sti 251 252 /* 253 * XXX callers of cpu_switch() do a bogus splclock(). Locking should 254 * be left to cpu_switch(). 255 */ 256 movl $SWI_AST_MASK,_cpl 257 testl $~SWI_AST_MASK,_ipending --- 156 unchanged lines hidden (view full) --- 414 415 movl %eax,P_BACK(%ecx) /* isolate process to run */ 416 movl P_ADDR(%ecx),%edx 417 movl PCB_CR3(%edx),%ebx 418 419 /* switch address space */ 420 movl %ebx,%cr3 421 |
422#ifdef HOW_TO_SWITCH_TSS /* example only */ 423 /* Fix up tss pointer to floating pcb/stack structure */ 424 /* XXX probably lots faster to store the 64 bits of tss entry 425 * in the pcb somewhere and copy them on activation. 426 */ 427 movl _tssptr, %ebx 428 movl %edx, %eax /* edx = pcb/tss */ 429 movw %ax, 2(%ebx) /* store bits 0->15 */ 430 roll $16, %eax /* swap upper and lower */ 431 movb %al, 4(%ebx) /* store bits 16->23 */ 432 movb %ah, 7(%ebx) /* store bits 24->31 */ 433 andb $~0x02, 5(%ebx) /* Flip 386BSY -> 386TSS */ 434#endif 435 436 /* update common_tss.tss_esp0 pointer */ 437 movl $_common_tss, %eax 438 movl %edx, %ebx /* pcb */ 439 addl $(UPAGES * PAGE_SIZE), %ebx 440 movl %ebx, TSS_ESP0(%eax) 441 442#ifdef TSS_IS_CACHED /* example only */ 443 /* Reload task register to force reload of selector */ 444 movl _tssptr, %ebx 445 andb $~0x02, 5(%ebx) /* Flip 386BSY -> 386TSS */ 446 movl _gsel_tss, %ebx 447 ltr %bx 448#endif 449 |
|
409 /* restore context */ 410 movl PCB_EBX(%edx),%ebx 411 movl PCB_ESP(%edx),%esp 412 movl PCB_EBP(%edx),%ebp 413 movl PCB_ESI(%edx),%esi 414 movl PCB_EDI(%edx),%edi 415 movl PCB_EIP(%edx),%eax 416 movl %eax,(%esp) --- 88 unchanged lines hidden --- | 450 /* restore context */ 451 movl PCB_EBX(%edx),%ebx 452 movl PCB_ESP(%edx),%esp 453 movl PCB_EBP(%edx),%ebp 454 movl PCB_ESI(%edx),%esi 455 movl PCB_EDI(%edx),%edi 456 movl PCB_EIP(%edx),%eax 457 movl %eax,(%esp) --- 88 unchanged lines hidden --- |