All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: hpa@zytor.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 07/11] x86-64: Simplify constraints for fxsave/fxtstor
Date: Sat, 28 Aug 2010 12:04:34 -0400	[thread overview]
Message-ID: <1283011478-27237-8-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1283011478-27237-1-git-send-email-brgerst@gmail.com>

Use the "R" constraint (legacy register) instead of listing all the
possible registers.  Clean up the comments as well.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/include/asm/i387.h |   44 ++++++++++++++++--------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 8b40a83..768fcb2 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -81,6 +81,7 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
 {
 	int err;
 
+	/* See comment in fxsave() below. */
 	asm volatile("1:  rex64/fxrstor (%[fx])\n\t"
 		     "2:\n"
 		     ".section .fixup,\"ax\"\n"
@@ -89,11 +90,7 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
 		     ".previous\n"
 		     _ASM_EXTABLE(1b, 3b)
 		     : [err] "=r" (err)
-#if 0 /* See comment in fxsave() below. */
-		     : [fx] "r" (fx), "m" (*fx), "0" (0));
-#else
-		     : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
-#endif
+		     : [fx] "R" (fx), "m" (*fx), "0" (0));
 	return err;
 }
 
@@ -140,6 +137,7 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
 	if (unlikely(err))
 		return -EFAULT;
 
+	/* See comment in fxsave() below. */
 	asm volatile("1:  rex64/fxsave (%[fx])\n\t"
 		     "2:\n"
 		     ".section .fixup,\"ax\"\n"
@@ -148,11 +146,7 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
 		     ".previous\n"
 		     _ASM_EXTABLE(1b, 3b)
 		     : [err] "=r" (err), "=m" (*fx)
-#if 0 /* See comment in fxsave() below. */
-		     : [fx] "r" (fx), "0" (0));
-#else
-		     : [fx] "cdaSDb" (fx), "0" (0));
-#endif
+		     : [fx] "R" (fx), "0" (0));
 	if (unlikely(err) &&
 	    __clear_user(fx, sizeof(struct i387_fxsave_struct)))
 		err = -EFAULT;
@@ -165,26 +159,22 @@ static inline void fpu_fxsave(struct fpu *fpu)
 	/* Using "rex64; fxsave %0" is broken because, if the memory operand
 	   uses any extended registers for addressing, a second REX prefix
 	   will be generated (to the assembler, rex64 followed by semicolon
-	   is a separate instruction), and hence the 64-bitness is lost. */
-#if 0
-	/* Using "fxsaveq %0" would be the ideal choice, but is only supported
-	   starting with gas 2.16. */
-	__asm__ __volatile__("fxsaveq %0"
-			     : "=m" (fpu->state->fxsave));
-#elif 0
-	/* Using, as a workaround, the properly prefixed form below isn't
+	   is a separate instruction), and hence the 64-bitness is lost.
+	   Using "fxsaveq %0" would be the ideal choice, but is only supported
+	   starting with gas 2.16.
+	asm volatile("fxsaveq %0"
+		     : "=m" (fpu->state->fxsave));
+	   Using, as a workaround, the properly prefixed form below isn't
 	   accepted by any binutils version so far released, complaining that
 	   the same type of prefix is used twice if an extended register is
-	   needed for addressing (fix submitted to mainline 2005-11-21). */
-	__asm__ __volatile__("rex64/fxsave %0"
-			     : "=m" (fpu->state->fxsave));
-#else
-	/* This, however, we can work around by forcing the compiler to select
+	   needed for addressing (fix submitted to mainline 2005-11-21).
+	asm volatile("rex64/fxsave %0"
+		     : "=m" (fpu->state->fxsave));
+	   This, however, we can work around by forcing the compiler to select
 	   an addressing mode that doesn't require extended registers. */
-	__asm__ __volatile__("rex64/fxsave (%1)"
-			     : "=m" (fpu->state->fxsave)
-			     : "cdaSDb" (&fpu->state->fxsave));
-#endif
+	asm volatile("rex64/fxsave (%[fx])"
+		     : "=m" (fpu->state->fxsave)
+		     : [fx] "R" (&fpu->state->fxsave));
 }
 
 static inline void fpu_save_init(struct fpu *fpu)
-- 
1.7.2.2


  parent reply	other threads:[~2010-08-28 16:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-28 16:04 x86: FPU cleanups Brian Gerst
2010-08-28 16:04 ` [PATCH 01/11] x86: Use correct type for %cr4 Brian Gerst
2010-08-29 18:24   ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 02/11] x86: Merge fpu_init() Brian Gerst
2010-08-29 18:29   ` Pekka Enberg
2010-08-30  0:44     ` Brian Gerst
2010-08-28 16:04 ` [PATCH 03/11] x86: Merge tolerant_fwait() Brian Gerst
2010-08-29 18:32   ` Pekka Enberg
2010-08-30  0:35     ` Brian Gerst
2010-08-30  5:47       ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 04/11] x86: Merge __save_init_fpu() Brian Gerst
2010-08-29 18:33   ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 05/11] x86-64: Disable preemption when using TS_USEDFPU Brian Gerst
2010-08-29 18:38   ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 06/11] x86-64: Fix %cs value in convert_from_fxsr() Brian Gerst
2010-08-29 18:41   ` Pekka Enberg
2010-08-30  0:25     ` Brian Gerst
2010-08-30  6:44       ` Pekka Enberg
2010-08-30 11:38         ` Brian Gerst
2010-08-28 16:04 ` Brian Gerst [this message]
2010-08-29 18:45   ` [PATCH 07/11] x86-64: Simplify constraints for fxsave/fxtstor Pekka Enberg
2010-08-29 23:44     ` Brian Gerst
2010-08-30  5:56       ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 08/11] x86-32: Remove math_emulate stub Brian Gerst
2010-08-29 18:47   ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 09/11] x86: Merge fpu_save_init() Brian Gerst
2010-08-29 18:54   ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 10/11] x86: Remove unnecessary ifdefs from i387 code Brian Gerst
2010-08-29 19:00   ` Pekka Enberg
2010-08-29 23:38     ` Brian Gerst
2010-08-30  5:44       ` Pekka Enberg
2010-08-30 11:21         ` Brian Gerst
2010-08-30 11:25           ` Pekka Enberg
2010-08-28 16:04 ` [PATCH 11/11] x86: Remove PSHUFB_XMM5_* macros Brian Gerst
2010-08-29 19:02   ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283011478-27237-8-git-send-email-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.