aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/step.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-01-30 07:30:50 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:50 -0500
commite1f287735c1e58c653b516931b5d3dd899edcb77 (patch)
tree1a2948cfe8ff679135971e2c573d11b847fee93d /arch/x86/kernel/step.c
parent7122ec8158b0f88befd94f4da8feae2c8d08d1b4 (diff)
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>
Diffstat (limited to 'arch/x86/kernel/step.c')
-rw-r--r--arch/x86/kernel/step.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 6732272e3479..243bff650ca5 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -135,7 +135,7 @@ void user_enable_single_step(struct task_struct *child)
135 if (is_setting_trap_flag(child, regs)) 135 if (is_setting_trap_flag(child, regs))
136 return; 136 return;
137 137
138 child->ptrace |= PT_DTRACE; 138 set_tsk_thread_flag(child, TIF_FORCED_TF);
139} 139}
140 140
141void user_disable_single_step(struct task_struct *child) 141void user_disable_single_step(struct task_struct *child)
@@ -144,9 +144,6 @@ void user_disable_single_step(struct task_struct *child)
144 clear_tsk_thread_flag(child, TIF_SINGLESTEP); 144 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
145 145
146 /* But touch TF only if it was set by us.. */ 146 /* But touch TF only if it was set by us.. */
147 if (child->ptrace & PT_DTRACE) { 147 if (test_and_clear_tsk_thread_flag(child, TIF_FORCED_TF))
148 struct pt_regs *regs = task_pt_regs(child); 148 task_pt_regs(child)->eflags &= ~X86_EFLAGS_TF;
149 regs->eflags &= ~X86_EFLAGS_TF;
150 child->ptrace &= ~PT_DTRACE;
151 }
152} 149}