public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] x86: signal_32.c: introduce signr_convert()
@ 2008-09-25  2:10 Hiroshi Shimamoto
  2008-09-25  2:12 ` [PATCH 2/4] x86: signal_64.c: introduce helper function signr_convert() Hiroshi Shimamoto
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-25  2:10 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

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

Introduce signr_convert().
This function will help unification of setup_rt_frame().

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

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index bb05917..b1bc90f 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -482,18 +482,21 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 /*
  * OK, we're invoking a handler:
  */
+static int signr_convert(int sig)
+{
+	struct thread_info *info = current_thread_info();
+
+	if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32)
+		return info->exec_domain->signal_invmap[sig];
+	return sig;
+}
+
 static int
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	       sigset_t *set, struct pt_regs *regs)
 {
+	int usig = signr_convert(sig);
 	int ret;
-	int usig;
-
-	usig = current_thread_info()->exec_domain
-		&& current_thread_info()->exec_domain->signal_invmap
-		&& sig < 32
-		? current_thread_info()->exec_domain->signal_invmap[sig]
-		: sig;
 
 	/* Set up the stack frame */
 	if (ka->sa.sa_flags & SA_SIGINFO)
-- 
1.5.6


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

* [PATCH 2/4] x86: signal_64.c: introduce helper function signr_convert()
  2008-09-25  2:10 [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Hiroshi Shimamoto
@ 2008-09-25  2:12 ` Hiroshi Shimamoto
  2008-09-25  2:13 ` [PATCH 3/4] x86: signal: introduce helper macro is_ia32 Hiroshi Shimamoto
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-25  2:12 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

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

This helper function is for unification of setup_rt_frame().
No affect in binary.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/kernel/signal_64.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 963236f..c5d8002 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -281,18 +281,24 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 /*
  * OK, we're invoking a handler
  */
+static int signr_convert(int sig)
+{
+	return sig;
+}
+
 static int
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	       sigset_t *set, struct pt_regs *regs)
 {
+	int usig = signr_convert(sig);
 	int ret;
 
 #ifdef CONFIG_IA32_EMULATION
 	if (test_thread_flag(TIF_IA32)) {
 		if (ka->sa.sa_flags & SA_SIGINFO)
-			ret = ia32_setup_rt_frame(sig, ka, info, set, regs);
+			ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
 		else
-			ret = ia32_setup_frame(sig, ka, set, regs);
+			ret = ia32_setup_frame(usig, ka, set, regs);
 	} else
 #endif
 	ret = __setup_rt_frame(sig, ka, info, set, regs);
-- 
1.5.6


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

* [PATCH 3/4] x86: signal: introduce helper macro is_ia32
  2008-09-25  2:10 [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Hiroshi Shimamoto
  2008-09-25  2:12 ` [PATCH 2/4] x86: signal_64.c: introduce helper function signr_convert() Hiroshi Shimamoto
