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

op at FreeBSD.org op at FreeBSD.org
Wed Jul 23 13:06:43 UTC 2014


Author: op
Date: Wed Jul 23 13:06:42 2014
New Revision: 271272
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271272

Log:
  KSP: convert xsave <-> xsaveopt hack to selfpatches
  
  Signed-off-by: Oliver Pinter <oliver.pntr at gmail.com>
  
  git: https://github.com/opntr/opBSD/tree/op/gsoc2014/kpatch

Modified:
  soc2014/op/freebsd-base/sys/amd64/amd64/cpu_switch.S
  soc2014/op/freebsd-base/sys/amd64/amd64/fpu.c

Modified: soc2014/op/freebsd-base/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- soc2014/op/freebsd-base/sys/amd64/amd64/cpu_switch.S	Wed Jul 23 13:06:31 2014	(r271271)
+++ soc2014/op/freebsd-base/sys/amd64/amd64/cpu_switch.S	Wed Jul 23 13:06:42 2014	(r271272)
@@ -35,6 +35,7 @@
 
 #include <machine/asmacros.h>
 #include <machine/specialreg.h>
+#include <machine/selfpatch-asmacros.h>
 
 #include "assym.s"
 #include "opt_sched.h"
@@ -121,10 +122,7 @@
 1:	movq	%rdx,%rcx
 	movl	xsave_mask,%eax
 	movl	xsave_mask+4,%edx
-	.globl	ctx_switch_xsave
-ctx_switch_xsave:
-	/* This is patched to xsaveopt if supported, see fpuinit_bsp1() */
-	xsave	(%r8)
+	_xsave_xsaveopt( (%r8) )
 	movq	%rcx,%rdx
 2:	smsw	%ax
 	orb	$CR0_TS,%al

Modified: soc2014/op/freebsd-base/sys/amd64/amd64/fpu.c
==============================================================================
--- soc2014/op/freebsd-base/sys/amd64/amd64/fpu.c	Wed Jul 23 13:06:31 2014	(r271271)
+++ soc2014/op/freebsd-base/sys/amd64/amd64/fpu.c	Wed Jul 23 13:06:42 2014	(r271272)
@@ -203,16 +203,6 @@
 		xsave_mask &= ~XFEATURE_AVX512;
 	if ((xsave_mask & XFEATURE_MPX) != XFEATURE_MPX)
 		xsave_mask &= ~XFEATURE_MPX;
-
-	cpuid_count(0xd, 0x1, cp);
-	if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0) {
-		/*
-		 * Patch the XSAVE instruction in the cpu_switch code
-		 * to XSAVEOPT.  We assume that XSAVE encoding used
-		 * REX byte, and set the bit 4 of the r/m byte.
-		 */
-		ctx_switch_xsave[3] |= 0x10;
-	}
 }
 
 /*


More information about the svn-soc-all mailing list