]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/tm-i860.h
* breakpoint.c (breakpoint_re_set): Select a default source
[thirdparty/binutils-gdb.git] / gdb / tm-i860.h
1 /* Parameters for execution on the Intel I860 for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
3
4 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5 WARRANTY. No author or distributor accepts responsibility to anyone
6 for the consequences of using it or for whether it serves any
7 particular purpose or works at all, unless he says so in writing.
8 Refer to the GDB General Public License for full details.
9
10 Everyone is granted permission to copy, modify and redistribute GDB,
11 but only under the conditions described in the GDB General Public
12 License. A copy of this license is supposed to have been given to you
13 along with GDB so you can know your rights and responsibilities. It
14 should be in a file named COPYING. Among other things, the copyright
15 notice and this notice must be preserved on all copies.
16
17 In other words, go ahead and share GDB, but don't try to stop
18 anyone else from sharing it farther. Help stamp out software hoarding!
19 */
20
21 #ifndef i860
22 #define i860 1
23 #endif
24
25 #define HAVE_TERMIO
26 #define vfork fork
27
28 /* Debugger information will be in COFF format. */
29
30 /* #define COFF_FORMAT */
31 #define COFF_NO_LONG_FILE_NAMES
32
33 /* Offset from address of function to start of its code.
34 Zero on most machines. */
35
36 #define FUNCTION_START_OFFSET 0
37
38 /* The call instruction puts its return address in register r1 and does
39 not change the stack pointer */
40
41 #define RETURN_ADDR_IN_REGISTER
42
43 /* Advance PC across any function entry prologue instructions
44 to reach some "real" code. */
45
46 #define SKIP_PROLOGUE(pc) \
47 { pc = skip_prologue (pc); }
48
49 /* Immediately after a function call, return the saved pc.
50 Can't go through the frames for this because on some machines
51 the new frame is not set up until the new function executes
52 some instructions. */
53
54 #define SAVED_PC_AFTER_CALL(frame) \
55 (read_register(RP_REGNUM))
56
57 /* Address of end of stack space. */
58
59 #define STACK_END_ADDR 0xfc000000
60
61 /* Stack grows downward. */
62
63 #define INNER_THAN <
64
65 /* Stack has strict alignment. */
66
67 #define ALIGN_STACK(ADDR) (((ADDR)+15)&-16)
68
69
70 /* Sequence of bytes for breakpoint instruction. */
71 #if defined(i860) && defined(BIG_ENDIAN)
72 #define BREAKPOINT {0x44, 0x00, 0x00, 0x00}
73 #define BREAKFLOAT {0x22, 0x06, 0x00, 0x48}
74 #else
75 #define BREAKPOINT {0x00, 0x00, 0x00, 0x44}
76 #define BREAKFLOAT {0x48, 0x00, 0x06, 0x22}
77 #endif
78 /* Amount PC must be decremented by after a breakpoint.
79 This is often the number of bytes in BREAKPOINT
80 but not always. */
81
82 #define DECR_PC_AFTER_BREAK 0
83
84 /* Nonzero if instruction at PC is a return instruction. */
85 /* should be "bri r1" */
86 #define ABOUT_TO_RETURN(pc) \
87 (adj_read_memory_integer (pc) == 0x40000800)
88
89
90 /* Return 1 if P points to an invalid floating point value. */
91
92 #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */
93
94 /* Largest integer type */
95 #define LONGEST long
96
97 /* Name of the builtin type for the LONGEST type above. */
98 #define BUILTIN_TYPE_LONGEST builtin_type_long
99
100 /* Say how long (ordinary) registers are. */
101
102 #define REGISTER_TYPE long
103
104 /* Number of machine registers */
105
106 #define NUM_REGS i860REGCOUNT
107
108 /* Initializer for an array of names of registers.
109 There should be NUM_REGS strings in this initializer. */
110 #define REGISTER_NAMES \
111 { \
112 "psr", "fir", "trap", "dbrk", \
113 "r0", "r1", "sp", "fp", "r4", "r5", "r6", "r7", \
114 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
115 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
116 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
117 \
118 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
119 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
120 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
121 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
122 \
123 "fsr", \
124 "fsr1", "fsr2", "fsr3", \
125 "mul1", "", "mul2", "", "mul3", "", \
126 "add1", "", "add2", "", "add3", "", \
127 "KI", "", "KR", "", "T", "", \
128 "MERGE", "", \
129 "pfld1", "", "", "", "pfld2", "", "", "", "pfld3", "", "", "", \
130 "graph1", "", \
131 "fpe_fp1","", "fpe_fp2", "", "fpe_fp3", "", \
132 "fpe_fp4", "", \
133 "ieee_stat", "fpe_trapped_op", \
134 "fpe_fp5","", "fpe_fp6", "", \
135 "fpe_rfsr", "","","", \
136 "epsr", \
137 "ccr", "bear", "err" \
138 }
139 /* Register numbers of various important registers.
140 Note that some of these values are "real" register numbers,
141 and correspond to the general registers of the machine,
142 and some are "phony" register numbers which are too large
143 to be actual register numbers as far as the user is concerned
144 but do serve to get the desired values when passed to read_register. */
145
146 #define RP_REGNUM R1 /* Contains return address value */
147 #define SP_REGNUM SP /* Contains address of top of stack, */
148 #define FP_REGNUM FP /* Contains address of executing stack frame */
149 /* which is also the bottom of the frame. */
150 #define RTRN RP_REGNUM
151 #define R_FP FP /* used by dwarfread.c */
152 #define Y_REGNUM R31 /* Temp register for address calc., etc. */
153 #define PC_REGNUM PC /* Contains program counter */
154 #define PS_REGNUM PSR /* Contains processor status */
155 #define FP0_REGNUM FREGS /* Floating point register 0 */
156 #define FPS_REGNUM FSR /* Floating point status register */
157 #define DB_REGNUM DB /* Debug register */
158
159 /* Total amount of space needed to store our copies of the machine's
160 register state, the array `registers'. */
161 #define REGISTER_BYTES (NUM_REGS * 4)
162
163 /* Index within `registers' of the first byte of the space for
164 register N. */
165
166 #define REGISTER_BYTE(N) ((N)*4)
167
168 /* Number of bytes of storage in the actual machine representation
169 for register N. */
170
171 /* On the i860, all regs are 4 bytes. */
172
173 #define REGISTER_RAW_SIZE(N) (4)
174
175 /* Number of bytes of storage in the program's representation
176 for register N. */
177
178 /* On the i860, all regs are 4 bytes. */
179
180 #define REGISTER_VIRTUAL_SIZE(N) (4)
181
182 /* Largest value REGISTER_RAW_SIZE can have. */
183
184 #define MAX_REGISTER_RAW_SIZE 8
185
186 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
187
188 #define MAX_REGISTER_VIRTUAL_SIZE 8
189
190 /* Nonzero if register N requires conversion
191 from raw format to virtual format. */
192
193 #define REGISTER_CONVERTIBLE(N) (0)
194
195 /* Convert data from raw format for register REGNUM
196 to virtual format for register REGNUM. */
197
198 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
199 { bcopy ((FROM), (TO), 4); }
200
201 /* Convert data from virtual format for register REGNUM
202 to raw format for register REGNUM. */
203
204 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
205 { bcopy ((FROM), (TO), 4); }
206
207 /* Return the GDB type object for the "standard" data type
208 of data in register N. */
209
210 #define REGISTER_VIRTUAL_TYPE(N) \
211 ((N) < F0 ? builtin_type_int : (N) <= F31 ? builtin_type_float : builtin_type_int)
212
213 /* Store the address of the place in which to copy the structure the
214 subroutine will return. This is called from call_function. */
215
216 #define STORE_STRUCT_RETURN(ADDR, SP) { write_register (R16, (ADDR)); }
217
218 /* Extract from an array REGBUF containing the (raw) register state
219 a function return value of type TYPE, and copy that, in virtual format,
220 into VALBUF. */
221
222 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
223 i860_extract_return_value(TYPE, REGBUF, VALBUF)
224
225 /* Write into appropriate registers a function return value
226 of type TYPE, given in virtual format. */
227 /* On i860, values are returned in register r16. */
228 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
229 i860_store_return_value(TYPE, VALBUF)
230
231 /* Extract from an array REGBUF containing the (raw) register state
232 the address in which a function should return its structure value,
233 as a CORE_ADDR (or an expression that can be used as one). */
234
235 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
236 (*(int *) ((REGBUF) + REGISTER_BYTE(R16)))
237
238 \f
239 /* Describe the pointer in each stack frame to the previous stack frame
240 (its caller). */
241 #include <sys/types.h>
242 #include <sys/regset.h>
243 #include "i860_reg.h"
244
245 /* FRAME_CHAIN takes a frame's nominal address
246 and produces the frame's chain-pointer.
247
248 FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
249 and produces the nominal address of the caller frame.
250
251 However, if FRAME_CHAIN_VALID returns zero,
252 it means the given frame is the outermost one and has no caller.
253 In that case, FRAME_CHAIN_COMBINE is not used. */
254
255 /* In the case of the i860, the frame-chain's nominal address
256 is held in the frame pointer register.
257
258 On the i860 the frame (in %fp) points to %fp for the previous frame.
259 */
260
261 /* our FRAME_CHAIN requires a pointer to all the frame info (e.g. pc)
262
263 */
264
265 #define FRAME_CHAIN(thisframe) frame_chain(thisframe)
266
267 #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
268
269 /* Define other aspects of the stack frame. */
270
271 #define FRAME_SAVED_PC(frame_struct) frame_saved_pc(frame_struct)
272
273 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
274
275 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
276
277 /* Set VAL to the number of args passed to frame described by FI.
278 Can set VAL to -1, meaning no way to tell. */
279
280 /* We can't tell how many args there are */
281
282 #define FRAME_NUM_ARGS(val,fi) (val = -1)
283
284 #define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame)
285
286 /* extra stuff in frame structure to support
287 * backtraceing thru non fp frame based frames
288 * (trace stuff thats not -g compiled)
289 */
290
291 #define EXTRA_FRAME_INFO int is_minus_g; CORE_ADDR sp; CORE_ADDR rp;
292
293 #define INIT_EXTRA_FRAME_INFO(fromleaf,fci) (fci)->is_minus_g = 0; (fci)->sp = 0; (fci)->rp = 0;
294
295 /* Return number of bytes at start of arglist that are not really args. */
296
297 #define FRAME_ARGS_SKIP 8
298
299 /* Put here the code to store, into a struct frame_saved_regs,
300 the addresses of the saved registers of frame described by FRAME_INFO.
301 This includes special registers such as pc and fp saved in special
302 ways in the stack frame. sp is even more special:
303 the address we return for it IS the sp for the next frame. */
304
305 /* Grind through the various st.l rx,Y(fp) and fst.z fx,Y(fp) */
306
307 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
308 frame_find_saved_regs(frame_info, &(frame_saved_regs))
309 \f
310 /* Things needed for making the inferior call functions. */
311
312 /* Push an empty stack frame, to record the current PC, etc. */
313 /* We have this frame with fp pointing to a block where all GDB-visible
314 registers are stored in the order GDB knows them, and sp at the next
315 alignment point below fp. Note: fp + NUM_REGS*4 was the old sp
316 */
317
318 #define PUSH_DUMMY_FRAME i860_push_frame()
319
320 /* Discard from the stack the innermost frame,
321 restoring all saved registers. */
322
323 #define POP_FRAME i860_pop_frame()
324
325 /* This sequence of words is the instructions:
326 *../
327 --
328 nop
329 calli r31
330 nop
331 trap r0,r0,r0
332 --
333 Note this is 16 bytes.
334 Saving of the registers is done by PUSH_DUMMY_FRAME. The address of the
335 function to call will be placed in register r31 prior to starting.
336 The arguments have to be put into the parameter registers by GDB after
337 the PUSH_DUMMY_FRAME is done. NOTE: GDB expects to push arguments, but
338 i860 takes them in registers */
339 #ifdef BIG_ENDIAN
340 /* account for reversal of instructions in memory */
341
342 #define CALL_DUMMY { \
343 0x4c00f802, 0xa0000000, 0x44000000, 0xa0000000 }
344 #else
345 #define CALL_DUMMY { \
346 0xa0000000, 0x4c00F802, 0xa0000000, 0x44000000 }
347 #endif
348
349 /* This setup is somewhat unusual. PUSH_DUMMY_FRAME and
350 FRAME_FIND_SAVED_REGS conspire to handle dummy frames differently.
351 Therefore, CALL_DUMMY can be minimal. We put the address of the called
352 function in r31 and let'er rip */
353
354 #define CALL_DUMMY_LENGTH 16
355
356 /* Actually start at the calli */
357
358 #define CALL_DUMMY_START_OFFSET 4
359
360 /* Normally, GDB will patch the dummy code here to put in the function
361 address, etc., but we only need to put the call adddress in r31 */
362 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
363 write_register(R31, fun)
364
365 \f
366 /* i860 has no reliable single step ptrace call */
367
368 #define NO_SINGLE_STEP 1
369
370 #define KERNEL_U_ADDR 0xfc7fe530
371 #define REGISTER_U_ADDR(addr,ar0,regno) \
372 addr = (REGISTER_BYTE(regno) + ar0 );
373
374 /* How many bytes are pushed on the stack for the argument list
375 */
376 #define STACK_ARG_BYTES(RESULT,ARGS,NARGS,STRUCT_RETURN) {(RESULT) = 0;}
377
378 /* Pass arguments to a function
379 */
380
381 #define PUSH_ARGUMENTS(NARGS,ARGS,STACKP,STRUCT_RETURN,STRUCT_ADDR) \
382 { \
383 STACKP = (STACKP) & (-16); \
384 STACKP = i860_arg_coerce(NARGS, ARGS, STRUCT_RETURN,STACKP); \
385 STACKP =pass_function_arguments(ARGS,NARGS,STRUCT_RETURN, STRUCT_ADDR, STACKP); }
386
387 #define CALL_DUMMY_LOCATION AFTER_TEXT_END
388
389 #define NEED_TEXT_START_END
390
391 #define NONSTANDARD_MEMORY_LAYOUT
392
393 /* We support pseudo-frame structure so actual frame pointer value must be
394 * read from the register.
395 */
396 #define FP_FROM_REGISTER
397
398 /* Support a quit from info register command because we have so many regs
399 */
400 #define INFO_REGISTER_QUIT
401
402 /* Identify text or absolute symbols to put in misc function table. In the
403 * i860 case, only text symbols not starting with _L00
404 */
405 #define MISC_FUNCTION(cs) ((cs)->c_secnum == 1 && (cs)->c_value && \
406 strncmp((cs)->c_name, "_L00", 4) != 0)
407
408 /* Define our a.out magic number and undefine the 386 one if it's defined
409 */
410 #ifdef I860MAGIC
411 #define AOUT_MAGIC I860MAGIC
412 #else
413 #define AOUT_MAGIC 0515
414 #endif
415
416 #ifdef I386MAGIC
417 #undef I386MAGIC
418 #endif
419
420 /* The aouthdr may be larger than defined in a.out.h
421 */
422 #define AOUTHDR_VARIABLE
423
424 /* We have a bug where lineno information is not in symbol table correctly
425 */
426 #define LINENO_BUG
427
428 /* Similarly, the Endndx of a structure definition is bogus in ld860
429 */
430 /* #define STRUCT_SYMBOL_BUG */
431
432 /* Also, we see T_ARG types when we shouldn't
433 */
434 #define T_ARG_BUG
435
436 /* Macro to sign extend to 32 bits */
437 #define SIGN_EXT(n,x) (((int) (x) << (32-n)) >> (32-n))
438
439 #define SIGN_EXT16(x) (((int) (x) << (16)) >> (16))
440
441 #define FRAMELESS_FUNCTION_INVOCATION(FI,FRAMELESS) frameless_look_for_prologue(FI)
442 #if defined(i860) && defined(BIG_ENDIAN)
443 #define ADJ_PC(pc) ((unsigned)pc ^ 4)
444 #define ADJ_FREG(freg) (F0 + (((freg) - F0) ^ 1))
445 #define ADJ_FREG_BYTE(freg) (REGISTER_BYTE(F0) + (((freg) - REGISTER_BYTE(F0)) ^ REGISTER_BYTE(1)))
446 #else
447 #define ADJ_PC(pc) (pc)
448 #define ADJ_FREG(freg) (freg)
449 #define ADJ_FREG_BYTE(freg) (freg)
450 #endif
451 /* define DO_REGISTERS_INFO to do i860-specific formatting */
452 #define DO_REGISTERS_INFO(regnum,fpregs) i860_do_registers_info(regnum,fpregs)
453 /* the two low order bits of the return pointer are ignored when returning; some systems store information
454 in them. To avoid confusing the stack trace, provide this macro to "clean" the two low order bits */
455 #define CLEAN_PC(pc) ((unsigned) pc & 0xfffffffc)
456 #define adj_target_read_memory(memaddr,myaddr,len) target_read_memory(ADJ_PC(memaddr),myaddr,len)
457 #define adj_target_write_memory(memaddr,myaddr,len) target_write_memory(ADJ_PC(memaddr),myaddr,len)
458 #define adj_read_memory_integer(memaddr) read_memory_integer(ADJ_PC(memaddr),4)
459 #define adj_read_memory(memaddr,myaddr,len) read_memory(ADJ_PC(memaddr),myaddr,len)
460 #define adj_write_memory(memaddr,myaddr,len) write_memory(ADJ_PC(memaddr),myaddr,len)
461 #define INIT_FRAME_PC(fromleaf, prev) \
462 { struct frame_info *nextframe = prev->next; \
463 if (nextframe->rp) \
464 { prev->pc = CLEAN_PC( nextframe ->rp); \
465 prev->rp = 0; } \
466 else prev->pc = CLEAN_PC((fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
467 prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ())); }
468
469 #define INTERNAL_REGISTER_VAL(regno) regno+R0
470 /* used to indicate that the misc function vector has size information about
471 misc functions -- currently true for elf format only -- mlf */
472 #define MISC_FUNCTIONS_HAS_SIZE
473 #define FRAME_GET_BASEREG_VALUE(frame,basereg) get_saved_basereg(frame, basereg);
474