@ 2008-09-25  2:13 ` Hiroshi Shimamoto
  2008-09-25  2:13 ` [PATCH 4/4] x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame Hiroshi Shimamoto
  2008-09-25  8:14 ` [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Ingo Molnar
  3 siblings, 0 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-25  2:13 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

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

Introduce new macro is_ia32 for unification of setup_rt_frame().
No affect in binary, compiler will optimize.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
 arch/x86/kernel/signal_32.c |   13 +++++++++----
 arch/x86/kernel/signal_64.c |   13 +++++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index b1bc90f..cf62f70 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -491,6 +491,8 @@ static int signr_convert(int sig)
 	return sig;
 }
 
+#define is_ia32	1
+
 static int
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	       sigset_t *set, struct pt_regs *regs)
@@ -499,10 +501,13 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	int ret;
 
 	/* Set up the stack frame */
-	if (ka->sa.sa_flags & SA_SIGINFO)
-		ret = __setup_rt_frame(usig, ka, info, set, regs);
-	else
-		ret = __setup_frame(usig, ka, set, regs);
+	if (is_ia32) {
+		if (ka->sa.sa_flags & SA_SIGINFO)
+			ret = __setup_rt_frame(usig, ka, info, set, regs);
+		else
+			ret = __setup_frame(usig, ka, set, regs);
+	} else
+		ret = __setup_rt_frame(sig, ka, info, set, regs);
 
 	if (ret) {
 		force_sigsegv(sig, current);
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index c5d8002..53f86d9 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -286,6 +286,12 @@ static int signr_convert(int sig)
 	return sig;
 }
 
+#ifdef CONFIG_IA32_EMULATION
+#define is_ia32	test_thread_flag(TIF_IA32)
+#else
+#define is_ia32	0
+#endif
+
 static int
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	       sigset_t *set, struct pt_regs *regs)
@@ -293,15 +299,14 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	int usig = signr_convert(sig);
 	int ret;
 
-#ifdef CONFIG_IA32_EMULATION
-	if (test_thread_flag(TIF_IA32)) {
+	/* Set up the stack frame */
+	if (is_ia32) {
 		if (ka->sa.sa_flags & SA_SIGINFO)
 			ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
 		else
 			ret = ia32_setup_frame(usig, ka, set, regs);
 	} else
-#endif
-	ret = __setup_rt_frame(sig, ka, info, set, regs);
+		ret = __setup_rt_frame(sig, ka, info, set, regs);
 
 	if (ret) {
 		force_sigsegv(sig, current);
-- 
1.5.6


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

* [PATCH 4/4] x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame
  2008-09-25  2:10 [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Hiroshi Shimamoto
  2008-09-25  2:12 ` [PATCH 2/4] x86: signal_64.c: introduce helper function signr_convert() Hiroshi Shimamoto
  2008-09-25  2:13 ` [PATCH 3/4] x86: signal: introduce helper macro is_ia32 Hiroshi Shimamoto
@ 2008-09-25  2:13 ` Hiroshi Shimamoto
  2008-09-25  8:14 ` [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Ingo Molnar
  3 siblings, 0 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-25  2:13 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel

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

Make 32-bit setup_rt_frame() look like 64-bit version for unification.

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

diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index cf62f70..4337cd5 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -492,6 +492,8 @@ static int signr_convert(int sig)
 }
 
 #define is_ia32	1
+#define ia32_setup_frame	__setup_frame
+#define ia32_setup_rt_frame	__setup_rt_frame
 
 static int
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
@@ -503,9 +505,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	/* Set up the stack frame */
 	if (is_ia32) {
 		if (ka->sa.sa_flags & SA_SIGINFO)
-			ret = __setup_rt_frame(usig, ka, info, set, regs);
+			ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
 		else
-			ret = __setup_frame(usig, ka, set, regs);
+			ret = ia32_setup_frame(usig, ka, set, regs);
 	} else
 		ret = __setup_rt_frame(sig, ka, info, set, regs);
 
-- 
1.5.6


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

* Re: [PATCH 1/4] x86: signal_32.c: introduce signr_convert()
  2008-09-25  2:10 [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Hiroshi Shimamoto
                   ` (2 preceding siblings ...)
  2008-09-25  2:13 ` [PATCH 4/4] x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame Hiroshi Shimamoto
@ 2008-09-25  8:14 ` Ingo Molnar
  2008-09-25 16:59   ` Hiroshi Shimamoto
  3 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2008-09-25  8:14 UTC (permalink / raw)
  To: Hiroshi Shimamoto
  Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel, Roland McGrath


applied your patches to tip/x86/signal:

4694d23: x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame
455edbc: x86: signal: introduce helper macro is_ia32
b94fd69: x86: signal_64.c: introduce helper function signr_convert()
8d8c13b: x86: signal_32.c: introduce signr_convert()

thanks! FYI, your other 13 x86 signal code unification commits and other 
x86-signals enhancements passed testing just fine so far.

	Ingo

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

* Re: [PATCH 1/4] x86: signal_32.c: introduce signr_convert()
  2008-09-25  8:14 ` [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Ingo Molnar
@ 2008-09-25 16:59   ` Hiroshi Shimamoto
  0 siblings, 0 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-25 16:59 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel, Roland McGrath

Ingo Molnar wrote:
> applied your patches to tip/x86/signal:
> 
> 4694d23: x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame
> 455edbc: x86: signal: introduce helper macro is_ia32
> b94fd69: x86: signal_64.c: introduce helper function signr_convert()
> 8d8c13b: x86: signal_32.c: introduce signr_convert()
> 
> thanks! FYI, your other 13 x86 signal code unification commits and other 
> x86-signals enhancements passed testing just fine so far.

Hi, Ingo.
Thanks for that information and testing my patches!
It's very important to test patches.

thanks,
Hiroshi Shimamoto

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

end of thread, other threads:[~2008-09-25 16:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-25  2:10 [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Hiroshi Shimamoto
2008-09-25  2:12 ` [PATCH 2/4] x86: signal_64.c: introduce helper function signr_convert() Hiroshi Shimamoto
2008-09-25  2:13 ` [PATCH 3/4] x86: signal: introduce helper macro is_ia32 Hiroshi Shimamoto
2008-09-25  2:13 ` [PATCH 4/4] x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame Hiroshi Shimamoto
2008-09-25  8:14 ` [PATCH 1/4] x86: signal_32.c: introduce signr_convert() Ingo Molnar
2008-09-25 16:59   ` Hiroshi Shimamoto

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