* bcache.c, bcache.h: New files to implement a byte cache.
[deliverable/binutils-gdb.git] / gdb / config / arc / tm-arc.h
1 /* Parameters for target machine ARC, for GDB, the GNU debugger.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 /* Used by arc-tdep.c to set the default cpu type. */
22 #define DEFAULT_ARC_CPU_TYPE "base"
23
24 /* Byte order is selectable. */
25 #define TARGET_BYTE_ORDER_SELECTABLE
26
27 /* We have IEEE floating point, if we have any float at all. */
28 #define IEEE_FLOAT
29
30 /* Offset from address of function to start of its code.
31 Zero on most machines. */
32 #define FUNCTION_START_OFFSET 0
33
34 /* Advance PC across any function entry prologue instructions
35 to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances
36 the PC past some of the prologue, but stops as soon as it
37 knows that the function has a frame. Its result is equal
38 to its input PC if the function is frameless, unequal otherwise. */
39
40 #define SKIP_PROLOGUE(pc) \
41 { pc = skip_prologue (pc, 0); }
42 #define SKIP_PROLOGUE_FRAMELESS_P(pc) \
43 { pc = skip_prologue (pc, 1); }
44 extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
45
46 /* Sequence of bytes for breakpoint instruction.
47 ??? The current value is "sr -1,[-1]" and is for the simulator only.
48 The simulator watches for this and does the right thing.
49 The hardware version will have to associate with each breakpoint
50 the sequence "flag 1; nop; nop; nop". IE: The breakpoint insn will not
51 be a fixed set of bits but instead will be a branch to a semi-random
52 address. Presumably this will be cleaned up for "second silicon". */
53 #define BIG_BREAKPOINT { 0x12, 0x1f, 0xff, 0xff }
54 #define LITTLE_BREAKPOINT { 0xff, 0xff, 0x1f, 0x12 }
55
56 /* ??? This value may eventually be correct (if/when proper breakpoints
57 are added). Until then no value is correct so leave as is and cope. */
58 #define DECR_PC_AFTER_BREAK 8
59
60 /* We don't have a reliable single step facility.
61 ??? We do have a cycle single step facility, but that won't work. */
62 #define NO_SINGLE_STEP
63 extern int one_stepped;
64 extern void single_step PARAMS ((int));
65
66 /* Given a pc value as defined by the hardware, return the real address.
67 Remember that on the ARC blink contains that status register which
68 includes PC + flags (so we have to mask out the flags). */
69 #define ARC_PC_TO_REAL_ADDRESS(pc) (((pc) & 0xffffff) << 2)
70
71 /* Immediately after a function call, return the saved pc.
72 Can't always go through the frames for this because on some machines
73 the new frame is not set up until the new function
74 executes some instructions. */
75
76 #define SAVED_PC_AFTER_CALL(frame) \
77 (ARC_PC_TO_REAL_ADDRESS (read_register (BLINK_REGNUM)))
78
79 /* Stack grows upward */
80
81 #define INNER_THAN <
82
83 /* Nonzero if instruction at pc is a return instruction.
84 This is the "j [blink]" insn (with or without conditionals or delay
85 slots). */
86
87 #define ABOUT_TO_RETURN(pc) \
88 ((read_memory_integer(pc, 4) & 0xffffff80) == 0x380f8000)
89
90 /* Say how long (ordinary) registers are. This is a piece of bogosity
91 used in push_word and a few other places; REGISTER_RAW_SIZE is the
92 real way to know how big a register is. */
93 #define REGISTER_SIZE 4
94
95 /* Number of machine registers */
96 #define NUM_REGS 92
97
98 /* Initializer for an array of names of registers.
99 There should be NUM_REGS strings in this initializer. */
100
101 #define REGISTER_NAMES \
102 { \
103 /* 0 */ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
104 /* 8 */ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
105 /* 16 */ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
106 /* 24 */ "r24", "r25", "r26", "fp", "sp", "ilink1", "ilink2", "blink", \
107 /* 32 */ "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
108 /* 40 */ "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \
109 /* 48 */ "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
110 /* 56 */ "r56", "mlo", "mmid", "mhi", "lp_count", \
111 /* 61 */ "status", "sema", "lp_start", "lp_end", "identity", "debug", \
112 /* 67 */ "aux10", "aux11", "aux12", "aux13", "aux14", \
113 /* 72 */ "aux15", "aux16", "aux17", "aux18", "aux19", \
114 /* 77 */ "aux1a", "aux1b", "aux1c", "aux1d", "aux1e", \
115 /* 82 */ "aux1f", "aux20", "aux21", "aux22", \
116 /* 86 */ "aux30", "aux31", "aux32", "aux33", "aux40", \
117 /* 91 */ "pc" \
118 }
119
120 /* Register numbers of various important registers (used to index
121 into arrays of register names and register values). */
122
123 #define R0_REGNUM 0 /* First local register */
124 #define R59_REGNUM 59 /* Last local register */
125 #define FP_REGNUM 27 /* Contains address of executing stack frame */
126 #define SP_REGNUM 28 /* stack pointer */
127 #define BLINK_REGNUM 31 /* link register */
128 #define STA_REGNUM 61 /* processor status word */
129 #define PC_REGNUM 91 /* instruction pointer */
130 #define AUX_BEG_REGNUM 61 /* aux reg begins */
131 #define AUX_END_REGNUM 90 /* aux reg ends, pc not real aux reg */
132
133 /* Fake registers used to mark immediate data. */
134 #define SHIMM_FLAG_REGNUM 61
135 #define LIMM_REGNUM 62
136 #define SHIMM_REGNUM 63
137
138 #define AUX_REG_MAP \
139 { \
140 { 0, 1, 2, 3, 4, 5, \
141 16, -1, -1, -1, -1, \
142 -1, -1, -1, -1, -1, \
143 -1, -1, -1, -1, 30, \
144 -1, 32, 33, -1, \
145 48, 49, 50, 51, 64, \
146 0 \
147 }, \
148 { 0, 1, 2, 3, 4, 5, \
149 16, -1, -1, -1, -1, \
150 -1, -1, -1, -1, -1, \
151 -1, -1, -1, -1, 30, \
152 31, 32, 33, -1, \
153 -1, -1, -1, -1, -1, \
154 0 \
155 }, \
156 { 0, 1, 2, 3, 4, 5, \
157 16, 17, 18, 19, 20, \
158 21, 22, 23, 24, 25, \
159 26, 27, 28, 29, 30, \
160 31, 32, 33, 34, \
161 -1, -1, -1, -1, -1, \
162 0 \
163 } \
164 }
165
166 #define PFP_REGNUM R0_REGNUM /* Previous frame pointer */
167
168 /* Total amount of space needed to store our copies of the machine's
169 register state, the array `registers'. */
170 #define REGISTER_BYTES (NUM_REGS * 4)
171
172 /* Index within `registers' of the first byte of the space for register N. */
173 #define REGISTER_BYTE(N) (4*(N))
174
175 /* Number of bytes of storage in the actual machine representation
176 for register N. */
177 #define REGISTER_RAW_SIZE(N) 4
178
179 /* Number of bytes of storage in the program's representation for register N. */
180 #define REGISTER_VIRTUAL_SIZE(N) 4
181
182 /* Largest value REGISTER_RAW_SIZE can have. */
183 #define MAX_REGISTER_RAW_SIZE 4
184
185 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
186 #define MAX_REGISTER_VIRTUAL_SIZE 4
187
188 /* Return the GDB type object for the "standard" data type
189 of data in register N. */
190 #define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
191
192 \f
193 /* Macros for understanding function return values... */
194
195 /* Does the specified function use the "struct returning" convention
196 or the "value returning" convention? The "value returning" convention
197 almost invariably returns the entire value in registers. The
198 "struct returning" convention often returns the entire value in
199 memory, and passes a pointer (out of or into the function) saying
200 where the value (is or should go).
201
202 Since this sometimes depends on whether it was compiled with GCC,
203 this is also an argument. This is used in call_function to build a
204 stack, and in value_being_returned to print return values.
205
206 On arc, a structure is always retunred with pointer in r0. */
207
208 #define USE_STRUCT_CONVENTION(gcc_p, type) 1
209
210 /* Extract from an array REGBUF containing the (raw) register state
211 a function return value of type TYPE, and copy that, in virtual format,
212 into VALBUF. This is only called if USE_STRUCT_CONVENTION for this
213 type is 0.
214 */
215 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
216 memcpy(VALBUF, REGBUF+REGISTER_BYTE(R0_REGNUM), TYPE_LENGTH (TYPE))
217
218 /* If USE_STRUCT_CONVENTION produces a 1,
219 extract from an array REGBUF containing the (raw) register state
220 the address in which a function should return its structure value,
221 as a CORE_ADDR (or an expression that can be used as one). */
222 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
223 (error("Don't know where large structure is returned on arc"), 0)
224
225 /* Write into appropriate registers a function return value
226 of type TYPE, given in virtual format, for "value returning" functions.
227 For 'return' command: not (yet) implemented for arc. */
228 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
229 error ("Returning values from functions is not implemented in arc gdb")
230
231 /* Store the address of the place in which to copy the structure the
232 subroutine will return. This is called from call_function. */
233 #define STORE_STRUCT_RETURN(ADDR, SP) \
234 error ("Returning values from functions is not implemented in arc gdb")
235
236 \f
237 /* Describe the pointer in each stack frame to the previous stack frame
238 (its caller). */
239
240 /* We cache information about saved registers in the frame structure,
241 to save us from having to re-scan function prologues every time
242 a register in a non-current frame is accessed. */
243
244 #define EXTRA_FRAME_INFO \
245 struct frame_saved_regs *fsr; \
246 CORE_ADDR arg_pointer;
247
248 /* Zero the frame_saved_regs pointer when the frame is initialized,
249 so that FRAME_FIND_SAVED_REGS () will know to allocate and
250 initialize a frame_saved_regs struct the first time it is called.
251 Set the arg_pointer to -1, which is not valid; 0 and other values
252 indicate real, cached values. */
253
254 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
255 ((fi)->fsr = 0, (fi)->arg_pointer = -1)
256
257 /* FRAME_CHAIN takes a frame's nominal address
258 and produces the frame's chain-pointer.
259 However, if FRAME_CHAIN_VALID returns zero,
260 it means the given frame is the outermost one and has no caller. */
261 /* On the arc, we get the chain pointer by reading the PFP saved
262 on the stack. */
263 /* The PFP and RPC is in fp and fp+4. */
264
265 #define FRAME_CHAIN(thisframe) \
266 (read_memory_integer (FRAME_FP (thisframe), 4))
267
268 /* FRAME_CHAIN_VALID returns zero if the given frame is the outermost one
269 and has no caller. */
270 #define FRAME_CHAIN_VALID(chain, thisframe) ((chain) != 0)
271
272 /* A macro that tells us whether the function invocation represented
273 by FI does not have a frame on the stack associated with it. If it
274 does not, FRAMELESS is set to 1, else 0. */
275
276 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
277 do { \
278 if ((FI)->signal_handler_caller) \
279 (FRAMELESS) = 0; \
280 else \
281 (FRAMELESS) = frameless_look_for_prologue (FI); \
282 } while (0)
283
284 /* Where is the PC for a specific frame.
285 A leaf function may never save blink, so we have to check for that here. */
286
287 #define FRAME_SAVED_PC(frame) (arc_frame_saved_pc (frame))
288 struct frame_info; /* in case frame.h not included yet */
289 CORE_ADDR arc_frame_saved_pc PARAMS ((struct frame_info *));
290
291 /* If the argument is on the stack, it will be here.
292 We cache this value in the frame info if we've already looked it up. */
293 /* ??? Is the arg_pointer check necessary? */
294
295 #define FRAME_ARGS_ADDRESS(fi) \
296 (((fi)->arg_pointer != -1) ? (fi)->arg_pointer : (fi)->frame)
297
298 /* This is the same except it should return 0 when
299 it does not really know where the args are, rather than guessing.
300 This value is not cached since it is only used infrequently. */
301
302 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
303
304 /* Set NUMARGS to the number of args passed to a frame.
305 Can return -1, meaning no way to tell. */
306
307 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
308
309 /* Return number of bytes at start of arglist that are not really args. */
310
311 #define FRAME_ARGS_SKIP 0
312
313 /* Produce the positions of the saved registers in a stack frame. */
314
315 #define FRAME_FIND_SAVED_REGS(frame_info_addr, sr) \
316 frame_find_saved_regs (frame_info_addr, &sr)
317 extern void frame_find_saved_regs(); /* See arc-tdep.c */
318
319 \f
320 /* Things needed for making calls to functions in the inferior process */
321 #define PUSH_DUMMY_FRAME \
322 push_dummy_frame ()
323
324 /* Discard from the stack the innermost frame, restoring all registers. */
325 #define POP_FRAME \
326 pop_frame ()
327
328 /* This sequence of words is the instructions bl xxxx, flag 1 */
329 #define CALL_DUMMY { 0x28000000, 0x1fbe8001 }
330 #define CALL_DUMMY_LENGTH 8
331
332 /* Start execution at beginning of dummy */
333 #define CALL_DUMMY_START_OFFSET 0
334
335 /* Insert the specified number of args and function address
336 into a call sequence of the above form stored at 'dummyname'.*/
337 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
338 { \
339 int from, to, delta, loc; \
340 loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
341 from = loc + 4; \
342 to = (int)(fun); \
343 delta = (to - from) >> 2; \
344 *((char *)(dummyname) + 1) = (delta & 0x1); \
345 *((char *)(dummyname) + 2) = ((delta >> 1) & 0xff); \
346 *((char *)(dummyname) + 3) = ((delta >> 9) & 0xff); \
347 *((char *)(dummyname) + 4) = ((delta >> 17) & 0x7); \
348 }
349
This page took 0.036003 seconds and 4 git commands to generate.