diff options
author | jkim <jkim@FreeBSD.org> | 2014-03-10 20:47:24 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2014-03-10 20:47:24 +0000 |
commit | b04308525e3508d101dc42c32de43d004e6f8204 (patch) | |
tree | ec52f43570df230ac8deb378b93f8dc5d879b214 | |
parent | 7086b821e4270a1eae94d0cb299e04bec6be39d3 (diff) | |
download | FreeBSD-src-b04308525e3508d101dc42c32de43d004e6f8204.zip FreeBSD-src-b04308525e3508d101dc42c32de43d004e6f8204.tar.gz |
MFC: r262746, r262748, r262750, r262752
Move fpusave() wrapper for suspend hander to sys/amd64/amd64/fpu.c.
-rw-r--r-- | sys/amd64/amd64/cpu_switch.S | 17 | ||||
-rw-r--r-- | sys/amd64/amd64/fpu.c | 11 | ||||
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 2 | ||||
-rw-r--r-- | sys/amd64/include/fpu.h | 1 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 1 | ||||
-rw-r--r-- | sys/x86/acpica/acpi_wakeup.c | 2 |
6 files changed, 16 insertions, 18 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index ac30990..7c37a41 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -345,8 +345,8 @@ ENTRY(savectx) movq %r14,PCB_R14(%rdi) movq %r15,PCB_R15(%rdi) - movq %cr0,%rsi - movq %rsi,PCB_CR0(%rdi) + movq %cr0,%rax + movq %rax,PCB_CR0(%rdi) movq %cr2,%rax movq %rax,PCB_CR2(%rdi) movq %cr3,%rax @@ -409,8 +409,6 @@ ENTRY(savectx) sldt PCB_LDT(%rdi) str PCB_TR(%rdi) -2: movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ - movl $1,%eax ret END(savectx) @@ -548,14 +546,3 @@ ENTRY(resumectx) xorl %eax,%eax ret END(resumectx) - -/* - * Wrapper around fpusave to care about TS0_CR. - */ -ENTRY(ctx_fpusave) - movq %cr0,%rsi - clts - call fpusave - movq %rsi,%cr0 - ret -END(ctx_fpusave) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 9bc8a2f..fe10a81 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -162,6 +162,17 @@ fpurestore(void *addr) fxrstor((char *)addr); } +void +fpususpend(void *addr) +{ + u_long cr0; + + cr0 = rcr0(); + stop_emulating(); + fpusave(addr); + load_cr0(cr0); +} + /* * Enable XSAVE if supported and allowed by user. * Calculate the xsave_mask. diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 4af4f8f..1b38f60 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -1464,7 +1464,7 @@ cpususpend_handler(void) cpu = PCPU_GET(cpuid); if (savectx(susppcbs[cpu])) { - ctx_fpusave(susppcbs[cpu]->pcb_fpususpend); + fpususpend(susppcbs[cpu]->pcb_fpususpend); wbinvd(); CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { diff --git a/sys/amd64/include/fpu.h b/sys/amd64/include/fpu.h index 1ce59d0..ef5d623 100644 --- a/sys/amd64/include/fpu.h +++ b/sys/amd64/include/fpu.h @@ -63,6 +63,7 @@ int fpusetregs(struct thread *td, struct savefpu *addr, char *xfpustate, size_t xfpustate_size); int fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size); +void fpususpend(void *addr); int fputrap_sse(void); int fputrap_x87(void); void fpuuserinited(struct thread *td); diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 34bfde4..5ddfbbd 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -89,7 +89,6 @@ void *alloc_fpusave(int flags); void amd64_syscall(struct thread *td, int traced); void busdma_swi(void); void cpu_setregs(void); -void ctx_fpusave(void *); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds)); diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index 13119d3..2bedf00 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -202,7 +202,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) if (savectx(susppcbs[0])) { #ifdef __amd64__ - ctx_fpusave(susppcbs[0]->pcb_fpususpend); + fpususpend(susppcbs[0]->pcb_fpususpend); #endif #ifdef SMP if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { |