diff options
Diffstat (limited to 'sys/amd64/acpica/acpi_switch.S')
-rw-r--r-- | sys/amd64/acpica/acpi_switch.S | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/amd64/acpica/acpi_switch.S b/sys/amd64/acpica/acpi_switch.S index 39f18e5..57a3aa8 100644 --- a/sys/amd64/acpica/acpi_switch.S +++ b/sys/amd64/acpica/acpi_switch.S @@ -102,9 +102,12 @@ ENTRY(acpi_restorecpu) movl WAKEUP_CTX(sfmask), %eax wrmsr - /* Restore CR0, CR2 and CR4. */ + /* Restore CR0 except for FPU mode. */ movq WAKEUP_XPCB(CR0), %rax + andq $~(CR0_EM | CR0_TS), %rax movq %rax, %cr0 + + /* Restore CR2 and CR4. */ movq WAKEUP_XPCB(CR2), %rax movq %rax, %cr2 movq WAKEUP_XPCB(CR4), %rax @@ -149,6 +152,17 @@ ENTRY(acpi_restorecpu) movq WAKEUP_PCB(DR7), %rax movq %rax, %dr7 + /* Restore FPU state. */ + movq PCPU(FPCURTHREAD), %rax + testq %rax, %rax + je 1f + fxrstor WAKEUP_PCB(USER_FPU) +1: + + /* Restore CR0 with FPU mode. */ + movq WAKEUP_XPCB(CR0), %rax + movq %rax, %cr0 + /* Restore return address. */ movq WAKEUP_PCB(RIP), %rax movq %rax, (%rsp) |