From patchwork Thu Dec 8 11:38:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9466189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F32BF60231 for ; Thu, 8 Dec 2016 11:40:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC58528448 for ; Thu, 8 Dec 2016 11:40:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E121C284F6; Thu, 8 Dec 2016 11:40:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B70452846E for ; Thu, 8 Dec 2016 11:40:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEx2J-00028h-TK; Thu, 08 Dec 2016 11:38:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEx2I-00028N-Pj for xen-devel@lists.xenproject.org; Thu, 08 Dec 2016 11:38:50 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id F3/53-20885-A4649485; Thu, 08 Dec 2016 11:38:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsXS6fjDS9fTzTP CYEafpMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmnFo1W+2glVKFc8b3jE3MP4V7mLk5BASyJN4 dqePHcTmFbCT+PpsIRuILSFgKPH0/XUgm4ODRUBVYtauZJAwm4C6RNuz7awgYREBA4lzR5NAT GYBfYlt61hAKoQFPCXarl5gghhuJ7HsxTawOKeAvcT+Dw/BBvIKCEr83QG2nxmo5MrMXYwTGH lmIWRmIclA2FoSD3/dYoGwtSWWLXzNPAtsr7TE8n8cMOXLd39kRlUCYntK9O98zrqAkWMVo3p xalFZapGupV5SUWZ6RkluYmaOrqGBsV5uanFxYnpqTmJSsV5yfu4mRmCY1jMwMO5gfP3T6RCj JAeTkijvrgnuEUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkePtcPCOEBItS01Mr0jJzgBEDk5bg4 FES4VUFSfMWFyTmFmemQ6ROMSpKifM2uwIlBEASGaV5cG2wKL3EKCslzMvIwMAgxFOQWpSbWY Iq/4pRnINRSZh3Cch4nsy8Erjpr4AWMwEtnnfDHWRxSSJCSqqBcdUEPpvNeersez9MPmC+q3H b1H0dR+fLcuiLe8n7zM2T2er0tqMmYX15pefJ9QlLZAS4Nq3wvzhTVPdCpb2Idafel481jVuE TIwze2qyPjfnnd+YHrp6gYBdnTvXjE8C1cfEGHtW/13fmR9/sHrx6gsvZ2bP+hFhzZZ4LiTsN 3tOJKvLihvBSizFGYmGWsxFxYkAEAOQYc0CAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1481197127!74430020!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60885 invoked from network); 8 Dec 2016 11:38:49 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-10.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Dec 2016 11:38:49 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 08 Dec 2016 04:38:46 -0700 Message-Id: <584954570200007800126ABB@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Thu, 08 Dec 2016 04:38:47 -0700 From: "Jan Beulich" To: "xen-devel" References: <584951630200007800126A86@prv-mh.provo.novell.com> In-Reply-To: <584951630200007800126A86@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH v2 6/6] x86emul: simplify FPU handling asm() constraints X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The memory clobber is rather harsh here. However, fic.exn_raised may be modified as a side effect, so we need to let the compiler know that all of "fic" may be changed (preventing it from moving around accesses to the exn_raised field). Signed-off-by: Jan Beulich x86emul: simplify FPU handling asm() constraints The memory clobber is rather harsh here. However, fic.exn_raised may be modified as a side effect, so we need to let the compiler know that all of "fic" may be changed (preventing it from moving around accesses to the exn_raised field). Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -759,7 +759,7 @@ do { }) struct fpu_insn_ctxt { - uint8_t insn_bytes; + uint8_t insn_bytes; /* Must be first! */ int8_t exn_raised; }; @@ -853,23 +853,21 @@ do { "movb $2f-1f,%0 \n" \ "1: " _op " \n" \ "2: \n" \ - : "=m" (fic.insn_bytes) : : "memory" ) + : "+m" (fic) ) #define emulate_fpu_insn_memdst(_op, _arg) \ asm volatile ( \ "movb $2f-1f,%0 \n" \ "1: " _op " %1 \n" \ "2: \n" \ - : "=m" (fic.insn_bytes), "=m" (_arg) \ - : : "memory" ) + : "+m" (fic), "=m" (_arg) ) #define emulate_fpu_insn_memsrc(_op, _arg) \ asm volatile ( \ "movb $2f-1f,%0 \n" \ "1: " _op " %1 \n" \ "2: \n" \ - : "=m" (fic.insn_bytes) \ - : "m" (_arg) : "memory" ) + : "+m" (fic) : "m" (_arg) ) #define emulate_fpu_insn_stub(_bytes...) \ do { \ --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -759,7 +759,7 @@ do { }) struct fpu_insn_ctxt { - uint8_t insn_bytes; + uint8_t insn_bytes; /* Must be first! */ int8_t exn_raised; }; @@ -853,23 +853,21 @@ do { "movb $2f-1f,%0 \n" \ "1: " _op " \n" \ "2: \n" \ - : "=m" (fic.insn_bytes) : : "memory" ) + : "+m" (fic) ) #define emulate_fpu_insn_memdst(_op, _arg) \ asm volatile ( \ "movb $2f-1f,%0 \n" \ "1: " _op " %1 \n" \ "2: \n" \ - : "=m" (fic.insn_bytes), "=m" (_arg) \ - : : "memory" ) + : "+m" (fic), "=m" (_arg) ) #define emulate_fpu_insn_memsrc(_op, _arg) \ asm volatile ( \ "movb $2f-1f,%0 \n" \ "1: " _op " %1 \n" \ "2: \n" \ - : "=m" (fic.insn_bytes) \ - : "m" (_arg) : "memory" ) + : "+m" (fic) : "m" (_arg) ) #define emulate_fpu_insn_stub(_bytes...) \ do { \