From owner-svn-soc-all@FreeBSD.ORG Wed Jul 23 13:06:43 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 C582B45C for ; Wed, 23 Jul 2014 13:06:43 +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 97E2D28E2 for ; Wed, 23 Jul 2014 13:06:43 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6ND6hZg068329 for ; Wed, 23 Jul 2014 13:06:43 GMT (envelope-from op@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.8/8.14.8/Submit) id s6ND6gUJ068326 for svn-soc-all@FreeBSD.org; Wed, 23 Jul 2014 13:06:42 GMT (envelope-from op@FreeBSD.org) Date: Wed, 23 Jul 2014 13:06:42 GMT Message-Id: <201407231306.s6ND6gUJ068326@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: r271272 - soc2014/op/freebsd-base/sys/amd64/amd64 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: Wed, 23 Jul 2014 13:06:43 -0000 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 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 #include +#include #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; - } } /*