From 6f54db5d1daed876a012f1a30eefcaeb48cca7de Mon Sep 17 00:00:00 2001
From: Peeter Must <karu.pruun@gmail.com>
Date: Sun, 28 Jun 2015 18:39:29 +0900
Subject: [PATCH] Program PAT indices 5 as WP (from default WT) and 6 as WC
 (from default UC-). Leave 4 and 7 at default WB and UC. Changes taken from
 FreeBSD (svn commit r215703).

---
 sys/platform/pc64/x86_64/pmap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/platform/pc64/x86_64/pmap.c b/sys/platform/pc64/x86_64/pmap.c
index 3af4f30..9589ce4 100644
--- a/sys/platform/pc64/x86_64/pmap.c
+++ b/sys/platform/pc64/x86_64/pmap.c
@@ -1031,14 +1031,14 @@ pmap_init_pat(void)
 		/*
 		 * If we support the PAT then set-up entries for
 		 * WRITE_PROTECTED and WRITE_COMBINING using bit patterns
-		 * 4 and 5.
+		 * 5 and 6.
 		 */
-		pat_msr = (pat_msr & ~PAT_MASK(4)) |
-			  PAT_VALUE(4, PAT_WRITE_PROTECTED);
 		pat_msr = (pat_msr & ~PAT_MASK(5)) |
-			  PAT_VALUE(5, PAT_WRITE_COMBINING);
-		pat_pte_index[PAT_WRITE_PROTECTED] = X86_PG_PTE_PAT | 0;
-		pat_pte_index[PAT_WRITE_COMBINING] = X86_PG_PTE_PAT | X86_PG_NC_PWT;
+			  PAT_VALUE(5, PAT_WRITE_PROTECTED);
+		pat_msr = (pat_msr & ~PAT_MASK(6)) |
+			  PAT_VALUE(6, PAT_WRITE_COMBINING);
+		pat_pte_index[PAT_WRITE_PROTECTED] = X86_PG_PTE_PAT | X86_PG_NC_PWT;
+		pat_pte_index[PAT_WRITE_COMBINING] = X86_PG_PTE_PAT | X86_PG_NC_PCD;
 
 		/*
 		 * Then enable the PAT
-- 
1.8.5.4

