x86, ptrace: support for branch trace store(BTS)

Resend using different mail client

Changes to the last version:
- split implementation into two layers: ds/bts and ptrace
- renamed TIF's
- save/restore ds save area msr in __switch_to_xtra()
- make block-stepping only look at BTF bit

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Markus Metzger
2008-01-30 13:31:09 +01:00
committed by Ingo Molnar
parent 7796931f54
commit eee3af4a2c
16 changed files with 859 additions and 12 deletions

View File

@@ -169,9 +169,14 @@ static void enable_step(struct task_struct *child, bool block)
*/
if (enable_single_step(child) && block) {
set_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
write_debugctlmsr(child, DEBUGCTLMSR_BTF);
} else if (test_and_clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR)) {
write_debugctlmsr(child, 0);
write_debugctlmsr(child,
child->thread.debugctlmsr | DEBUGCTLMSR_BTF);
} else {
write_debugctlmsr(child,
child->thread.debugctlmsr & ~TIF_DEBUGCTLMSR);
if (!child->thread.debugctlmsr)
clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
}
}
@@ -190,8 +195,11 @@ void user_disable_single_step(struct task_struct *child)
/*
* Make sure block stepping (BTF) is disabled.
*/
if (test_and_clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR))
write_debugctlmsr(child, 0);
write_debugctlmsr(child,
child->thread.debugctlmsr & ~TIF_DEBUGCTLMSR);
if (!child->thread.debugctlmsr)
clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
/* Always clear TIF_SINGLESTEP... */
clear_tsk_thread_flag(child, TIF_SINGLESTEP);