2008-11-22 01:36:53

by Hiroshi Shimamoto

[permalink] [raw]
Subject: [PATCH 1/3] x86: signal: cosmetic unification of including headers

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Make including headers same.

Signed-off-by: Hiroshi Shimamoto <[email protected]>
---
arch/x86/kernel/signal_32.c | 27 +++++++++++++++------------
arch/x86/kernel/signal_64.c | 7 ++++++-
2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index c2aabeb..0ff8d87 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -4,29 +4,32 @@
* 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
* 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes
*/
-#include <linux/list.h>

-#include <linux/personality.h>
-#include <linux/binfmts.h>
-#include <linux/suspend.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
#include <linux/kernel.h>
-#include <linux/ptrace.h>
#include <linux/signal.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
#include <linux/errno.h>
-#include <linux/sched.h>
#include <linux/wait.h>
+#include <linux/ptrace.h>
#include <linux/tracehook.h>
-#include <linux/elf.h>
-#include <linux/smp.h>
-#include <linux/mm.h>
+#include <linux/unistd.h>
+#include <linux/stddef.h>
+#include <linux/personality.h>
+#include <linux/uaccess.h>

#include <asm/processor.h>
#include <asm/ucontext.h>
-#include <asm/uaccess.h>
#include <asm/i387.h>
#include <asm/vdso.h>
+
+#ifdef CONFIG_X86_64
+#include <asm/proto.h>
+#include <asm/ia32_unistd.h>
+#include <asm/mce.h>
+#endif /* CONFIG_X86_64 */
+
#include <asm/syscall.h>
#include <asm/syscalls.h>

diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 3d54d36..c52244a 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -19,17 +19,22 @@
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/personality.h>
-#include <linux/compiler.h>
#include <linux/uaccess.h>

#include <asm/processor.h>
#include <asm/ucontext.h>
#include <asm/i387.h>
+#include <asm/vdso.h>
+
+#ifdef CONFIG_X86_64
#include <asm/proto.h>
#include <asm/ia32_unistd.h>
#include <asm/mce.h>
+#endif /* CONFIG_X86_64 */
+
#include <asm/syscall.h>
#include <asm/syscalls.h>
+
#include "sigframe.h"

#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
--
1.5.6


2008-11-22 01:38:34

by Hiroshi Shimamoto

[permalink] [raw]
Subject: [PATCH 2/3] x86: signal: cosmetic unification of sys_sigaltstack()

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Add #ifdef directive for unification.

Signed-off-by: Hiroshi Shimamoto <[email protected]>
---
arch/x86/kernel/signal_32.c | 9 +++++++++
arch/x86/kernel/signal_64.c | 15 +++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 0ff8d87..d990988 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -125,6 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
return ret;
}

+#ifdef CONFIG_X86_32
asmlinkage int sys_sigaltstack(unsigned long bx)
{
/*
@@ -137,6 +138,14 @@ asmlinkage int sys_sigaltstack(unsigned long bx)

return do_sigaltstack(uss, uoss, regs->sp);
}
+#else /* !CONFIG_X86_32 */
+asmlinkage long
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+ struct pt_regs *regs)
+{
+ return do_sigaltstack(uss, uoss, regs->sp);
+}
+#endif /* CONFIG_X86_32 */

#define COPY(x) { \
err |= __get_user(regs->x, &sc->x); \
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index c52244a..b6e4fe0 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -50,12 +50,27 @@
# define FIX_EFLAGS __FIX_EFLAGS
#endif

+#ifdef CONFIG_X86_32
+asmlinkage int sys_sigaltstack(unsigned long bx)
+{
+ /*
+ * This is needed to make gcc realize it doesn't own the
+ * "struct pt_regs"
+ */
+ struct pt_regs *regs = (struct pt_regs *)&bx;
+ const stack_t __user *uss = (const stack_t __user *)bx;
+ stack_t __user *uoss = (stack_t __user *)regs->cx;
+
+ return do_sigaltstack(uss, uoss, regs->sp);
+}
+#else /* !CONFIG_X86_32 */
asmlinkage long
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
{
return do_sigaltstack(uss, uoss, regs->sp);
}
+#endif /* CONFIG_X86_32 */

#define COPY(x) { \
err |= __get_user(regs->x, &sc->x); \
--
1.5.6

2008-11-22 01:39:18

by Hiroshi Shimamoto

[permalink] [raw]
Subject: [PATCH 3/3] x86: signal: cosmetic unification of sys_rt_sigreturn()

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Add #ifdef directive for unification.

