From c74af4d852607e41f084031776f0be06e56cc319 Mon Sep 17 00:00:00 2001
From: Roger Pau Monne <roger.pau@citrix.com>
Date: Wed, 23 Jul 2014 16:14:18 +0200
Subject: [PATCH] don't set CR4 PSE bit on amd64

Setting PSE together with PAE or in long mode just makes the PSE bit
completely ignored, so don't set it.

Sponsored by: Citrix Systems R&D
---
 sys/amd64/acpica/acpi_wakecode.S    |    2 +-
 sys/amd64/amd64/mpboot.S            |    2 +-
 sys/amd64/amd64/pmap.c              |    2 +-
 sys/boot/i386/libi386/amd64_tramp.S |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/acpica/acpi_wakecode.S b/sys/amd64/acpica/acpi_wakecode.S
index c4b0dcd..241b12e 100644
--- a/sys/amd64/acpica/acpi_wakecode.S
+++ b/sys/amd64/acpica/acpi_wakecode.S
@@ -150,7 +150,7 @@ wakeup_32:
 
 	/* Turn on the PAE and PSE bits for when paging is enabled */
 	mov	%cr4, %eax
-	orl	$(CR4_PAE | CR4_PSE), %eax
+	orl	$CR4_PAE, %eax
 	mov	%eax, %cr4
 
 	/*
diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S
index ec30c72..089089d 100644
--- a/sys/amd64/amd64/mpboot.S
+++ b/sys/amd64/amd64/mpboot.S
@@ -92,7 +92,7 @@ protmode:
 
 	/* Turn on the PAE, PSE and PGE bits for when paging is enabled */
 	mov	%cr4, %eax
-	orl	$(CR4_PAE | CR4_PSE), %eax
+	orl	$CR4_PAE, %eax
 	mov	%eax, %cr4
 
 	/*
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 3edaae9..70bf1f1 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -826,7 +826,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 
 
 	/* XXX do %cr0 as well */
-	load_cr4(rcr4() | CR4_PGE | CR4_PSE);
+	load_cr4(rcr4() | CR4_PGE);
 	load_cr3(KPML4phys);
 	if (cpu_stdext_feature & CPUID_STDEXT_SMEP)
 		load_cr4(rcr4() | CR4_SMEP);
diff --git a/sys/boot/i386/libi386/amd64_tramp.S b/sys/boot/i386/libi386/amd64_tramp.S
index ff12c66..fe0cf83 100644
--- a/sys/boot/i386/libi386/amd64_tramp.S
+++ b/sys/boot/i386/libi386/amd64_tramp.S
@@ -84,7 +84,7 @@ amd64_tramp:
 
 	/* Turn on PAE */
 	movl	%cr4, %eax
-	orl	$(CR4_PAE | CR4_PSE), %eax
+	orl	$CR4_PAE, %eax
 	movl	%eax, %cr4
 
 	/* Set %cr3 for PT4 */
-- 
1.7.7.5 (Apple Git-26)

