1 |
24 |
jeremybenn |
/* dbg_rdi.h -- ARMulator RDI interface: ARM6 Instruction Emulator.
|
2 |
|
|
Copyright (C) 1994 Advanced RISC Machines Ltd.
|
3 |
|
|
|
4 |
|
|
This program is free software; you can redistribute it and/or modify
|
5 |
|
|
it under the terms of the GNU General Public License as published by
|
6 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
7 |
|
|
(at your option) any later version.
|
8 |
|
|
|
9 |
|
|
This program is distributed in the hope that it will be useful,
|
10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
You should have received a copy of the GNU General Public License
|
15 |
|
|
along with this program; if not, write to the Free Software
|
16 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
17 |
|
|
|
18 |
|
|
#ifndef dbg_rdi__h
|
19 |
|
|
#define dbg_rdi__h
|
20 |
|
|
|
21 |
|
|
/***************************************************************************\
|
22 |
|
|
* Error Codes *
|
23 |
|
|
\***************************************************************************/
|
24 |
|
|
|
25 |
|
|
#define RDIError_NoError 0
|
26 |
|
|
|
27 |
|
|
#define RDIError_Reset 1
|
28 |
|
|
#define RDIError_UndefinedInstruction 2
|
29 |
|
|
#define RDIError_SoftwareInterrupt 3
|
30 |
|
|
#define RDIError_PrefetchAbort 4
|
31 |
|
|
#define RDIError_DataAbort 5
|
32 |
|
|
#define RDIError_AddressException 6
|
33 |
|
|
#define RDIError_IRQ 7
|
34 |
|
|
#define RDIError_FIQ 8
|
35 |
|
|
#define RDIError_Error 9
|
36 |
|
|
#define RDIError_BranchThrough0 10
|
37 |
|
|
|
38 |
|
|
#define RDIError_NotInitialised 128
|
39 |
|
|
#define RDIError_UnableToInitialise 129
|
40 |
|
|
#define RDIError_WrongByteSex 130
|
41 |
|
|
#define RDIError_UnableToTerminate 131
|
42 |
|
|
#define RDIError_BadInstruction 132
|
43 |
|
|
#define RDIError_IllegalInstruction 133
|
44 |
|
|
#define RDIError_BadCPUStateSetting 134
|
45 |
|
|
#define RDIError_UnknownCoPro 135
|
46 |
|
|
#define RDIError_UnknownCoProState 136
|
47 |
|
|
#define RDIError_BadCoProState 137
|
48 |
|
|
#define RDIError_BadPointType 138
|
49 |
|
|
#define RDIError_UnimplementedType 139
|
50 |
|
|
#define RDIError_BadPointSize 140
|
51 |
|
|
#define RDIError_UnimplementedSize 141
|
52 |
|
|
#define RDIError_NoMorePoints 142
|
53 |
|
|
#define RDIError_BreakpointReached 143
|
54 |
|
|
#define RDIError_WatchpointAccessed 144
|
55 |
|
|
#define RDIError_NoSuchPoint 145
|
56 |
|
|
#define RDIError_ProgramFinishedInStep 146
|
57 |
|
|
#define RDIError_UserInterrupt 147
|
58 |
|
|
#define RDIError_CantSetPoint 148
|
59 |
|
|
#define RDIError_IncompatibleRDILevels 149
|
60 |
|
|
|
61 |
|
|
#define RDIError_CantLoadConfig 150
|
62 |
|
|
#define RDIError_BadConfigData 151
|
63 |
|
|
#define RDIError_NoSuchConfig 152
|
64 |
|
|
#define RDIError_BufferFull 153
|
65 |
|
|
#define RDIError_OutOfStore 154
|
66 |
|
|
#define RDIError_NotInDownload 155
|
67 |
|
|
#define RDIError_PointInUse 156
|
68 |
|
|
#define RDIError_BadImageFormat 157
|
69 |
|
|
#define RDIError_TargetRunning 158
|
70 |
|
|
|
71 |
|
|
#define RDIError_LittleEndian 240
|
72 |
|
|
#define RDIError_BigEndian 241
|
73 |
|
|
#define RDIError_SoftInitialiseError 242
|
74 |
|
|
|
75 |
|
|
#define RDIError_InsufficientPrivilege 253
|
76 |
|
|
#define RDIError_UnimplementedMessage 254
|
77 |
|
|
#define RDIError_UndefinedMessage 255
|
78 |
|
|
|
79 |
|
|
/***************************************************************************\
|
80 |
|
|
* RDP Message Numbers *
|
81 |
|
|
\***************************************************************************/
|
82 |
|
|
|
83 |
|
|
#define RDP_Start (unsigned char)0x0
|
84 |
|
|
#define RDP_End (unsigned char)0x1
|
85 |
|
|
#define RDP_Read (unsigned char)0x2
|
86 |
|
|
#define RDP_Write (unsigned char)0x3
|
87 |
|
|
#define RDP_CPUread (unsigned char)0x4
|
88 |
|
|
#define RDP_CPUwrite (unsigned char)0x5
|
89 |
|
|
#define RDP_CPread (unsigned char)0x6
|
90 |
|
|
#define RDP_CPwrite (unsigned char)0x7
|
91 |
|
|
#define RDP_SetBreak (unsigned char)0xa
|
92 |
|
|
#define RDP_ClearBreak (unsigned char)0xb
|
93 |
|
|
#define RDP_SetWatch (unsigned char)0xc
|
94 |
|
|
#define RDP_ClearWatch (unsigned char)0xd
|
95 |
|
|
#define RDP_Execute (unsigned char)0x10
|
96 |
|
|
#define RDP_Step (unsigned char)0x11
|
97 |
|
|
#define RDP_Info (unsigned char)0x12
|
98 |
|
|
#define RDP_OSOpReply (unsigned char)0x13
|
99 |
|
|
|
100 |
|
|
#define RDP_AddConfig (unsigned char)0x14
|
101 |
|
|
#define RDP_LoadConfigData (unsigned char)0x15
|
102 |
|
|
#define RDP_SelectConfig (unsigned char)0x16
|
103 |
|
|
#define RDP_LoadAgent (unsigned char)0x17
|
104 |
|
|
|
105 |
|
|
#define RDP_Stopped (unsigned char)0x20
|
106 |
|
|
#define RDP_OSOp (unsigned char)0x21
|
107 |
|
|
#define RDP_Fatal (unsigned char)0x5e
|
108 |
|
|
#define RDP_Return (unsigned char)0x5f
|
109 |
|
|
#define RDP_Reset (unsigned char)0x7f
|
110 |
|
|
|
111 |
|
|
/***************************************************************************\
|
112 |
|
|
* Other RDI values *
|
113 |
|
|
\***************************************************************************/
|
114 |
|
|
|
115 |
|
|
#define RDISex_Little 0 /* the byte sex of the debuggee */
|
116 |
|
|
#define RDISex_Big 1
|
117 |
|
|
#define RDISex_DontCare 2
|
118 |
|
|
|
119 |
|
|
#define RDIPoint_EQ 0 /* the different types of break/watchpoints */
|
120 |
|
|
#define RDIPoint_GT 1
|
121 |
|
|
#define RDIPoint_GE 2
|
122 |
|
|
#define RDIPoint_LT 3
|
123 |
|
|
#define RDIPoint_LE 4
|
124 |
|
|
#define RDIPoint_IN 5
|
125 |
|
|
#define RDIPoint_OUT 6
|
126 |
|
|
#define RDIPoint_MASK 7
|
127 |
|
|
|
128 |
|
|
#define RDIPoint_Inquiry 64 /* ORRed with point type in extended RDP */
|
129 |
|
|
#define RDIPoint_Handle 128 /* messages */
|
130 |
|
|
|
131 |
|
|
#define RDIWatch_ByteRead 1 /* types of data accesses to watch for */
|
132 |
|
|
#define RDIWatch_HalfRead 2
|
133 |
|
|
#define RDIWatch_WordRead 4
|
134 |
|
|
#define RDIWatch_ByteWrite 8
|
135 |
|
|
#define RDIWatch_HalfWrite 16
|
136 |
|
|
#define RDIWatch_WordWrite 32
|
137 |
|
|
|
138 |
|
|
#define RDIReg_R15 (1L << 15) /* mask values for CPU */
|
139 |
|
|
#define RDIReg_PC (1L << 16)
|
140 |
|
|
#define RDIReg_CPSR (1L << 17)
|
141 |
|
|
#define RDIReg_SPSR (1L << 18)
|
142 |
|
|
#define RDINumCPURegs 19
|
143 |
|
|
|
144 |
|
|
#define RDINumCPRegs 10 /* current maximum */
|
145 |
|
|
|
146 |
|
|
#define RDIMode_Curr 255
|
147 |
|
|
|
148 |
|
|
/* Bits set in return value from RDIInfo_Target */
|
149 |
|
|
#define RDITarget_LogSpeed 0x0f
|
150 |
|
|
#define RDITarget_HW 0x10 /* else emulator */
|
151 |
|
|
#define RDITarget_AgentMaxLevel 0xe0
|
152 |
|
|
#define RDITarget_AgentLevelShift 5
|
153 |
|
|
#define RDITarget_DebuggerMinLevel 0x700
|
154 |
|
|
#define RDITarget_DebuggerLevelShift 8
|
155 |
|
|
#define RDITarget_CanReloadAgent 0x800
|
156 |
|
|
#define RDITarget_CanInquireLoadSize 0x1000
|
157 |
|
|
|
158 |
|
|
/* Bits set in return value from RDIInfo_Step */
|
159 |
|
|
#define RDIStep_Multiple 1
|
160 |
|
|
#define RDIStep_PCChange 2
|
161 |
|
|
#define RDIStep_Single 4
|
162 |
|
|
|
163 |
|
|
/* Bits set in return value from RDIInfo_Points */
|
164 |
|
|
#define RDIPointCapability_Comparison 1
|
165 |
|
|
#define RDIPointCapability_Range 2
|
166 |
|
|
/* 4 to 128 are RDIWatch_xx{Read,Write} left-shifted by two */
|
167 |
|
|
#define RDIPointCapability_Mask 256
|
168 |
|
|
#define RDIPointCapability_Status 512 /* Point status enquiries available */
|
169 |
|
|
|
170 |
|
|
/* RDI_Info subcodes */
|
171 |
|
|
#define RDIInfo_Target 0
|
172 |
|
|
#define RDIInfo_Points 1
|
173 |
|
|
#define RDIInfo_Step 2
|
174 |
|
|
#define RDIInfo_MMU 3
|
175 |
|
|
#define RDIInfo_DownLoad 4 /* Inquires whether configuration download
|
176 |
|
|
and selection is available.
|
177 |
|
|
*/
|
178 |
|
|
#define RDIInfo_SemiHosting 5 /* Inquires whether RDISemiHosting_* RDI_Info
|
179 |
|
|
calls are available.
|
180 |
|
|
*/
|
181 |
|
|
#define RDIInfo_CoPro 6 /* Inquires whether CoPro RDI_Info calls are
|
182 |
|
|
available.
|
183 |
|
|
*/
|
184 |
|
|
#define RDIInfo_Icebreaker 7
|
185 |
|
|
|
186 |
|
|
/* The next two are only to be used if the value returned by RDIInfo_Points */
|
187 |
|
|
/* has RDIPointCapability_Status set. */
|
188 |
|
|
#define RDIPointStatus_Watch 0x80
|
189 |
|
|
#define RDIPointStatus_Break 0x81
|
190 |
|
|
|
191 |
|
|
#define RDISignal_Stop 0x100
|
192 |
|
|
|
193 |
|
|
#define RDIVector_Catch 0x180
|
194 |
|
|
|
195 |
|
|
/* The next four are only to be used if RDIInfo_Semihosting returned no error */
|
196 |
|
|
#define RDISemiHosting_SetState 0x181
|
197 |
|
|
#define RDISemiHosting_GetState 0x182
|
198 |
|
|
#define RDISemiHosting_SetVector 0x183
|
199 |
|
|
#define RDISemiHosting_GetVector 0x184
|
200 |
|
|
|
201 |
|
|
/* The next two are only to be used if RDIInfo_Icebreaker returned no error */
|
202 |
|
|
#define RDIIcebreaker_GetLocks 0x185
|
203 |
|
|
#define RDIIcebreaker_SetLocks 0x186
|
204 |
|
|
|
205 |
|
|
/* Only if RDIInfo_Target returned RDITarget_CanInquireLoadSize */
|
206 |
|
|
#define RDIInfo_GetLoadSize 0x187
|
207 |
|
|
|
208 |
|
|
#define RDICycles 0x200
|
209 |
|
|
#define RDICycles_Size 48
|
210 |
|
|
#define RDIErrorP 0x201
|
211 |
|
|
|
212 |
|
|
#define RDISet_Cmdline 0x300
|
213 |
|
|
#define RDISet_RDILevel 0x301
|
214 |
|
|
#define RDISet_Thread 0x302
|
215 |
|
|
|
216 |
|
|
/* The next two are only to be used if RDIInfo_CoPro returned no error */
|
217 |
|
|
#define RDIInfo_DescribeCoPro 0x400
|
218 |
|
|
#define RDIInfo_RequestCoProDesc 0x401
|
219 |
|
|
|
220 |
|
|
#define RDIInfo_Log 0x800
|
221 |
|
|
#define RDIInfo_SetLog 0x801
|
222 |
|
|
|
223 |
|
|
typedef unsigned long PointHandle;
|
224 |
|
|
typedef unsigned long ThreadHandle;
|
225 |
|
|
#define RDINoPointHandle ((PointHandle)-1L)
|
226 |
|
|
#define RDINoHandle ((ThreadHandle)-1L)
|
227 |
|
|
|
228 |
|
|
struct Dbg_ConfigBlock;
|
229 |
|
|
struct Dbg_HostosInterface;
|
230 |
|
|
struct Dbg_MCState;
|
231 |
|
|
typedef int rdi_open_proc (unsigned type,
|
232 |
|
|
struct Dbg_ConfigBlock const *config,
|
233 |
|
|
struct Dbg_HostosInterface const *i,
|
234 |
|
|
struct Dbg_MCState *dbg_state);
|
235 |
|
|
typedef int rdi_close_proc (void);
|
236 |
|
|
typedef int rdi_read_proc (ARMword source, void *dest, unsigned *nbytes);
|
237 |
|
|
typedef int rdi_write_proc (const void *source, ARMword dest,
|
238 |
|
|
unsigned *nbytes);
|
239 |
|
|
typedef int rdi_CPUread_proc (unsigned mode, unsigned long mask,
|
240 |
|
|
ARMword * state);
|
241 |
|
|
typedef int rdi_CPUwrite_proc (unsigned mode, unsigned long mask,
|
242 |
|
|
ARMword const *state);
|
243 |
|
|
typedef int rdi_CPread_proc (unsigned CPnum, unsigned long mask,
|
244 |
|
|
ARMword * state);
|
245 |
|
|
typedef int rdi_CPwrite_proc (unsigned CPnum, unsigned long mask,
|
246 |
|
|
ARMword const *state);
|
247 |
|
|
typedef int rdi_setbreak_proc (ARMword address, unsigned type, ARMword bound,
|
248 |
|
|
PointHandle * handle);
|
249 |
|
|
typedef int rdi_clearbreak_proc (PointHandle handle);
|
250 |
|
|
typedef int rdi_setwatch_proc (ARMword address, unsigned type,
|
251 |
|
|
unsigned datatype, ARMword bound,
|
252 |
|
|
PointHandle * handle);
|
253 |
|
|
typedef int rdi_clearwatch_proc (PointHandle handle);
|
254 |
|
|
typedef int rdi_execute_proc (PointHandle * handle);
|
255 |
|
|
typedef int rdi_step_proc (unsigned ninstr, PointHandle * handle);
|
256 |
|
|
typedef int rdi_info_proc (unsigned type, ARMword * arg1, ARMword * arg2);
|
257 |
|
|
typedef int rdi_pointinq_proc (ARMword * address, unsigned type,
|
258 |
|
|
unsigned datatype, ARMword * bound);
|
259 |
|
|
|
260 |
|
|
typedef enum
|
261 |
|
|
{
|
262 |
|
|
RDI_ConfigCPU,
|
263 |
|
|
RDI_ConfigSystem
|
264 |
|
|
}
|
265 |
|
|
RDI_ConfigAspect;
|
266 |
|
|
|
267 |
|
|
typedef enum
|
268 |
|
|
{
|
269 |
|
|
RDI_MatchAny,
|
270 |
|
|
RDI_MatchExactly,
|
271 |
|
|
RDI_MatchNoEarlier
|
272 |
|
|
}
|
273 |
|
|
RDI_ConfigMatchType;
|
274 |
|
|
|
275 |
|
|
typedef int rdi_addconfig_proc (unsigned long nbytes);
|
276 |
|
|
typedef int rdi_loadconfigdata_proc (unsigned long nbytes, char const *data);
|
277 |
|
|
typedef int rdi_selectconfig_proc (RDI_ConfigAspect aspect, char const *name,
|
278 |
|
|
RDI_ConfigMatchType matchtype,
|
279 |
|
|
unsigned versionreq, unsigned *versionp);
|
280 |
|
|
|
281 |
|
|
typedef char *getbufferproc (void *getbarg, unsigned long *sizep);
|
282 |
|
|
typedef int rdi_loadagentproc (ARMword dest, unsigned long size,
|
283 |
|
|
getbufferproc * getb, void *getbarg);
|
284 |
|
|
|
285 |
|
|
typedef struct
|
286 |
|
|
{
|
287 |
|
|
int itemmax;
|
288 |
|
|
char const *const *names;
|
289 |
|
|
}
|
290 |
|
|
RDI_NameList;
|
291 |
|
|
|
292 |
|
|
typedef RDI_NameList const *rdi_namelistproc (void);
|
293 |
|
|
|
294 |
|
|
typedef int rdi_errmessproc (char *buf, int buflen, int errno);
|
295 |
|
|
|
296 |
|
|
struct RDIProcVec
|
297 |
|
|
{
|
298 |
|
|
char rditypename[12];
|
299 |
|
|
|
300 |
|
|
rdi_open_proc *open;
|
301 |
|
|
rdi_close_proc *close;
|
302 |
|
|
rdi_read_proc *read;
|
303 |
|
|
rdi_write_proc *write;
|
304 |
|
|
rdi_CPUread_proc *CPUread;
|
305 |
|
|
rdi_CPUwrite_proc *CPUwrite;
|
306 |
|
|
rdi_CPread_proc *CPread;
|
307 |
|
|
rdi_CPwrite_proc *CPwrite;
|
308 |
|
|
rdi_setbreak_proc *setbreak;
|
309 |
|
|
rdi_clearbreak_proc *clearbreak;
|
310 |
|
|
rdi_setwatch_proc *setwatch;
|
311 |
|
|
rdi_clearwatch_proc *clearwatch;
|
312 |
|
|
rdi_execute_proc *execute;
|
313 |
|
|
rdi_step_proc *step;
|
314 |
|
|
rdi_info_proc *info;
|
315 |
|
|
/* V2 RDI */
|
316 |
|
|
rdi_pointinq_proc *pointinquiry;
|
317 |
|
|
|
318 |
|
|
/* These three useable only if RDIInfo_DownLoad returns no error */
|
319 |
|
|
rdi_addconfig_proc *addconfig;
|
320 |
|
|
rdi_loadconfigdata_proc *loadconfigdata;
|
321 |
|
|
rdi_selectconfig_proc *selectconfig;
|
322 |
|
|
|
323 |
|
|
rdi_namelistproc *drivernames;
|
324 |
|
|
rdi_namelistproc *cpunames;
|
325 |
|
|
|
326 |
|
|
rdi_errmessproc *errmess;
|
327 |
|
|
|
328 |
|
|
/* Only if RDIInfo_Target returns a value with RDITarget_LoadAgent set */
|
329 |
|
|
rdi_loadagentproc *loadagent;
|
330 |
|
|
};
|
331 |
|
|
|
332 |
|
|
#endif
|
333 |
|
|
|
334 |
|
|
extern unsigned int swi_mask;
|
335 |
|
|
|
336 |
|
|
#define SWI_MASK_DEMON (1 << 0)
|
337 |
|
|
#define SWI_MASK_ANGEL (1 << 1)
|
338 |
|
|
#define SWI_MASK_REDBOOT (1 << 2)
|