From patchwork Mon Aug 15 08:35:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9280431 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 28495607FD for ; Mon, 15 Aug 2016 08:38:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 190D328BAB for ; Mon, 15 Aug 2016 08:38:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DCDD28BDA; Mon, 15 Aug 2016 08:38:12 +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 137B328BAB for ; Mon, 15 Aug 2016 08:38:11 +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 1bZDNI-0003lM-Nv; Mon, 15 Aug 2016 08:36:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZDNH-0003l2-7o for xen-devel@lists.xenproject.org; Mon, 15 Aug 2016 08:35:59 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id B2/A9-19721-EEE71B75; Mon, 15 Aug 2016 08:35:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsXS6fjDS/dt3cZ wg9WfFS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyt8/6wFDxXrDjf5NjA2CPdxcjBISSQJ7Hv AGMXIycHr4CdxKmFl1hBbAkBQ4mn76+zgZSwCKhKLL0vCRJmE1CXaHu2nRUkLCJgIHHuaBKIy SygL7FtHQtIhbCAmcTf7VvAbCGggTP3rmEDsTkF7CXWtPxjAinnFRCU+LtDGCTMDFTSum4h4w RGnlkImVlIMhC2lsTDX7dYIGxtiWULXzPPAtsrLbH8HwdM+eovE7Ao8ZRYsdNpASPHKkaN4tS istQiXUNLvaSizPSMktzEzBxdQwNTvdzU4uLE9NScxKRiveT83E2MwBCtZ2Bg3MH4qN/vEKMk B5OSKK9S7sZwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8DbVAOcGi1PTUirTMHGC0wKQlOHiUR Hjfg6R5iwsSc4sz0yFSpxgVpcR5p4MkBEASGaV5cG2wCL3EKCslzMvIwMAgxFOQWpSbWYIq/4 pRnINRSZj3KMgUnsy8Erjpr4AWMwEt1pfeALK4JBEhJdXAuHr5bPO0mVdEPmpMXrRVr8ntyoW MgxllYfJV2XN/yX7hOfDnk+qRkvpz//1kfms9eyu5nS3m19EZGm4ODbzTN1/5+vHkvgM1Au6l b8vT2q0urL3Ofn71EVXjurqk2XfVJrG1N2YyP575dZ7lwTWPf8opbyi+dTNI7fETnV++cSf8z Cd8DrNVTldiKc5INNRiLipOBAC0QdvrywIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1471250155!54346184!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57062 invoked from network); 15 Aug 2016 08:35:57 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-7.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Aug 2016 08:35:57 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Mon, 15 Aug 2016 02:35:55 -0600 Message-Id: <57B19B080200007800105CF0@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Mon, 15 Aug 2016 02:35:52 -0600 From: "Jan Beulich" To: "xen-devel" References: <57B198DE0200007800105CD4@prv-mh.provo.novell.com> In-Reply-To: <57B198DE0200007800105CD4@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 4/4] x86emul: use DstEax also for XCHG 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 Just like said in commit c0bc0adf24 ("x86emul: use DstEax where possible"): While it avoids just a few instructions, we should nevertheless make use of generic code as much as possible. Here we can arrange for that by simply swapping source and destination (as they're interchangeable). Signed-off-by: Jan Beulich x86emul: use DstEax also for XCHG Just like said in commit c0bc0adf24 ("x86emul: use DstEax where possible"): While it avoids just a few instructions, we should nevertheless make use of generic code as much as possible. Here we can arrange for that by simply swapping source and destination (as they're interchangeable). Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -118,8 +118,10 @@ static uint8_t opcode_table[256] = { DstMem|SrcReg|ModRM|Mov, DstReg|SrcNone|ModRM, DstReg|SrcMem16|ModRM|Mov, DstMem|SrcNone|ModRM|Mov, /* 0x90 - 0x97 */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, /* 0x98 - 0x9F */ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps|Mov, ImplicitOps|Mov, ImplicitOps, ImplicitOps, @@ -2491,16 +2493,14 @@ x86_emulate( case 0x90: /* nop / xchg %%r8,%%rax */ if ( !(rex_prefix & 1) ) - break; /* nop */ + goto no_writeback; /* nop */ case 0x91 ... 0x97: /* xchg reg,%%rax */ - src.type = dst.type = OP_REG; - src.bytes = dst.bytes = op_bytes; - src.reg = (unsigned long *)&_regs.eax; - src.val = *src.reg; - dst.reg = decode_register( + src.type = OP_REG; + src.bytes = op_bytes; + src.reg = decode_register( (b & 7) | ((rex_prefix & 1) << 3), &_regs, 0); - dst.val = *dst.reg; + src.val = *src.reg; goto xchg; case 0x98: /* cbw/cwde/cdqe */ --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -118,8 +118,10 @@ static uint8_t opcode_table[256] = { DstMem|SrcReg|ModRM|Mov, DstReg|SrcNone|ModRM, DstReg|SrcMem16|ModRM|Mov, DstMem|SrcNone|ModRM|Mov, /* 0x90 - 0x97 */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, + DstEax|SrcImplicit, DstEax|SrcImplicit, /* 0x98 - 0x9F */ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps|Mov, ImplicitOps|Mov, ImplicitOps, ImplicitOps, @@ -2491,16 +2493,14 @@ x86_emulate( case 0x90: /* nop / xchg %%r8,%%rax */ if ( !(rex_prefix & 1) ) - break; /* nop */ + goto no_writeback; /* nop */ case 0x91 ... 0x97: /* xchg reg,%%rax */ - src.type = dst.type = OP_REG; - src.bytes = dst.bytes = op_bytes; - src.reg = (unsigned long *)&_regs.eax; - src.val = *src.reg; - dst.reg = decode_register( + src.type = OP_REG; + src.bytes = op_bytes; + src.reg = decode_register( (b & 7) | ((rex_prefix & 1) << 3), &_regs, 0); - dst.val = *dst.reg; + src.val = *src.reg; goto xchg; case 0x98: /* cbw/cwde/cdqe */