From patchwork Fri Mar 4 11:29:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8503091 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BFDBC0553 for ; Fri, 4 Mar 2016 11:31:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4C03201BC for ; Fri, 4 Mar 2016 11:31:43 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id C181B201B9 for ; Fri, 4 Mar 2016 11:31:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abnv4-00032Q-72; Fri, 04 Mar 2016 11:29:18 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abnv2-00031s-Hq for xen-devel@lists.xenproject.org; Fri, 04 Mar 2016 11:29:16 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 45/26-03109-78179D65; Fri, 04 Mar 2016 11:29:11 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1457090948!17267834!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.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 61437 invoked from network); 4 Mar 2016 11:29:10 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-4.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Mar 2016 11:29:10 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 04 Mar 2016 04:29:08 -0700 Message-Id: <56D97F9602000078000D9584@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Fri, 04 Mar 2016 04:29:10 -0700 From: "Jan Beulich" To: "xen-devel" References: <56D97AC102000078000D9537@prv-mh.provo.novell.com> In-Reply-To: <56D97AC102000078000D9537@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper , Keir Fraser Subject: [Xen-devel] [PATCH 4/4] x86: use 32-bit loads for 32-bit PV guest state reload 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich x86: use 32-bit loads for 32-bit PV guest state reload This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -313,6 +313,13 @@ static always_inline void stac(void) 987: .endm +#define LOAD_ONE_REG(reg, compat) \ +.if !(compat); \ + movq UREGS_r##reg(%rsp),%r##reg; \ +.else; \ + movl UREGS_r##reg(%rsp),%e##reg; \ +.endif + /* * Reload registers not preserved by C code from frame. * @@ -326,16 +333,14 @@ static always_inline void stac(void) movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 -.if \ax - movq UREGS_rax(%rsp),%rax .endif -.elseif \ax - movl UREGS_rax(%rsp),%eax +.if \ax + LOAD_ONE_REG(ax, \compat) .endif - movq UREGS_rcx(%rsp),%rcx - movq UREGS_rdx(%rsp),%rdx - movq UREGS_rsi(%rsp),%rsi - movq UREGS_rdi(%rsp),%rdi + LOAD_ONE_REG(cx, \compat) + LOAD_ONE_REG(dx, \compat) + LOAD_ONE_REG(si, \compat) + LOAD_ONE_REG(di, \compat) .endm /* @@ -372,8 +377,9 @@ static always_inline void stac(void) .subsection 0 #endif .endif -987: movq UREGS_rbp(%rsp),%rbp - movq UREGS_rbx(%rsp),%rbx +987: + LOAD_ONE_REG(bp, \compat) + LOAD_ONE_REG(bx, \compat) subq $-(UREGS_error_code-UREGS_r15+\adj), %rsp .endm Reviewed-by: Andrew Cooper --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -313,6 +313,13 @@ static always_inline void stac(void) 987: .endm +#define LOAD_ONE_REG(reg, compat) \ +.if !(compat); \ + movq UREGS_r##reg(%rsp),%r##reg; \ +.else; \ + movl UREGS_r##reg(%rsp),%e##reg; \ +.endif + /* * Reload registers not preserved by C code from frame. * @@ -326,16 +333,14 @@ static always_inline void stac(void) movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 -.if \ax - movq UREGS_rax(%rsp),%rax .endif -.elseif \ax - movl UREGS_rax(%rsp),%eax +.if \ax + LOAD_ONE_REG(ax, \compat) .endif - movq UREGS_rcx(%rsp),%rcx - movq UREGS_rdx(%rsp),%rdx - movq UREGS_rsi(%rsp),%rsi - movq UREGS_rdi(%rsp),%rdi + LOAD_ONE_REG(cx, \compat) + LOAD_ONE_REG(dx, \compat) + LOAD_ONE_REG(si, \compat) + LOAD_ONE_REG(di, \compat) .endm /* @@ -372,8 +377,9 @@ static always_inline void stac(void) .subsection 0 #endif .endif -987: movq UREGS_rbp(%rsp),%rbp - movq UREGS_rbx(%rsp),%rbx +987: + LOAD_ONE_REG(bp, \compat) + LOAD_ONE_REG(bx, \compat) subq $-(UREGS_error_code-UREGS_r15+\adj), %rsp .endm