Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2014 01:49:30 GMT
From:      op@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r269504 - soc2014/op/freebsd-base/sys/i386/i386
Message-ID:  <201406130149.s5D1nUq3090219@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: op
Date: Fri Jun 13 01:49:30 2014
New Revision: 269504
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269504

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

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

Modified: soc2014/op/freebsd-base/sys/i386/i386/pmap.c
==============================================================================
--- soc2014/op/freebsd-base/sys/i386/i386/pmap.c	Fri Jun 13 01:31:46 2014	(r269503)
+++ soc2014/op/freebsd-base/sys/i386/i386/pmap.c	Fri Jun 13 01:49:30 2014	(r269504)
@@ -384,6 +384,19 @@
 
 	virtual_end = VM_MAX_KERNEL_ADDRESS;
 
+	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).
 	 */



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