summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/cpu_switch.S
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-09-06 15:23:28 +0000
committerjhb <jhb@FreeBSD.org>2014-09-06 15:23:28 +0000
commit3a8cf1a38b96c596b62254406e9a4599340dea51 (patch)
tree4b6d323d2c22200ffbb3107e8dc814b6c1d9cf1d /sys/amd64/amd64/cpu_switch.S
parentcd70b067cc30d9b2494dffc0658705e127c96c2c (diff)
downloadFreeBSD-src-3a8cf1a38b96c596b62254406e9a4599340dea51.zip
FreeBSD-src-3a8cf1a38b96c596b62254406e9a4599340dea51.tar.gz
Create a separate structure for per-CPU state saved across suspend and
resume that is a superset of a pcb. Move the FPU state out of the pcb and into this new structure. As part of this, move the FPU resume code on amd64 into a C function. This allows resumectx() to still operate only on a pcb and more closely mirrors the i386 code. Reviewed by: kib (earlier version)
Diffstat (limited to 'sys/amd64/amd64/cpu_switch.S')
-rw-r--r--sys/amd64/amd64/cpu_switch.S29
1 files changed, 1 insertions, 28 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 7c37a41..eb0ee8b 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -399,10 +399,6 @@ ENTRY(savectx)
rdmsr
movl %eax,PCB_SFMASK(%rdi)
movl %edx,PCB_SFMASK+4(%rdi)
- movl xsave_mask,%eax
- movl %eax,PCB_XSMASK(%rdi)
- movl xsave_mask+4,%eax
- movl %eax,PCB_XSMASK+4(%rdi)
sgdt PCB_GDT(%rdi)
sidt PCB_IDT(%rdi)
@@ -467,12 +463,9 @@ ENTRY(resumectx)
movl PCB_SFMASK(%rdi),%eax
wrmsr
- /* Restore CR0 except for FPU mode. */
+ /* Restore CR0, CR2, CR4 and CR3. */
movq PCB_CR0(%rdi),%rax
- andq $~(CR0_EM | CR0_TS),%rax
movq %rax,%cr0
-
- /* Restore CR2, CR4 and CR3. */
movq PCB_CR2(%rdi),%rax
movq %rax,%cr2
movq PCB_CR4(%rdi),%rax
@@ -510,26 +503,6 @@ ENTRY(resumectx)
movq PCB_DR7(%rdi),%rax
movq %rax,%dr7
- /* Restore FPU state. */
- fninit
- movq PCB_FPUSUSPEND(%rdi),%rbx
- movq PCB_XSMASK(%rdi),%rax
- testq %rax,%rax
- jz 1f
- movq %rax,%rdx
- shrq $32,%rdx
- movl $XCR0,%ecx
- xsetbv
- xrstor (%rbx)
- jmp 2f
-1:
- fxrstor (%rbx)
-2:
-
- /* Reload CR0. */
- movq PCB_CR0(%rdi),%rax
- movq %rax,%cr0
-
/* Restore other callee saved registers. */
movq PCB_R15(%rdi),%r15
movq PCB_R14(%rdi),%r14
OpenPOWER on IntegriCloud