Skip to contentSkip to conversation

powerpc: provide APIs for validating and updating DABR

RFC/PATCH Nathan Lynch 2 participants 2 messages Feb 17, 2009 – Feb 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

A checkpointed task image may specify a value for the DABR (Data Access Breakpoint Register). The restart code needs to validate this value before making any changes to the current task.

ptrace_set_debugreg encapsulates the bounds checking and platform dependencies of programming the DABR. Split this into "validate" (debugreg_valid) and "update" (debugreg_update) functions, and make them available for use outside of the ptrace code.

Also ptrace_set_debugreg has extern linkage, but no users outside of ptrace.c. Make it static.

---
 arch/powerpc/include/asm/ptrace.h |    6 +++
 arch/powerpc/kernel/ptrace.c      |   68 ++++++++++++++++++++----------------
 2 files changed, 44 insertions(+), 30 deletions(-)

Is something like this okay to carry in the checkpoint/restart patches?

arch/powerpc/include/asm/ptrace.h +6 -0
index c9c678f..1b3a5f0 100644
@@ -81,6 +81,8 @@ struct pt_regs {
 
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
 #define instruction_pointer(regs) ((regs)->nip)
 #define user_stack_pointer(regs) ((regs)->gpr[1])
 #define regs_return_value(regs) ((regs)->gpr[3])
@@ -138,6 +140,10 @@ do {									      \
 extern void user_enable_single_step(struct task_struct *);
 extern void user_disable_single_step(struct task_struct *);
 
+/* for reprogramming DABR/DAC during restart of a checkpointed task */
+extern bool debugreg_valid(unsigned long val);
+extern void debugreg_update(struct task_struct *task, unsigned long val);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
arch/powerpc/kernel/ptrace.c +38 -30

107 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#1 lore raw

arch/powerpc/include/asm/ptrace.h do { \ · line 146

Quoted 5 lines
arch/powerpc/include/asm/ptrace.h +4 -0
+/* for reprogramming DABR/DAC during restart of a checkpointed task */
+extern bool debugreg_valid(unsigned long val);
+extern void debugreg_update(struct task_struct *task, unsigned long val);
+

Please keep the "index" here. We may want to add support for IABR, and there is some WIP to add support for multiple DACs and IACs on BookE processors.

Cheers,
Ben.