diff options
Diffstat (limited to 'include/asm-arm26/ptrace.h')
-rw-r--r-- | include/asm-arm26/ptrace.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/include/asm-arm26/ptrace.h b/include/asm-arm26/ptrace.h new file mode 100644 index 000000000000..6a46b5ae1156 --- /dev/null +++ b/include/asm-arm26/ptrace.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #ifndef __ASM_ARM_PTRACE_H | ||
2 | #define __ASM_ARM_PTRACE_H | ||
3 | |||
4 | #define PTRACE_GETREGS 12 | ||
5 | #define PTRACE_SETREGS 13 | ||
6 | #define PTRACE_GETFPREGS 14 | ||
7 | #define PTRACE_SETFPREGS 15 | ||
8 | #define PTRACE_OLDSETOPTIONS 21 | ||
9 | |||
10 | /* options set using PTRACE_SETOPTIONS */ | ||
11 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | ||
12 | |||
13 | #define MODE_USR26 0x00000000 | ||
14 | #define MODE_FIQ26 0x00000001 | ||
15 | #define MODE_IRQ26 0x00000002 | ||
16 | #define MODE_SVC26 0x00000003 | ||
17 | #define MODE_MASK 0x00000003 | ||
18 | |||
19 | #define PSR_F_BIT 0x04000000 | ||
20 | #define PSR_I_BIT 0x08000000 | ||
21 | #define PSR_V_BIT 0x10000000 | ||
22 | #define PSR_C_BIT 0x20000000 | ||
23 | #define PSR_Z_BIT 0x40000000 | ||
24 | #define PSR_N_BIT 0x80000000 | ||
25 | |||
26 | #define PCMASK 0xfc000003 | ||
27 | |||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | #define pc_pointer(v) ((v) & ~PCMASK) /* convert v to pc type address */ | ||
32 | #define instruction_pointer(regs) (pc_pointer((regs)->ARM_pc)) /* get pc */ | ||
33 | #define profile_pc(regs) instruction_pointer(regs) | ||
34 | |||
35 | /* this struct defines the way the registers are stored on the | ||
36 | stack during a system call. */ | ||
37 | |||
38 | struct pt_regs { | ||
39 | long uregs[17]; | ||
40 | }; | ||
41 | |||
42 | #define ARM_pc uregs[15] | ||
43 | #define ARM_lr uregs[14] | ||
44 | #define ARM_sp uregs[13] | ||
45 | #define ARM_ip uregs[12] | ||
46 | #define ARM_fp uregs[11] | ||
47 | #define ARM_r10 uregs[10] | ||
48 | #define ARM_r9 uregs[9] | ||
49 | #define ARM_r8 uregs[8] | ||
50 | #define ARM_r7 uregs[7] | ||
51 | #define ARM_r6 uregs[6] | ||
52 | #define ARM_r5 uregs[5] | ||
53 | #define ARM_r4 uregs[4] | ||
54 | #define ARM_r3 uregs[3] | ||
55 | #define ARM_r2 uregs[2] | ||
56 | #define ARM_r1 uregs[1] | ||
57 | #define ARM_r0 uregs[0] | ||
58 | #define ARM_ORIG_r0 uregs[16] | ||
59 | |||
60 | #ifdef __KERNEL__ | ||
61 | |||
62 | #define processor_mode(regs) \ | ||
63 | ((regs)->ARM_pc & MODE_MASK) | ||
64 | |||
65 | #define user_mode(regs) \ | ||
66 | (processor_mode(regs) == MODE_USR26) | ||
67 | |||
68 | #define interrupts_enabled(regs) \ | ||
69 | (!((regs)->ARM_pc & PSR_I_BIT)) | ||
70 | |||
71 | #define fast_interrupts_enabled(regs) \ | ||
72 | (!((regs)->ARM_pc & PSR_F_BIT)) | ||
73 | |||
74 | #define condition_codes(regs) \ | ||
75 | ((regs)->ARM_pc & (PSR_V_BIT|PSR_C_BIT|PSR_Z_BIT|PSR_N_BIT)) | ||
76 | |||
77 | /* Are the current registers suitable for user mode? | ||
78 | * (used to maintain security in signal handlers) | ||
79 | */ | ||
80 | static inline int valid_user_regs(struct pt_regs *regs) | ||
81 | { | ||
82 | if (user_mode(regs) && | ||
83 | (regs->ARM_pc & (PSR_F_BIT | PSR_I_BIT)) == 0) | ||
84 | return 1; | ||
85 | |||
86 | /* | ||
87 | * force it to be something sensible | ||
88 | */ | ||
89 | regs->ARM_pc &= ~(MODE_MASK | PSR_F_BIT | PSR_I_BIT); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | extern void show_regs(struct pt_regs *); | ||
95 | |||
96 | #define predicate(x) (x & 0xf0000000) | ||
97 | #define PREDICATE_ALWAYS 0xe0000000 | ||
98 | |||
99 | #endif /* __KERNEL__ */ | ||
100 | |||
101 | #endif /* __ASSEMBLY__ */ | ||
102 | |||
103 | #endif | ||
104 | |||