Skip to contentSkip to conversation

x86: signal: cosmetic unification of including headers

PATCH In review Hiroshi Shimamoto 3 participants 7 messages Nov 22, 2008 – Nov 24, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 x86: signal: cosmetic unification of including headers

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Make including headers same.

---
 arch/x86/kernel/signal_32.c |   27 +++++++++++++++------------
 arch/x86/kernel/signal_64.c |    7 ++++++-
 2 files changed, 21 insertions(+), 13 deletions(-)
arch/x86/kernel/signal_32.c +15 -12
index c2aabeb..0ff8d87 100644
@@ -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>
 
arch/x86/kernel/signal_64.c +6 -1
index 3d54d36..c52244a 100644
@@ -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)))
Signature · 1 line
1.5.6
#1 lore raw

PATCH 2/3 x86: signal: cosmetic unification of sys_sigaltstack()

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Add #ifdef directive for unification.

---
 arch/x86/kernel/signal_32.c |    9 +++++++++
 arch/x86/kernel/signal_64.c |   15 +++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
arch/x86/kernel/signal_32.c +9 -0
index 0ff8d87..d990988 100644
@@ -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);	\
arch/x86/kernel/signal_64.c +15 -0
index c52244a..b6e4fe0 100644
@@ -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);	\
Signature · 1 line
1.5.6
#2 lore raw

PATCH 3/3 x86: signal: cosmetic unification of sys_rt_sigreturn()

In reply to Hiroshi Shimamoto

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Add #ifdef directive for unification.

---
 arch/x86/kernel/signal_32.c |    7 +++++++
 arch/x86/kernel/signal_64.c |    9 +++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
arch/x86/kernel/signal_32.c +7 -0
index d990988..f7dd6c4 100644
@@ -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.
arch/x86/kernel/signal_64.c +9 -0
index b6e4fe0..32718f5 100644
@@ -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.
Signature · 1 line
1.5.6
#3 lore raw

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

arch/x86/kernel/signal_32.c badframe: · line 308

Quoted 8 lines · Hiroshi Shimamoto
arch/x86/kernel/signal_32.c +1 -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);
 }

Why not:

asmlinkage int sys_rt_sigreturn(struct pt_regs regs)

{
	return do_rt_sigreturn(&regs);
}

...?

-hpa

#4 lore raw

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

Quoted 10 lines · H. Peter Anvin

arch/x86/kernel/signal_32.c badframe: · line 308

Quoted 8 lines · Hiroshi Shimamoto
arch/x86/kernel/signal_32.c +1 -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);
 }
Quoted 8 lines

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

#5 lore raw

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

Quoted 18 lines · Hiroshi Shimamoto
Quoted 17 lines · H. Peter Anvin

arch/x86/kernel/signal_32.c badframe: · line 308

Quoted 8 lines · Hiroshi Shimamoto
arch/x86/kernel/signal_32.c +1 -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);
 }

Why not:

asmlinkage int sys_rt_sigreturn(struct pt_regs regs)

{
	return do_rt_sigreturn(&regs);
}
Quoted 4 lines
Quoted 1 line

...?

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

#6 lore raw

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

Quoted 19 lines · Ingo Molnar
Quoted 17 lines · Hiroshi Shimamoto
Quoted 16 lines · H. Peter Anvin

arch/x86/kernel/signal_32.c badframe: · line 308

Quoted 8 lines · Hiroshi Shimamoto
arch/x86/kernel/signal_32.c +1 -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);
 }

Why not:

asmlinkage int sys_rt_sigreturn(struct pt_regs regs)

{
	return do_rt_sigreturn(&regs);
}
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

...?

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