From owner-svn-soc-all@FreeBSD.ORG Fri Jun 13 02:01:16 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2EE857E for ; Fri, 13 Jun 2014 02:01:16 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFBE720F4 for ; Fri, 13 Jun 2014 02:01:16 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5D21GHx038451 for ; Fri, 13 Jun 2014 02:01:16 GMT (envelope-from op@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.8/8.14.8/Submit) id s5D21GRw038350 for svn-soc-all@FreeBSD.org; Fri, 13 Jun 2014 02:01:16 GMT (envelope-from op@FreeBSD.org) Date: Fri, 13 Jun 2014 02:01:16 GMT Message-Id: <201406130201.s5D21GRw038350@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to op@FreeBSD.org using -f From: op@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269505 - soc2014/op/freebsd-base/sys/i386/i386 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jun 2014 02:01:17 -0000 Author: op Date: Fri Jun 13 02:01:15 2014 New Revision: 269505 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269505 Log: SMAP i386: enable SMAP in !BSP case in initcpu git: https://github.com/opntr/opBSD/commits/op/gsoc2014/smap Signed-off-by: Oliver Pinter Modified: soc2014/op/freebsd-base/sys/i386/i386/initcpu.c Modified: soc2014/op/freebsd-base/sys/i386/i386/initcpu.c ============================================================================== --- soc2014/op/freebsd-base/sys/i386/i386/initcpu.c Fri Jun 13 01:49:30 2014 (r269504) +++ soc2014/op/freebsd-base/sys/i386/i386/initcpu.c Fri Jun 13 02:01:15 2014 (r269505) @@ -671,6 +671,7 @@ void initializecpu(void) { + uint32_t cr4; switch (cpu) { #ifdef I486_CPU @@ -793,6 +794,17 @@ if (hw_clflush_disable == 1) cpu_feature &= ~CPUID_CLFSH; + cr4 = rcr4(); + /* + * Postpone enabling the SMAP on the boot CPU until the + * page tables are switched from the boot loader identity mapping + * to the kernel tables. The boot loader enables the U bit in + * its tables. + */ + if (!IS_BSP() && (cpu_stdext_feature & CPUID_STDEXT_SMAP)) + cr4 |= CR4_SMAP; + load_cr4(cr4); + #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) /* * OS should flush L1 cache by itself because no PC-98 supports