Date: Fri, 25 Jul 2014 15:22:21 GMT From: op@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r271370 - soc2014/op/freebsd-base/sys/amd64/include Message-ID: <201407251522.s6PFML7f084689@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: op Date: Fri Jul 25 15:22:20 2014 New Revision: 271370 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271370 Log: KSP SMAP: use selfpatch for stac, clac in amd64/include/cpufunc.h Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com> git: https://github.com/opntr/opBSD/tree/op/gsoc2014/smap+kpatch Modified: soc2014/op/freebsd-base/sys/amd64/include/cpufunc.h Modified: soc2014/op/freebsd-base/sys/amd64/include/cpufunc.h ============================================================================== --- soc2014/op/freebsd-base/sys/amd64/include/cpufunc.h Fri Jul 25 15:22:10 2014 (r271369) +++ soc2014/op/freebsd-base/sys/amd64/include/cpufunc.h Fri Jul 25 15:22:20 2014 (r271370) @@ -43,6 +43,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include <machine/specialreg.h> +#include <machine/selfpatch-asmacros.h> + struct region_descriptor; #define readb(va) (*(volatile uint8_t *) (va)) @@ -594,14 +597,50 @@ clac(void) { - __asm __volatile("clac" : : : "memory"); + __asm __volatile( + "0723: " + " " KSP_INSTR_NOP3_C "; " + "0724: " + " .pushsection set_selfpatch_patch_set, \"ax\" ; " + "0725: " + " clac ; " + "0726: " + " .popsection " + " .pushsection set_selfpatch_set, \"a\" ; " + " .quad 0723b ; " + " .quad 0725b ; " + " .int 0724b-0723b ; " + " .int 0726b-0725b ; " + " .int " __XSTRING(KSP_CPUID_STDEXT) " ; " + " .int " __XSTRING(CPUID_STDEXT_SMAP) " ; " + " .quad 0 ; " + " .popsection ; " + : : : "memory"); } static __inline void stac(void) { - __asm __volatile("stac" : : : "memory"); + __asm __volatile( + "0723: " + " " KSP_INSTR_NOP3_C "; " + "0724: " + " .pushsection set_selfpatch_patch_set, \"ax\" ; " + "0725: " + " stac ; " + "0726: " + " .popsection " + " .pushsection set_selfpatch_set, \"a\" ; " + " .quad 0723b ; " + " .quad 0725b ; " + " .int 0724b-0723b ; " + " .int 0726b-0725b ; " + " .int " __XSTRING(KSP_CPUID_STDEXT) " ; " + " .int " __XSTRING(CPUID_STDEXT_SMAP) " ; " + " .quad 0 ; " + " .popsection ; " + : : : "memory"); } #ifdef _KERNEL
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407251522.s6PFML7f084689>
