Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 May 2017 13:17:00 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r319133 - in stable/11/sys: amd64/acpica amd64/amd64 x86/acpica
Message-ID:  <201705291317.v4TDH0XX001830@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon May 29 13:17:00 2017
New Revision: 319133
URL: https://svnweb.freebsd.org/changeset/base/319133

Log:
  MFC r318318:
  Ensure that resume path on amd64 only accesses page tables for normal
  operation after processor is configured to allow all required
  features.

Modified:
  stable/11/sys/amd64/acpica/acpi_wakecode.S
  stable/11/sys/amd64/amd64/cpu_switch.S
  stable/11/sys/x86/acpica/acpi_wakeup.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/acpica/acpi_wakecode.S
==============================================================================
--- stable/11/sys/amd64/acpica/acpi_wakecode.S	Mon May 29 13:10:01 2017	(r319132)
+++ stable/11/sys/amd64/acpica/acpi_wakecode.S	Mon May 29 13:17:00 2017	(r319133)
@@ -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
-	rdmsr
-	orl	$EFER_LME | EFER_SCE, %eax
+	movl	wakeup_efer - wakeup_start(%ebx), %eax
+	movl	wakeup_efer + 4 - wakeup_start(%ebx), %edx
 	wrmsr
 
 	/*
@@ -276,6 +277,8 @@ wakeup_pcb:
 	.quad	0
 wakeup_ret:
 	.quad	0
+wakeup_efer:
+	.quad	0
 wakeup_gdt:
 	.word	0
 	.quad	0

Modified: stable/11/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- stable/11/sys/amd64/amd64/cpu_switch.S	Mon May 29 13:10:01 2017	(r319132)
+++ stable/11/sys/amd64/amd64/cpu_switch.S	Mon May 29 13:17:00 2017	(r319133)
@@ -396,7 +396,7 @@ ENTRY(resumectx)
 	movl	4 + PCB_KGSBASE(%rdi),%edx
 	wrmsr
 
-	/* Restore EFER. */
+	/* Restore EFER one more time. */
 	movl	$MSR_EFER,%ecx
 	movl	PCB_EFER(%rdi),%eax
 	wrmsr

Modified: stable/11/sys/x86/acpica/acpi_wakeup.c
==============================================================================
--- stable/11/sys/x86/acpica/acpi_wakeup.c	Mon May 29 13:10:01 2017	(r319132)
+++ stable/11/sys/x86/acpica/acpi_wakeup.c	Mon May 29 13:17:00 2017	(r319133)
@@ -223,7 +223,9 @@ acpi_sleep_machdep(struct acpi_softc *sc
 		WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
 		WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
 
-#ifndef __amd64__
+#ifdef __amd64__
+		WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER));
+#else
 		WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4);
 #endif
 		WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705291317.v4TDH0XX001830>