cpu_switch.S (187948) | cpu_switch.S (189903) |
---|---|
1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/amd64/amd64/cpu_switch.S 187948 2009-01-31 11:37:21Z obrien $ | 33 * $FreeBSD: head/sys/amd64/amd64/cpu_switch.S 189903 2009-03-17 00:48:11Z jkim $ |
34 */ 35 36#include <machine/asmacros.h> 37#include <machine/specialreg.h> 38 39#include "assym.s" 40#include "opt_sched.h" 41 --- 278 unchanged lines hidden (view full) --- 320 andq $0x0000fc00,%rax 321 andq $~0x0000fc00,%rcx 322 movq %r13,%dr2 323 movq %r12,%dr3 324 orq %rcx,%rax 325 movq %r11,%dr6 326 movq %rax,%dr7 327 jmp done_load_dr | 34 */ 35 36#include <machine/asmacros.h> 37#include <machine/specialreg.h> 38 39#include "assym.s" 40#include "opt_sched.h" 41 --- 278 unchanged lines hidden (view full) --- 320 andq $0x0000fc00,%rax 321 andq $~0x0000fc00,%rcx 322 movq %r13,%dr2 323 movq %r12,%dr3 324 orq %rcx,%rax 325 movq %r11,%dr6 326 movq %rax,%dr7 327 jmp done_load_dr |
328 | |
329END(cpu_switch) | 328END(cpu_switch) |
330 | 329 |
331/* 332 * savectx(pcb) 333 * Update pcb, saving current processor state. 334 */ 335ENTRY(savectx) 336 /* Fetch PCB. */ 337 movq %rdi,%rcx 338 --- 42 unchanged lines hidden (view full) --- 381 leaq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ 382 /* arg 1 (%rdi) already loaded */ 383 call bcopy 3841: 385 popfq 386 387 ret 388END(savectx) | 330/* 331 * savectx(pcb) 332 * Update pcb, saving current processor state. 333 */ 334ENTRY(savectx) 335 /* Fetch PCB. */ 336 movq %rdi,%rcx 337 --- 42 unchanged lines hidden (view full) --- 380 leaq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ 381 /* arg 1 (%rdi) already loaded */ 382 call bcopy 3831: 384 popfq 385 386 ret 387END(savectx) |
388 389/* 390 * savectx2(xpcb) 391 * Update xpcb, saving current processor state. 392 */ 393ENTRY(savectx2) 394 /* Fetch XPCB. */ 395 movq %rdi,%r8 396 397 /* Save caller's return address. */ 398 movq (%rsp),%rax 399 movq %rax,PCB_RIP(%r8) 400 401 mov %ds,PCB_DS(%r8) 402 mov %es,PCB_ES(%r8) 403 mov %ss,XPCB_SS(%r8) 404 mov %fs,PCB_FS(%r8) 405 mov %gs,PCB_GS(%r8) 406 407 movq %rbx,PCB_RBX(%r8) 408 movq %rsp,PCB_RSP(%r8) 409 movq %rbp,PCB_RBP(%r8) 410 movq %r12,PCB_R12(%r8) 411 movq %r13,PCB_R13(%r8) 412 movq %r14,PCB_R14(%r8) 413 movq %r15,PCB_R15(%r8) 414 415 movq %cr0,%rax 416 movq %rax,XPCB_CR0(%r8) 417 movq %cr2,%rax 418 movq %rax,XPCB_CR2(%r8) 419 movq %cr4,%rax 420 movq %rax,XPCB_CR4(%r8) 421 422 movq %dr0,%rax 423 movq %rax,PCB_DR0(%r8) 424 movq %dr1,%rax 425 movq %rax,PCB_DR1(%r8) 426 movq %dr2,%rax 427 movq %rax,PCB_DR2(%r8) 428 movq %dr3,%rax 429 movq %rax,PCB_DR3(%r8) 430 movq %dr6,%rax 431 movq %rax,PCB_DR6(%r8) 432 movq %dr7,%rax 433 movq %rax,PCB_DR7(%r8) 434 435 sgdt XPCB_GDT(%r8) 436 sidt XPCB_IDT(%r8) 437 sldt XPCB_LDT(%r8) 438 str XPCB_TR(%r8) 439 440 movl $MSR_FSBASE,%ecx 441 rdmsr 442 shlq $32,%rdx 443 leaq (%rax,%rdx),%rax 444 movq %rax,PCB_FSBASE(%r8) 445 movl $MSR_GSBASE,%ecx 446 rdmsr 447 shlq $32,%rdx 448 leaq (%rax,%rdx),%rax 449 movq %rax,PCB_GSBASE(%r8) 450 movl $MSR_KGSBASE,%ecx 451 rdmsr 452 shlq $32,%rdx 453 leaq (%rax,%rdx),%rax 454 movq %rax,XPCB_KGSBASE(%r8) 455 456 movl $1, %eax 457 ret 458END(savectx2) |
|