Linux 4.14.5
[linux/fpc-iii.git] / include / asm-generic / ptrace.h
blob82e674f6b337c11927041609fce05eaedac0581e
1 /*
2 * Common low level (register) ptrace helpers
4 * Copyright 2004-2011 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
9 #ifndef __ASM_GENERIC_PTRACE_H__
10 #define __ASM_GENERIC_PTRACE_H__
12 #ifndef __ASSEMBLY__
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
22 static inline unsigned long instruction_pointer(struct pt_regs *regs)
24 return GET_IP(regs);
26 static inline void instruction_pointer_set(struct pt_regs *regs,
27 unsigned long val)
29 SET_IP(regs, val);
32 #ifndef profile_pc
33 #define profile_pc(regs) instruction_pointer(regs)
34 #endif
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
44 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
46 return GET_USP(regs);
48 static inline void user_stack_pointer_set(struct pt_regs *regs,
49 unsigned long val)
51 SET_USP(regs, val);
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
62 static inline unsigned long frame_pointer(struct pt_regs *regs)
64 return GET_FP(regs);
66 static inline void frame_pointer_set(struct pt_regs *regs,
67 unsigned long val)
69 SET_FP(regs, val);
72 #endif /* __ASSEMBLY__ */
74 #endif