diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-25 14:51:51 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 11:33:57 +0100 |
commit | ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6 (patch) | |
tree | df2998225dc10245ce3d392576a724ab788e456c /arch/x86/kernel/process.c | |
parent | faa4602e47690fb11221e00f9b9697c8dc0d4b19 (diff) | |
download | op-kernel-dev-ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6.zip op-kernel-dev-ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6.tar.gz |
x86, ptrace: Fix block-step
Implement ptrace-block-step using TIF_BLOCKSTEP which will set
DEBUGCTLMSR_BTF when set for a task while preserving any other
DEBUGCTLMSR bits.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100325135414.017536066@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 1a60beb..8328009 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -195,6 +195,17 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, prev = &prev_p->thread; next = &next_p->thread; + if (test_tsk_thread_flag(prev_p, TIF_BLOCKSTEP) ^ + test_tsk_thread_flag(next_p, TIF_BLOCKSTEP)) { + unsigned long debugctl = get_debugctlmsr(); + + debugctl &= ~DEBUGCTLMSR_BTF; + if (test_tsk_thread_flag(next_p, TIF_BLOCKSTEP)) + debugctl |= DEBUGCTLMSR_BTF; + + update_debugctlmsr(debugctl); + } + if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^ test_tsk_thread_flag(next_p, TIF_NOTSC)) { /* prev and next are different */ |