aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/hw_breakpoint.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-09 15:03:43 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2009-11-10 05:23:05 -0500
commit9f6b3c2c30cfbb1166ce7e74a8f9fd93ae19d2de (patch)
tree1144b1c516327765c7daacc6f4b23cc606a0c013 /arch/x86/kernel/hw_breakpoint.c
parent676c0dbe6e514fdd8e434a9e623c781aa9b40b15 (diff)
hw-breakpoints: Fix broken a.out format dump
Fix the broken a.out format dump. For now we only dump the ptrace breakpoints. TODO: Dump every perf breakpoints for the current thread, not only ptrace based ones. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: "K. Prasad" <prasad@linux.vnet.ibm.com>
Diffstat (limited to 'arch/x86/kernel/hw_breakpoint.c')
-rw-r--r--arch/x86/kernel/hw_breakpoint.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index e622620790bd..57dcee5fa958 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -376,6 +376,41 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
376} 376}
377 377
378/* 378/*
379 * Dump the debug register contents to the user.
380 * We can't dump our per cpu values because it
381 * may contain cpu wide breakpoint, something that
382 * doesn't belong to the current task.
383 *
384 * TODO: include non-ptrace user breakpoints (perf)
385 */
386void aout_dump_debugregs(struct user *dump)
387{
388 int i;
389 int dr7 = 0;
390 struct perf_event *bp;
391 struct arch_hw_breakpoint *info;
392 struct thread_struct *thread = &current->thread;
393
394 for (i = 0; i < HBP_NUM; i++) {
395 bp = thread->ptrace_bps[i];
396
397 if (bp && !bp->attr.disabled) {
398 dump->u_debugreg[i] = bp->attr.bp_addr;
399 info = counter_arch_bp(bp);
400 dr7 |= encode_dr7(i, info->len, info->type);
401 } else {
402 dump->u_debugreg[i] = 0;
403 }
404 }
405
406 dump->u_debugreg[4] = 0;
407 dump->u_debugreg[5] = 0;
408 dump->u_debugreg[6] = current->thread.debugreg6;
409
410 dump->u_debugreg[7] = dr7;
411}
412
413/*
379 * Release the user breakpoints used by ptrace 414 * Release the user breakpoints used by ptrace
380 */ 415 */
381void flush_ptrace_hw_breakpoint(struct task_struct *tsk) 416void flush_ptrace_hw_breakpoint(struct task_struct *tsk)