|author||Konstantin Belousov <kib@FreeBSD.org>||2017-05-15 20:52:43 +0000|
|committer||Konstantin Belousov <kib@FreeBSD.org>||2017-05-15 20:52:43 +0000|
Ensure that resume path on amd64 only accesses page tables for normal
operation after processor is configured to allow all required features. In particular, NX must be enabled in EFER, otherwise load of page table element with nx bit set causes reserved bit page fault. Since malloc uses direct mapping for small allocations, in particular for the suspension pcbs, and DMAP is nx after r316767, this commit tripped fault on resume path. Restore complete state of EFER while wakeup code is still executing with custom page table, before calling resumectx, instead of trying to guess which features might be needed before resumectx restored EFER on its own. Bisected and tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes: svn path=/head/; revision=318318
Diffstat (limited to 'sys/amd64/acpica/acpi_wakecode.S')
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/amd64/acpica/acpi_wakecode.S b/sys/amd64/acpica/acpi_wakecode.S
index 6b36d55e7d26..a63b5b8b7692 100644
@@ -156,11 +156,12 @@ wakeup_32:
* Enable EFER.LME so that we get long mode when all the prereqs are
* in place. In this case, it turns on when CR0_PG is finally enabled.
- * Pick up a few other EFER bits that we'll use need we're here.
+ * Also it picks up a few other EFER bits that we'll use need we're
+ * here, like SYSCALL and NX enable.
movl $MSR_EFER, %ecx
- orl $EFER_LME | EFER_SCE, %eax
+ movl wakeup_efer - wakeup_start(%ebx), %eax
+ movl wakeup_efer + 4 - wakeup_start(%ebx), %edx
@@ -276,6 +277,8 @@ wakeup_pcb:
+ .quad 0