linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/9] x86: Use FIX_EFLAGS define in X86_64
@ 2008-02-08 20:09 Harvey Harrison
  2008-02-08 22:08 ` Chuck Ebbert
  0 siblings, 1 reply; 2+ messages in thread
From: Harvey Harrison @ 2008-02-08 20:09 UTC (permalink / raw)
  To: Ingo Molnar, Roland McGrath; +Cc: H. Peter Anvin, Thomas Gleixner, LKML

X86_64 differs by one bit from X86_32 in that it does not include
X86_EFLAGS_RF.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 arch/x86/kernel/signal_32.c |   17 ++++++++++++-----
 arch/x86/kernel/signal_64.c |   15 ++++++++++++++-
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 70d0cc8..e93b219 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -30,6 +30,18 @@
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
+#ifdef CONFIG_X86_32
+#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_RF | X86_EFLAGS_OF | \
+			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
+			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
+			 X86_EFLAGS_CF)
+#else
+#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
+			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
+			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
+			 X86_EFLAGS_CF)
+#endif
+
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
@@ -122,11 +134,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
 	  err |= __get_user(tmp, &sc->seg);				\
 	  loadsegment(seg,tmp); }
 
-#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_RF |		 \
-			 X86_EFLAGS_OF | X86_EFLAGS_DF |		 \
-			 X86_EFLAGS_TF | X86_EFLAGS_SF | X86_EFLAGS_ZF | \
-			 X86_EFLAGS_AF | X86_EFLAGS_PF | X86_EFLAGS_CF)
-
 	GET_SEG(gs);
 	COPY_SEG(fs);
 	COPY_SEG(es);
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index a1e56dc..dced99a 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -19,6 +19,7 @@
 #include <linux/stddef.h>
 #include <linux/personality.h>
 #include <linux/compiler.h>
+#include <asm/processor.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 #include <asm/i387.h>
@@ -30,6 +31,18 @@
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
+#ifdef CONFIG_X86_32
+#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_RF | X86_EFLAGS_OF | \
+			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
+			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
+			 X86_EFLAGS_CF)
+#else
+#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
+			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
+			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
+			 X86_EFLAGS_CF)
+#endif
+
 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
                sigset_t *set, struct pt_regs * regs); 
 int ia32_setup_frame(int sig, struct k_sigaction *ka,
@@ -87,7 +100,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
 	{
 		unsigned int tmpflags;
 		err |= __get_user(tmpflags, &sc->flags);
-		regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
+		regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
 		regs->orig_ax = -1;		/* disable syscall checks */
 	}
 
-- 
1.5.4.1219.g65b9



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5/9] x86: Use FIX_EFLAGS define in X86_64
  2008-02-08 20:09 [PATCH 5/9] x86: Use FIX_EFLAGS define in X86_64 Harvey Harrison
@ 2008-02-08 22:08 ` Chuck Ebbert
  0 siblings, 0 replies; 2+ messages in thread
From: Chuck Ebbert @ 2008-02-08 22:08 UTC (permalink / raw)
  To: Harvey Harrison
  Cc: Ingo Molnar, Roland McGrath, H. Peter Anvin, Thomas Gleixner, LKML

On 02/08/2008 03:09 PM, Harvey Harrison wrote:
> +#ifdef CONFIG_X86_32
> +#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_RF | X86_EFLAGS_OF | \
> +			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
> +			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
> +			 X86_EFLAGS_CF)
> +#else
> +#define	FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
> +			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
> +			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
> +			 X86_EFLAGS_CF)
> +#endif

A comment about some of these would be nice... like what this bitmask is for...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-08 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 20:09 [PATCH 5/9] x86: Use FIX_EFLAGS define in X86_64 Harvey Harrison
2008-02-08 22:08 ` Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).