aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-05-26 19:25:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:36 -0400
commitedeafa74e69f275649624484cdd8b551c8839163 (patch)
tree01a656c36d0f8d037acac7898737ce5b3043b607 /include/asm-generic
parent456f998ec817ebfa254464be4f089542fa390645 (diff)
asm-generic/ptrace.h: start a common low level ptrace helper
This is a series of low level ptrace unification steps to make it easier for common code (like KGDB) to poke at register state. This also avoids having to duplicate higher level operations for most ports which don't have special needs for accessing things. This patch: This implements a bunch of helper funcs for poking the registers of a ptrace structure. Now common code should be able to portably update specific registers (like kgdb updating the PC). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Sergei Shtylyov <sshtylyov@mvista.com> Cc: Dongdong Deng <dongdong.deng@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/ptrace.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/include/asm-generic/ptrace.h b/include/asm-generic/ptrace.h
new file mode 100644
index 000000000000..82e674f6b337
--- /dev/null
+++ b/include/asm-generic/ptrace.h
@@ -0,0 +1,74 @@
1/*
2 * Common low level (register) ptrace helpers
3 *
4 * Copyright 2004-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_GENERIC_PTRACE_H__
10#define __ASM_GENERIC_PTRACE_H__
11
12#ifndef __ASSEMBLY__
13
14/* Helpers for working with the instruction pointer */
15#ifndef GET_IP
16#define GET_IP(regs) ((regs)->pc)
17#endif
18#ifndef SET_IP
19#define SET_IP(regs, val) (GET_IP(regs) = (val))
20#endif
21
22static inline unsigned long instruction_pointer(struct pt_regs *regs)
23{
24 return GET_IP(regs);
25}
26static inline void instruction_pointer_set(struct pt_regs *regs,
27 unsigned long val)
28{
29 SET_IP(regs, val);
30}
31
32#ifndef profile_pc
33#define profile_pc(regs) instruction_pointer(regs)
34#endif
35
36/* Helpers for working with the user stack pointer */
37#ifndef GET_USP
38#define GET_USP(regs) ((regs)->usp)
39#endif
40#ifndef SET_USP
41#define SET_USP(regs, val) (GET_USP(regs) = (val))
42#endif
43
44static inline unsigned long user_stack_pointer(struct pt_regs *regs)
45{
46 return GET_USP(regs);
47}
48static inline void user_stack_pointer_set(struct pt_regs *regs,
49 unsigned long val)
50{
51 SET_USP(regs, val);
52}
53
54/* Helpers for working with the frame pointer */
55#ifndef GET_FP
56#define GET_FP(regs) ((regs)->fp)
57#endif
58#ifndef SET_FP
59#define SET_FP(regs, val) (GET_FP(regs) = (val))
60#endif
61
62static inline unsigned long frame_pointer(struct pt_regs *regs)
63{
64 return GET_FP(regs);
65}
66static inline void frame_pointer_set(struct pt_regs *regs,
67 unsigned long val)
68{
69 SET_FP(regs, val);
70}
71
72#endif /* __ASSEMBLY__ */
73
74#endif