aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/signal_64.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-04-19 17:26:54 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-26 11:35:47 -0400
commit8b9c5ff380aa4f10658171ed2b9abc1e0861b770 (patch)
tree25cc707163471e593274a16fe3623801b6f0a7a6 /arch/x86/kernel/signal_64.c
parentf7f17a67c589f031c567d9fdc809dee7c5868c8a (diff)
x86 signals: lift flags diddling code
This lifts the code diddling the TF and DF bits for signal handler setup out of the several places copying the same code into the one place that calls them all. There is no change in what it does. I also separated the recently-added DF bit clearing from the TF diddling. The compiler turns them back into one instruction anyway. The tossing in of DF to the same line of code with no new comments was a bit more arcane than seems wise. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/signal_64.c')
-rw-r--r--arch/x86/kernel/signal_64.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 827179c5b32a..3a76702dc3f1 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -289,10 +289,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
289 see include/asm-x86_64/uaccess.h for details. */ 289 see include/asm-x86_64/uaccess.h for details. */
290 set_fs(USER_DS); 290 set_fs(USER_DS);
291 291
292 regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
293 if (test_thread_flag(TIF_SINGLESTEP))
294 ptrace_notify(SIGTRAP);
295
296 return 0; 292 return 0;
297 293
298give_sigsegv: 294give_sigsegv:
@@ -380,6 +376,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
380 ret = setup_rt_frame(sig, ka, info, oldset, regs); 376 ret = setup_rt_frame(sig, ka, info, oldset, regs);
381 377
382 if (ret == 0) { 378 if (ret == 0) {
379 /*
380 * Clear the direction flag as per the ABI for function entry.
381 */
382 regs->flags &= ~X86_EFLAGS_DF;
383
384 /*
385 * Clear TF when entering the signal handler, but
386 * notify any tracer that was single-stepping it.
387 * The tracer may want to single-step inside the
388 * handler too.
389 */
390 regs->flags &= ~X86_EFLAGS_TF;
391 if (test_thread_flag(TIF_SINGLESTEP))
392 ptrace_notify(SIGTRAP);
393
383 spin_lock_irq(&current->sighand->siglock); 394 spin_lock_irq(&current->sighand->siglock);
384 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 395 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
385 if (!(ka->sa.sa_flags & SA_NODEFER)) 396 if (!(ka->sa.sa_flags & SA_NODEFER))