x86 single_step: TIF_FORCED_TF

This changes the single-step support to use a new thread_info flag
TIF_FORCED_TF instead of the PT_DTRACE flag in task_struct.ptrace.
This keeps arch implementation uses out of this non-arch field.

This changes the ptrace access to eflags to mask TF and maintain
the TIF_FORCED_TF flag directly if userland sets TF, instead of
relying on ptrace_signal_deliver.  The 64-bit and 32-bit kernels
are harmonized on this same behavior.  The ptrace_signal_deliver
approach works now, but this change makes the low-level register
access code reliable when called from different contexts than a
ptrace stop, which will be possible in the future.

The 64-bit do_debug exception handler is also changed not to clear TF
from user-mode registers.  This matches the 32-bit kernel's behavior.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Roland McGrath
2008-01-30 13:30:50 +01:00
committed by Ingo Molnar
parent 7122ec8158
commit e1f287735c
12 changed files with 79 additions and 59 deletions

View File

@@ -135,7 +135,7 @@ void user_enable_single_step(struct task_struct *child)
if (is_setting_trap_flag(child, regs))
return;
child->ptrace |= PT_DTRACE;
set_tsk_thread_flag(child, TIF_FORCED_TF);
}
void user_disable_single_step(struct task_struct *child)
@@ -144,9 +144,6 @@ void user_disable_single_step(struct task_struct *child)
clear_tsk_thread_flag(child, TIF_SINGLESTEP);
/* But touch TF only if it was set by us.. */
if (child->ptrace & PT_DTRACE) {
struct pt_regs *regs = task_pt_regs(child);
regs->eflags &= ~X86_EFLAGS_TF;
child->ptrace &= ~PT_DTRACE;
}
if (test_and_clear_tsk_thread_flag(child, TIF_FORCED_TF))
task_pt_regs(child)->eflags &= ~X86_EFLAGS_TF;
}