From patchwork Tue Aug 16 09:32: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: 9283033 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 82F0F60574 for ; Tue, 16 Aug 2016 09:35:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F7AD284F9 for ; Tue, 16 Aug 2016 09:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EF902859C; Tue, 16 Aug 2016 09:35:11 +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 D06CF284F9 for ; Tue, 16 Aug 2016 09:35:10 +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 1bZak0-0005ds-2p; Tue, 16 Aug 2016 09:33:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZajz-0005dm-D4 for xen-devel@lists.xenproject.org; Tue, 16 Aug 2016 09:32:59 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id CD/6E-28813-ACDD2B75; Tue, 16 Aug 2016 09:32:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsXS6fjDS/fk3U3 hBnOaNCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozl3Z1MBf80Km79WMPSwHhYqouRk0NIIE9i 8f1HrCA2r4CdxNrePWwgtoSAocTT99fBbBYBVYmWVdvAbDYBdYm2Z9uB6jk4RAQMJM4dTQIxm QX0JbatYwGpEBawl2i89pANYrqdxPaLV8HinEDx5U9nMoOU8woISvzdIQwSZgYqeX3uNuMERp 5ZCJlZSDIQtpbEw1+3WCBsbYllC18zzwLbKy2x/B8HRNhR4tnjZ6yoSkBsH4n5LXdYFzByrGJ UL04tKkst0rXUSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDNR6BgbGHYyvfzod YpTkYFIS5Z05cWO4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQne6DubwoUEi1LTUyvSMnOAMQOTl uDgURLhdQZJ8xYXJOYWZ6ZDpE4xKkqJ8+aBJARAEhmleXBtsDi9xCgrJczLyMDAIMRTkFqUm1 mCKv+KUZyDUUmYtwtkCk9mXgnc9FdAi5mAFutLbwBZXJKIkJJqYPT2+j7ly6oFSTJ7Upt+LVq pGqrMaOInxGrvy6bnGMLWeu3n4eh3DI7K2jv/F29csfvAfLllzrb/7NUZTrtzCc4//yZ5m+Ol T+qV+g6hex9evDc5q+P+2l9F+rMk9N/J5q3I+7D83UXuzKh3jIqHtCUCLB9MzFLQ2bxF+i/DL UM777IT8yWdryuxFGckGmoxFxUnAgDrGKmmzgIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1471339975!48250699!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 11256 invoked from network); 16 Aug 2016 09:32:57 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-7.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Aug 2016 09:32:57 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 16 Aug 2016 03:32:54 -0600 Message-Id: <57B2F9E402000078001063FD@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Tue, 16 Aug 2016 03:32:52 -0600 From: "Jan Beulich" To: "xen-devel" References: <57B2F93802000078001063E6@prv-mh.provo.novell.com> In-Reply-To: <57B2F93802000078001063E6@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 1/3] x86emul: use DstEax also for {, I}{MUL, DIV} 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. Signed-off-by: Jan Beulich x86emul: use DstEax also for {,I}{MUL,DIV} 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. Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1738,7 +1738,7 @@ x86_emulate( case 5: /* imul */ case 6: /* div */ case 7: /* idiv */ - d = (d & (ByteOp | ModRM)) | DstImplicit | SrcMem; + d = (d & (ByteOp | ModRM)) | DstEax | SrcMem; break; } break; @@ -3554,11 +3554,8 @@ x86_emulate( emulate_1op("neg", dst, _regs.eflags); break; case 4: /* mul */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - dst.val = *dst.reg; _regs.eflags &= ~(EFLG_OF|EFLG_CF); - switch ( dst.bytes = src.bytes ) + switch ( dst.bytes ) { case 1: dst.val = (uint8_t)dst.val; @@ -3594,10 +3591,6 @@ x86_emulate( } break; case 5: /* imul */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - dst.val = *dst.reg; - dst.bytes = src.bytes; imul: _regs.eflags &= ~(EFLG_OF|EFLG_CF); switch ( dst.bytes ) @@ -3639,9 +3632,7 @@ x86_emulate( } break; case 6: /* div */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - switch ( dst.bytes = src.bytes ) + switch ( src.bytes ) { case 1: u[0] = (uint16_t)_regs.eax; @@ -3686,9 +3677,7 @@ x86_emulate( } break; case 7: /* idiv */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - switch ( dst.bytes = src.bytes ) + switch ( src.bytes ) { case 1: u[0] = (int16_t)_regs.eax; --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1738,7 +1738,7 @@ x86_emulate( case 5: /* imul */ case 6: /* div */ case 7: /* idiv */ - d = (d & (ByteOp | ModRM)) | DstImplicit | SrcMem; + d = (d & (ByteOp | ModRM)) | DstEax | SrcMem; break; } break; @@ -3554,11 +3554,8 @@ x86_emulate( emulate_1op("neg", dst, _regs.eflags); break; case 4: /* mul */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - dst.val = *dst.reg; _regs.eflags &= ~(EFLG_OF|EFLG_CF); - switch ( dst.bytes = src.bytes ) + switch ( dst.bytes ) { case 1: dst.val = (uint8_t)dst.val; @@ -3594,10 +3591,6 @@ x86_emulate( } break; case 5: /* imul */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - dst.val = *dst.reg; - dst.bytes = src.bytes; imul: _regs.eflags &= ~(EFLG_OF|EFLG_CF); switch ( dst.bytes ) @@ -3639,9 +3632,7 @@ x86_emulate( } break; case 6: /* div */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - switch ( dst.bytes = src.bytes ) + switch ( src.bytes ) { case 1: u[0] = (uint16_t)_regs.eax; @@ -3686,9 +3677,7 @@ x86_emulate( } break; case 7: /* idiv */ - dst.type = OP_REG; - dst.reg = (unsigned long *)&_regs.eax; - switch ( dst.bytes = src.bytes ) + switch ( src.bytes ) { case 1: u[0] = (int16_t)_regs.eax;