summaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/ptrace-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64/ptrace-common.h')
-rw-r--r--include/asm-ppc64/ptrace-common.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h
index bd0f84c27bd..b1babb72967 100644
--- a/include/asm-ppc64/ptrace-common.h
+++ b/include/asm-ppc64/ptrace-common.h
@@ -13,6 +13,7 @@
#define _PPC64_PTRACE_COMMON_H
#include <linux/config.h>
+#include <asm/system.h>
/*
* Set of msr bits that gdb can change on behalf of a process.
@@ -141,4 +142,23 @@ static inline int set_vrregs(struct task_struct *task,
}
#endif
+static inline int ptrace_set_debugreg(struct task_struct *task,
+ unsigned long addr, unsigned long data)
+{
+ /* We only support one DABR and no IABRS at the moment */
+ if (addr > 0)
+ return -EINVAL;
+
+ /* The bottom 3 bits are flags */
+ if ((data & ~0x7UL) >= TASK_SIZE)
+ return -EIO;
+
+ /* Ensure translation is on */
+ if (data && !(data & DABR_TRANSLATION))
+ return -EIO;
+
+ task->thread.dabr = data;
+ return 0;
+}
+
#endif /* _PPC64_PTRACE_COMMON_H */