Skip to content

Commit

Permalink
x86: signal: introduce helper macro is_ia32
Browse files Browse the repository at this point in the history
Introduce new macro is_ia32 for unification of setup_rt_frame().
No effect in binary, compiler will optimize.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Hiroshi Shimamoto authored and Ingo Molnar committed Sep 25, 2008
1 parent b94fd69 commit 455edbc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions arch/x86/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
13 changes: 9 additions & 4 deletions arch/x86/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,27 @@ 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)
{
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);
Expand Down

0 comments on commit 455edbc

Please sign in to comment.