Signed-off-by: Hiroshi Shimamoto <[email protected]>
---
arch/x86/kernel/signal_32.c | 7 +++++++
arch/x86/kernel/signal_64.c | 9 +++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index d990988..f7dd6c4 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -299,12 +299,19 @@ badframe:
return 0;
}

+#ifdef CONFIG_X86_32
asmlinkage int sys_rt_sigreturn(unsigned long __unused)
{
struct pt_regs *regs = (struct pt_regs *)&__unused;

return do_rt_sigreturn(regs);
}
+#else /* !CONFIG_X86_32 */
+asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
+{
+ return do_rt_sigreturn(regs);
+}
+#endif /* CONFIG_X86_32 */

/*
* Set up a signal frame.
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index b6e4fe0..32718f5 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -169,10 +169,19 @@ badframe:
return 0;
}

+#ifdef CONFIG_X86_32
+asmlinkage int sys_rt_sigreturn(unsigned long __unused)
+{
+ struct pt_regs *regs = (struct pt_regs *)&__unused;
+
+ return do_rt_sigreturn(regs);
+}
+#else /* !CONFIG_X86_32 */
asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
{
return do_rt_sigreturn(regs);
}
+#endif /* CONFIG_X86_32 */

/*
* Set up a signal frame.
--
1.5.6

2008-11-22 01:50:53

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH 3/3] x86: signal: cosmetic unification of sys_rt_sigreturn()

Hiroshi Shimamoto wrote:
>
> +#ifdef CONFIG_X86_32
> asmlinkage int sys_rt_sigreturn(unsigned long __unused)
> {
> struct pt_regs *regs = (struct pt_regs *)&__unused;
>
> return do_rt_sigreturn(regs);
> }

Why not:

asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
{
return do_rt_sigreturn(&regs);
}

...?

-hpa

2008-11-22 02:08:22

by Hiroshi Shimamoto

[permalink] [raw]
Subject: Re: [PATCH 3/3] x86: signal: cosmetic unification of sys_rt_sigreturn()

H. Peter Anvin wrote:
> Hiroshi Shimamoto wrote:
>>
>> +#ifdef CONFIG_X86_32
>> asmlinkage int sys_rt_sigreturn(unsigned long __unused)
>> {
>> struct pt_regs *regs = (struct pt_regs *)&__unused;
>>
>> return do_rt_sigreturn(regs);
>> }
>
> Why not:
>
> asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
> {
> return do_rt_sigreturn(&regs);
> }
>
> ...?

Good question. I didn't realize about that.
Will take a look.

thanks,
Hiroshi Shimamoto

2008-11-23 09:52:16

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 3/3] x86: signal: cosmetic unification of sys_rt_sigreturn()


* Hiroshi Shimamoto <[email protected]> wrote:

> H. Peter Anvin wrote:
> > Hiroshi Shimamoto wrote:
> >>
> >> +#ifdef CONFIG_X86_32
> >> asmlinkage int sys_rt_sigreturn(unsigned long __unused)
> >> {
> >> struct pt_regs *regs = (struct pt_regs *)&__unused;
> >>
> >> return do_rt_sigreturn(regs);
> >> }
> >
> > Why not:
> >
> > asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
> > {
> > return do_rt_sigreturn(&regs);
> > }
> >
> > ...?
>
> Good question. I didn't realize about that.
> Will take a look.

I've applied your 3 patches to tip/x86/signal - please send a patch on
top of your current lineup, for the detail Peter pointed out.

Thanks,

Ingo

2008-11-24 23:55:38

by Hiroshi Shimamoto

[permalink] [raw]
Subject: Re: [PATCH 3/3] x86: signal: cosmetic unification of sys_rt_sigreturn()

Ingo Molnar wrote:
> * Hiroshi Shimamoto <[email protected]> wrote:
>
>> H. Peter Anvin wrote:
>>> Hiroshi Shimamoto wrote:
>>>>
>>>> +#ifdef CONFIG_X86_32
>>>> asmlinkage int sys_rt_sigreturn(unsigned long __unused)
>>>> {
>>>> struct pt_regs *regs = (struct pt_regs *)&__unused;
>>>>
>>>> return do_rt_sigreturn(regs);
>>>> }
>>> Why not:
>>>
>>> asmlinkage int sys_rt_sigreturn(struct pt_regs regs)
>>> {
>>> return do_rt_sigreturn(&regs);
>>> }
>>>
>>> ...?
>> Good question. I didn't realize about that.
>> Will take a look.
>
> I've applied your 3 patches to tip/x86/signal - please send a patch on
> top of your current lineup, for the detail Peter pointed out.

OK, will do.
I think it's better to send a patch after unifying signal_{32|64}.c.

thanks,
Hiroshi Shimamoto