diff options
Diffstat (limited to 'arch/x86/kernel/hw_breakpoint.c')
-rw-r--r-- | arch/x86/kernel/hw_breakpoint.c | 35 |
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 | */ | ||
386 | void 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 = ¤t->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 | */ |
381 | void flush_ptrace_hw_breakpoint(struct task_struct *tsk) | 416 | void flush_ptrace_hw_breakpoint(struct task_struct *tsk) |