From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH v3 4/4] x86: use 32-bit loads for 32-bit PV guest state reload Date: Thu, 17 Mar 2016 02:04:25 -0600 Message-ID: <56EA731902000078000DD937@prv-mh.provo.novell.com> References: <56D97AC102000078000D9537@prv-mh.provo.novell.com> <56E14FF502000078000DB232@prv-mh.provo.novell.com> <56E9A0DB02000078000DD54C@prv-mh.provo.novell.com> <56EA6FDF02000078000DD8FB@prv-mh.provo.novell.com> <56EA6FDF02000078000DD8FB@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartA89F1919.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agSv0-0004UN-DJ for xen-devel@lists.xenproject.org; Thu, 17 Mar 2016 08:04:30 +0000 In-Reply-To: <56EA6FDF02000078000DD8FB@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Keir Fraser , Feng Wu List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartA89F1919.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich 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 =20 +#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 =20 /* @@ -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 =20 --=__PartA89F1919.2__= Content-Type: text/plain; name="x86-32on64-load-low.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-32on64-load-low.patch" x86: use 32-bit loads for 32-bit PV guest state reload=0A=0AThis is = slightly more efficient than loading 64-bit quantities.=0A=0ASigned-off-by:= Jan Beulich =0AReviewed-by: Andrew Cooper =0A=0A--- a/xen/include/asm-x86/asm_defns.h=0A+++ b/xen/inclu= de/asm-x86/asm_defns.h=0A@@ -313,6 +313,13 @@ static always_inline void = stac(void)=0A 987:=0A .endm=0A =0A+#define LOAD_ONE_REG(reg, compat) = \=0A+.if !(compat); \=0A+ movq UREGS_r##reg(%rsp),%r##reg; = \=0A+.else; \=0A+ movl UREGS_r##reg(%rsp),%e##reg; \=0A+.endif=0A+= =0A /*=0A * Reload registers not preserved by C code from frame.=0A = *=0A@@ -326,16 +333,14 @@ static always_inline void stac(void)=0A = movq UREGS_r10(%rsp),%r10=0A movq UREGS_r9(%rsp),%r9=0A = movq UREGS_r8(%rsp),%r8=0A-.if \ax=0A- movq UREGS_rax(%rsp),%rax= =0A .endif=0A-.elseif \ax=0A- movl UREGS_rax(%rsp),%eax=0A+.if = \ax=0A+ LOAD_ONE_REG(ax, \compat)=0A .endif=0A- movq = UREGS_rcx(%rsp),%rcx=0A- movq UREGS_rdx(%rsp),%rdx=0A- movq = UREGS_rsi(%rsp),%rsi=0A- movq UREGS_rdi(%rsp),%rdi=0A+ = LOAD_ONE_REG(cx, \compat)=0A+ LOAD_ONE_REG(dx, \compat)=0A+ = LOAD_ONE_REG(si, \compat)=0A+ LOAD_ONE_REG(di, \compat)=0A .endm=0A = =0A /*=0A@@ -372,8 +377,9 @@ static always_inline void stac(void)=0A = .subsection 0=0A #endif=0A .endif=0A-987: movq UREGS_rbp(%rsp),%rbp= =0A- movq UREGS_rbx(%rsp),%rbx=0A+987:=0A+ LOAD_ONE_REG(bp, = \compat)=0A+ LOAD_ONE_REG(bx, \compat)=0A subq $-(UREGS_err= or_code-UREGS_r15+\adj), %rsp=0A .endm=0A =0A --=__PartA89F1919.2__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__PartA89F1919.2__=--