From patchwork Tue Dec 6 14:14:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9462671 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 3667460231 for ; Tue, 6 Dec 2016 14:16:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 269CB283FC for ; Tue, 6 Dec 2016 14:16:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B6D0283FF; Tue, 6 Dec 2016 14:16:17 +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 8AC75283FC for ; Tue, 6 Dec 2016 14:16:16 +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 1cEGVf-0001uZ-3E; Tue, 06 Dec 2016 14:14:19 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEGVe-0001u7-4j for xen-devel@lists.xenproject.org; Tue, 06 Dec 2016 14:14:18 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id B8/A5-21400-9B7C6485; Tue, 06 Dec 2016 14:14:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsXS6fjDS3fHcbc Ig0mbNS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ow9m+4zF6xSqpj8bRJzA+Nf4S5GTg4hgTyJ Lw/PM3YxcnDwCthJ3J3PBxKWEDCUePr+OhuIzSKgKjGtbRo7iM0moC7R9mw7K0i5iICBxLmjS SAms4C+xLZ1LCAVwgKuEseftjCBhIWABna+1wYJcwrYS/zqmcgCsUdQ4u8OsPXMQBVd954wTW DkmYWQmYUkA2FrSTz8dYsFwtaWWLbwNfMssLXSEsv/ccCUL9/9kRlVCYjtKdG/8znrAkaOVYz qxalFZalFukZ6SUWZ6RkluYmZObqGBqZ6uanFxYnpqTmJScV6yfm5mxiBQcoABDsYv/9xOsQo ycGkJMqrYukWIcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCN+UYUE6wKDU9tSItMwcYLzBpCQ4eJ RHelKNAad7igsTc4sx0iNQpRkUpcd5IkD4BkERGaR5cGyxGLzHKSgnzMgIdIsRTkFqUm1mCKv +KUZyDUUmYtwFkCk9mXgnc9FdAi5mAFp847gyyuCQRISXVwMips366WthMzf65u/u/XGrbaCj B/ePjv4v3ivpDefpbLh9/uS2E8UDa9fmPHuu1f8y/+HlP+p97DKreny2S8hTZpk+KFDp73SBe 2Wm9RZr9utwpfmtyfJdNvBcwTTOlTO7f/H3dD32yO0+FOmv+zb0SILRsl37i6jNHpHInnOp9K 72O4fCK5itKLMUZiYZazEXFiQAnj2PDzAIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1481033648!58460027!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 52327 invoked from network); 6 Dec 2016 14:14:10 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 6 Dec 2016 14:14:10 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 06 Dec 2016 07:14:14 -0700 Message-Id: <5846D5C30200007800125C9C@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Tue, 06 Dec 2016 07:14:11 -0700 From: "Jan Beulich" To: "xen-devel" References: <5846D3810200007800125BF8@prv-mh.provo.novell.com> In-Reply-To: <5846D3810200007800125BF8@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 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 @@ -784,7 +784,7 @@ do { }) struct fpu_insn_ctxt { - uint8_t insn_bytes; + uint8_t insn_bytes; /* Must be first! */ int8_t exn_raised; }; @@ -878,23 +878,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 @@ -784,7 +784,7 @@ do { }) struct fpu_insn_ctxt { - uint8_t insn_bytes; + uint8_t insn_bytes; /* Must be first! */ int8_t exn_raised; }; @@ -878,23 +878,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 { \