1
2
3
4
5
6
7
8
9
10#ifndef __ASM_ARC_PTRACE_H
11#define __ASM_ARC_PTRACE_H
12
13#include <uapi/asm/ptrace.h>
14
15#ifndef __ASSEMBLY__
16
17
18
19#ifdef CONFIG_ISA_ARCOMPACT
20struct pt_regs {
21
22#ifdef CONFIG_ARC_PLAT_EZNPS
23 unsigned long eflags;
24 unsigned long gpa1;
25#endif
26
27
28 unsigned long bta;
29
30 unsigned long lp_start, lp_end, lp_count;
31
32 unsigned long status32;
33 unsigned long ret;
34 unsigned long blink;
35 unsigned long fp;
36 unsigned long r26;
37
38 unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
39
40 unsigned long sp;
41 unsigned long orig_r0;
42
43
44
45
46
47
48
49
50 union {
51 struct {
52#ifdef CONFIG_CPU_BIG_ENDIAN
53 unsigned long state:8, ecr_vec:8,
54 ecr_cause:8, ecr_param:8;
55#else
56 unsigned long ecr_param:8, ecr_cause:8,
57 ecr_vec:8, state:8;
58#endif
59 };
60 unsigned long event;
61 };
62
63 unsigned long user_r25;
64};
65#else
66
67struct pt_regs {
68
69 unsigned long orig_r0;
70
71 union {
72 struct {
73#ifdef CONFIG_CPU_BIG_ENDIAN
74 unsigned long state:8, ecr_vec:8,
75 ecr_cause:8, ecr_param:8;
76#else
77 unsigned long ecr_param:8, ecr_cause:8,
78 ecr_vec:8, state:8;
79#endif
80 };
81 unsigned long event;
82 };
83
84 unsigned long bta;
85
86 unsigned long user_r25;
87
88 unsigned long r26;
89 unsigned long fp;
90 unsigned long sp;
91
92 unsigned long r12, r30;
93
94#ifdef CONFIG_ARC_HAS_ACCL_REGS
95 unsigned long r58, r59;
96#endif
97
98
99 unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;
100
101 unsigned long blink;
102 unsigned long lp_end, lp_start, lp_count;
103
104 unsigned long ei, ldi, jli;
105
106 unsigned long ret;
107 unsigned long status32;
108};
109
110#endif
111
112
113
114struct callee_regs {
115 unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
116};
117
118#define instruction_pointer(regs) ((regs)->ret)
119#define profile_pc(regs) instruction_pointer(regs)
120
121
122#define user_mode(regs) (regs->status32 & STATUS_U_MASK)
123
124#define user_stack_pointer(regs)\
125({ unsigned int sp; \
126 if (user_mode(regs)) \
127 sp = (regs)->sp;\
128 else \
129 sp = -1; \
130 sp; \
131})
132
133
134#define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK)
135
136#define in_syscall(regs) ((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param)
137#define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param)
138
139#define STATE_SCALL_RESTARTED 0x01
140
141#define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED)
142#define syscall_restartable(reg) !(reg->state & STATE_SCALL_RESTARTED)
143
144#define current_pt_regs() \
145({ \
146 \
147 register unsigned long sp asm ("sp"); \
148 unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \
149 (struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \
150})
151
152static inline long regs_return_value(struct pt_regs *regs)
153{
154 return (long)regs->r0;
155}
156
157#endif
158
159#endif
160