socsvn commit: r269002 - soc2014/op/freebsd-base/sys/amd64/amd64

op at FreeBSD.org op at FreeBSD.org
Tue Jun 3 09:41:38 UTC 2014


Author: op
Date: Tue Jun  3 09:41:37 2014
New Revision: 269002
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269002

Log:
  SMAP AMD64: enable SMAP at boot time
  
  git: https://github.com/opntr/opBSD/commits/op/gsoc2014/smap
  
  Signed-off-by: Oliver Pinter <oliver.pntr at gmail.com>
  
  

Modified:
  soc2014/op/freebsd-base/sys/amd64/amd64/pmap.c

Modified: soc2014/op/freebsd-base/sys/amd64/amd64/pmap.c
==============================================================================
--- soc2014/op/freebsd-base/sys/amd64/amd64/pmap.c	Tue Jun  3 09:41:05 2014	(r269001)
+++ soc2014/op/freebsd-base/sys/amd64/amd64/pmap.c	Tue Jun  3 09:41:37 2014	(r269002)
@@ -830,6 +830,16 @@
 	load_cr3(KPML4phys);
 	if (cpu_stdext_feature & CPUID_STDEXT_SMEP)
 		load_cr4(rcr4() | CR4_SMEP);
+	/*
+	 * XXXOP - handle properly the situation, when the kernel
+	 * compiled with SMAP, but the CPU does not support it
+	 */
+	if (cpu_stdext_feature & CPUID_STDEXT_SMAP) {
+		printf("Intel SMAP: enable\n");
+		load_cr4(rcr4() | CR4_SMAP);
+	} else {
+		panic("Intel SMAP: not supported...");
+	}
 
 	/*
 	 * Initialize the kernel pmap (which is statically allocated).


More information about the svn-soc-all mailing list