public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
@ 2008-07-14 21:14 Hiroshi Shimamoto
  2008-07-14 22:05 ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Hiroshi Shimamoto @ 2008-07-14 21:14 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
ia32_restore_sigcontext().

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/ia32/ia32_signal.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index cb3856a..7cf50cb 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -36,6 +36,17 @@
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
+#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)
+
+#ifdef CONFIG_X86_32
+# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
+#else
+# define FIX_EFLAGS	__FIX_EFLAGS
+#endif
+
 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
@@ -248,7 +259,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
 	regs->ss |= 3;
 
 	err |= __get_user(tmpflags, &sc->flags);
-	regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
+	regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
 	/* disable syscall checks */
 	regs->orig_ax = -1;
 
-- 
1.5.4.1



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

* Re: [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 21:14 [PATCH] x86_64: ia32_signal.c: use macro instead of immediate Hiroshi Shimamoto
@ 2008-07-14 22:05 ` H. Peter Anvin
  2008-07-14 22:19   ` Hiroshi Shimamoto
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2008-07-14 22:05 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
> ia32_restore_sigcontext().
> 
> +
> +#ifdef CONFIG_X86_32
> +# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
> +#else
> +# define FIX_EFLAGS	__FIX_EFLAGS
> +#endif
> +

Where did this come from?  First of all, this is in a 64-bit-only file, 
so CONFIG_X86_32 will never be set; second of all, it seems a bit fishy 
that these should be different.

	-hpa

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

* Re: [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 22:05 ` H. Peter Anvin
@ 2008-07-14 22:19   ` Hiroshi Shimamoto
  2008-07-14 22:23     ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Hiroshi Shimamoto @ 2008-07-14 22:19 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

H. Peter Anvin wrote:
> Hiroshi Shimamoto wrote:
>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>
>> Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
>> ia32_restore_sigcontext().
>>
>> +
>> +#ifdef CONFIG_X86_32
>> +# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
>> +#else
>> +# define FIX_EFLAGS	__FIX_EFLAGS
>> +#endif
>> +
> 
> Where did this come from?  First of all, this is in a 64-bit-only file, 
> so CONFIG_X86_32 will never be set; second of all, it seems a bit fishy 
> that these should be different.

It came from arch/x86/kernel/signal_64.c. (And signal_32.c has the same one.)
And yes, CONFIG_X86_32 is not set, I compiled and compare the results,
the macro was replaced by 0x40dd5, no RF.
I guess, someone made it same on signal_32.c and signal_64.c.

Thanks,
Hiroshi Shimamoto

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

* Re: [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 22:19   ` Hiroshi Shimamoto
@ 2008-07-14 22:23     ` H. Peter Anvin
  2008-07-14 22:26       ` Hiroshi Shimamoto
  2008-07-14 22:34       ` Hiroshi Shimamoto
  0 siblings, 2 replies; 7+ messages in thread
From: H. Peter Anvin @ 2008-07-14 22:23 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

Hiroshi Shimamoto wrote:
> H. Peter Anvin wrote:
>> Hiroshi Shimamoto wrote:
>>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>
>>> Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
>>> ia32_restore_sigcontext().
>>>
>>> +
>>> +#ifdef CONFIG_X86_32
>>> +# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
>>> +#else
>>> +# define FIX_EFLAGS	__FIX_EFLAGS
>>> +#endif
>>> +
>> Where did this come from?  First of all, this is in a 64-bit-only file, 
>> so CONFIG_X86_32 will never be set; second of all, it seems a bit fishy 
>> that these should be different.
> 
> It came from arch/x86/kernel/signal_64.c. (And signal_32.c has the same one.)
> And yes, CONFIG_X86_32 is not set, I compiled and compare the results,
> the macro was replaced by 0x40dd5, no RF.
> I guess, someone made it same on signal_32.c and signal_64.c.
> 

Yes, it's working toward unification (and ia32signal.c is obviously also 
a candidate for unification.)  However, please make that a separate patch.

	-hpa

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

* Re: [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 22:23     ` H. Peter Anvin
@ 2008-07-14 22:26       ` Hiroshi Shimamoto
  2008-07-14 22:34       ` Hiroshi Shimamoto
  1 sibling, 0 replies; 7+ messages in thread
From: Hiroshi Shimamoto @ 2008-07-14 22:26 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

H. Peter Anvin wrote:
> Hiroshi Shimamoto wrote:
>> H. Peter Anvin wrote:
>>> Hiroshi Shimamoto wrote:
>>>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>>
>>>> Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
>>>> ia32_restore_sigcontext().
>>>>
>>>> +
>>>> +#ifdef CONFIG_X86_32
>>>> +# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
>>>> +#else
>>>> +# define FIX_EFLAGS	__FIX_EFLAGS
>>>> +#endif
>>>> +
>>> Where did this come from?  First of all, this is in a 64-bit-only file, 
>>> so CONFIG_X86_32 will never be set; second of all, it seems a bit fishy 
>>> that these should be different.
>> It came from arch/x86/kernel/signal_64.c. (And signal_32.c has the same one.)
>> And yes, CONFIG_X86_32 is not set, I compiled and compare the results,
>> the macro was replaced by 0x40dd5, no RF.
>> I guess, someone made it same on signal_32.c and signal_64.c.
>>
> 
> Yes, it's working toward unification (and ia32signal.c is obviously also 
> a candidate for unification.)  However, please make that a separate patch.

OK. Will do.

Thanks,
Hiroshi Shimamoto


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

* [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 22:23     ` H. Peter Anvin
  2008-07-14 22:26       ` Hiroshi Shimamoto
@ 2008-07-14 22:34       ` Hiroshi Shimamoto
  2008-07-18 11:53         ` Ingo Molnar
  1 sibling, 1 reply; 7+ messages in thread
From: Hiroshi Shimamoto @ 2008-07-14 22:34 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
ia32_restore_sigcontext().

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/ia32/ia32_signal.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index cb3856a..dc9b9b9 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -36,6 +36,11 @@
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
+#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)
+
 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
@@ -248,7 +253,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
 	regs->ss |= 3;
 
 	err |= __get_user(tmpflags, &sc->flags);
-	regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
+	regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
 	/* disable syscall checks */
 	regs->orig_ax = -1;
 
-- 
1.5.4.1


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

* Re: [PATCH] x86_64: ia32_signal.c: use macro instead of immediate
  2008-07-14 22:34       ` Hiroshi Shimamoto
@ 2008-07-18 11:53         ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2008-07-18 11:53 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: H. Peter Anvin, Thomas Gleixner, linux-kernel


* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> Make and use macro FIX_EFLAGS, instead of immediate value 0x40DD5 in
> ia32_restore_sigcontext().

applied to tip/x86/cleanups - thanks!

	Ingo

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

end of thread, other threads:[~2008-07-18 11:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14 21:14 [PATCH] x86_64: ia32_signal.c: use macro instead of immediate Hiroshi Shimamoto
2008-07-14 22:05 ` H. Peter Anvin
2008-07-14 22:19   ` Hiroshi Shimamoto
2008-07-14 22:23     ` H. Peter Anvin
2008-07-14 22:26       ` Hiroshi Shimamoto
2008-07-14 22:34       ` Hiroshi Shimamoto
2008-07-18 11:53         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox