summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2014-11-30 20:48:52 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2014-11-30 20:48:52 +0000
commit00bb6ad7449247aa1f562eb6fd8b52d6516ba0ce (patch)
tree76bf8ac54d8eee16c40e30c73387fb78b22308ed /sys/arch
parenta55207cf95cc77bf9cee2a20bdbe9e84a1cc1eae (diff)
Unbreak zzz/ZZZ resume - ensure NX is re-enabled on resume (if enabled).
Also transformed some complicated code that was setting EFER into something much simpler. Tested on a variety of real machines, emulators/VMs, MP, UP, zzz, ZZZ, NX on, NX off ... ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/acpi_wakecode.S22
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/acpi_wakecode.S b/sys/arch/amd64/amd64/acpi_wakecode.S
index 548060b9563..4a8b1dcbd3f 100644
--- a/sys/arch/amd64/amd64/acpi_wakecode.S
+++ b/sys/arch/amd64/amd64/acpi_wakecode.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_wakecode.S,v 1.32 2014/11/30 18:29:11 mlarkin Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.33 2014/11/30 20:48:51 mlarkin Exp $ */
/*
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
@@ -192,24 +192,16 @@ _C_LABEL(acpi_protected_mode_resume):
mov %eax,%cr4
/*
- * Stash away our previously saved EFER in EBX.
- * We have to make sure we don't write to any
- * of the EFER reserved bits, so we zero those
- * out here.
- */
- movl acpi_saved_efer, %ebx
- andl $(EFER_LME | EFER_NXE | EFER_SCE), %ebx
-
- /*
* Set up a temporary long mode GDT describing 2
* segments, one for code and one for data.
*/
lgdt tmp_gdt64
- /* Prepare to enter long mode by enabling LME in EFER */
+ /* Restore saved EFER (LME, NXE, etc) */
movl $MSR_EFER, %ecx
rdmsr
- orl $EFER_LME, %eax
+ movl acpi_saved_efer, %eax
+ andl $(EFER_LME | EFER_NXE | EFER_SCE), %eax
wrmsr
/* Reenable paging using temporary cr3 */
@@ -238,14 +230,10 @@ _C_LABEL(acpi_protected_mode_resume):
.align 16
_ACPI_TRMP_LABEL(acpi_long_mode_trampoline)
_C_LABEL(acpi_long_mode_resume):
- /* Restore the stashed copy of EFER we set aside earlier */
- movl %ebx, %eax
- movl $MSR_EFER, %ecx
- wrmsr
/* Load GDT based on our saved copy */
lgdt acpi_saved_gdt
-
+
/* Reset segment registers */
movw $GSEL(GDATA_SEL, SEL_KPL),%ax
movw %ax,%ds