aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/ptrace.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-08-06 13:13:54 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-08-06 13:13:54 -0400
commit11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (patch)
tree9e57efcb106ae912f7bec718feb3f8ec607559bb /arch/powerpc/include/asm/ptrace.h
parent162500b3a3ff39d941d29db49b41a16667ae44f0 (diff)
parent9b2a606d3898fcb2eedb6faded3bb37549590ac4 (diff)
Merge branches 'gemini' and 'misc' into devel
Diffstat (limited to 'arch/powerpc/include/asm/ptrace.h')
-rw-r--r--arch/powerpc/include/asm/ptrace.h96
1 files changed, 78 insertions, 18 deletions
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 9e2d84c06b74..0175a676b34b 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -24,11 +24,7 @@
24 * 2 of the License, or (at your option) any later version. 24 * 2 of the License, or (at your option) any later version.
25 */ 25 */
26 26
27#ifdef __KERNEL__
28#include <linux/types.h> 27#include <linux/types.h>
29#else
30#include <stdint.h>
31#endif
32 28
33#ifndef __ASSEMBLY__ 29#ifndef __ASSEMBLY__
34 30
@@ -89,6 +85,7 @@ struct pt_regs {
89 85
90#define instruction_pointer(regs) ((regs)->nip) 86#define instruction_pointer(regs) ((regs)->nip)
91#define user_stack_pointer(regs) ((regs)->gpr[1]) 87#define user_stack_pointer(regs) ((regs)->gpr[1])
88#define kernel_stack_pointer(regs) ((regs)->gpr[1])
92#define regs_return_value(regs) ((regs)->gpr[3]) 89#define regs_return_value(regs) ((regs)->gpr[3])
93 90
94#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
@@ -141,6 +138,69 @@ do { \
141#define arch_has_block_step() (!cpu_has_feature(CPU_FTR_601)) 138#define arch_has_block_step() (!cpu_has_feature(CPU_FTR_601))
142#define ARCH_HAS_USER_SINGLE_STEP_INFO 139#define ARCH_HAS_USER_SINGLE_STEP_INFO
143 140
141/*
142 * kprobe-based event tracer support
143 */
144
145#include <linux/stddef.h>
146#include <linux/thread_info.h>
147extern int regs_query_register_offset(const char *name);
148extern const char *regs_query_register_name(unsigned int offset);
149#define MAX_REG_OFFSET (offsetof(struct pt_regs, dsisr))
150
151/**
152 * regs_get_register() - get register value from its offset
153 * @regs: pt_regs from which register value is gotten
154 * @offset: offset number of the register.
155 *
156 * regs_get_register returns the value of a register whose offset from @regs.
157 * The @offset is the offset of the register in struct pt_regs.
158 * If @offset is bigger than MAX_REG_OFFSET, this returns 0.
159 */
160static inline unsigned long regs_get_register(struct pt_regs *regs,
161 unsigned int offset)
162{
163 if (unlikely(offset > MAX_REG_OFFSET))
164 return 0;
165 return *(unsigned long *)((unsigned long)regs + offset);
166}
167
168/**
169 * regs_within_kernel_stack() - check the address in the stack
170 * @regs: pt_regs which contains kernel stack pointer.
171 * @addr: address which is checked.
172 *
173 * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
174 * If @addr is within the kernel stack, it returns true. If not, returns false.
175 */
176
177static inline bool regs_within_kernel_stack(struct pt_regs *regs,
178 unsigned long addr)
179{
180 return ((addr & ~(THREAD_SIZE - 1)) ==
181 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
182}
183
184/**
185 * regs_get_kernel_stack_nth() - get Nth entry of the stack
186 * @regs: pt_regs which contains kernel stack pointer.
187 * @n: stack entry number.
188 *
189 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
190 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
191 * this returns 0.
192 */
193static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
194 unsigned int n)
195{
196 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
197 addr += n;
198 if (regs_within_kernel_stack(regs, (unsigned long)addr))
199 return *addr;
200 else
201 return 0;
202}
203
144#endif /* __ASSEMBLY__ */ 204#endif /* __ASSEMBLY__ */
145 205
146#endif /* __KERNEL__ */ 206#endif /* __KERNEL__ */
@@ -300,13 +360,13 @@ do { \
300#ifndef __ASSEMBLY__ 360#ifndef __ASSEMBLY__
301 361
302struct ppc_debug_info { 362struct ppc_debug_info {
303 uint32_t version; /* Only version 1 exists to date */ 363 __u32 version; /* Only version 1 exists to date */
304 uint32_t num_instruction_bps; 364 __u32 num_instruction_bps;
305 uint32_t num_data_bps; 365 __u32 num_data_bps;
306 uint32_t num_condition_regs; 366 __u32 num_condition_regs;
307 uint32_t data_bp_alignment; 367 __u32 data_bp_alignment;
308 uint32_t sizeof_condition; /* size of the DVC register */ 368 __u32 sizeof_condition; /* size of the DVC register */
309 uint64_t features; 369 __u64 features;
310}; 370};
311 371
312#endif /* __ASSEMBLY__ */ 372#endif /* __ASSEMBLY__ */
@@ -322,13 +382,13 @@ struct ppc_debug_info {
322#ifndef __ASSEMBLY__ 382#ifndef __ASSEMBLY__
323 383
324struct ppc_hw_breakpoint { 384struct ppc_hw_breakpoint {
325 uint32_t version; /* currently, version must be 1 */ 385 __u32 version; /* currently, version must be 1 */
326 uint32_t trigger_type; /* only some combinations allowed */ 386 __u32 trigger_type; /* only some combinations allowed */
327 uint32_t addr_mode; /* address match mode */ 387 __u32 addr_mode; /* address match mode */
328 uint32_t condition_mode; /* break/watchpoint condition flags */ 388 __u32 condition_mode; /* break/watchpoint condition flags */
329 uint64_t addr; /* break/watchpoint address */ 389 __u64 addr; /* break/watchpoint address */
330 uint64_t addr2; /* range end or mask */ 390 __u64 addr2; /* range end or mask */
331 uint64_t condition_value; /* contents of the DVC register */ 391 __u64 condition_value; /* contents of the DVC register */
332}; 392};
333 393
334#endif /* __ASSEMBLY__ */ 394#endif /* __ASSEMBLY__ */