Commit e4339c82 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

x86 single-step: fix up comments and cleanup.

Pretty much all the TF-related comments were stale, and
had been for a long time. Fix them up, clean up code.
parent fd036f6a
...@@ -704,27 +704,24 @@ fastcall void do_debug(struct pt_regs * regs, long error_code) ...@@ -704,27 +704,24 @@ fastcall void do_debug(struct pt_regs * regs, long error_code)
/* Save debug status register where ptrace can see it */ /* Save debug status register where ptrace can see it */
tsk->thread.debugreg[6] = condition; tsk->thread.debugreg[6] = condition;
/* Mask out spurious TF errors due to lazy TF clearing */ /*
* Single-stepping through TF: make sure we ignore any events in
* kernel space (but re-enable TF when returning to user mode).
* And if the event was due to a debugger (PT_DTRACE), clear the
* TF flag so that register information is correct.
*/
if (condition & DR_STEP) { if (condition & DR_STEP) {
/* /*
* The TF error should be masked out only if the current * We already checked v86 mode above, so we can
* process is not traced and if the TRAP flag has been set * check for kernel mode by just checking the CPL
* previously by a tracing process (condition detected by * of CS.
* the PT_DTRACE flag); remember that the i386 TRAP flag
* can be modified by the process itself in user mode,
* allowing programs to debug themselves without the ptrace()
* interface.
*/ */
if ((regs->xcs & 3) == 0) if ((regs->xcs & 3) == 0)
goto clear_TF_reenable; goto clear_TF_reenable;
/* if (likely(tsk->ptrace & PT_DTRACE)) {
* Was the TF flag set by a debugger? If so, clear it now,
* so that register information is correct.
*/
if (tsk->ptrace & PT_DTRACE) {
regs->eflags &= ~TF_MASK;
tsk->ptrace &= ~PT_DTRACE; tsk->ptrace &= ~PT_DTRACE;
regs->eflags &= ~TF_MASK;
} }
} }
...@@ -746,7 +743,6 @@ fastcall void do_debug(struct pt_regs * regs, long error_code) ...@@ -746,7 +743,6 @@ fastcall void do_debug(struct pt_regs * regs, long error_code)
clear_TF_reenable: clear_TF_reenable:
set_tsk_thread_flag(tsk, TIF_SINGLESTEP); set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
clear_TF:
regs->eflags &= ~TF_MASK; regs->eflags &= ~TF_MASK;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment