1 /* Parameters for execution on the Intel I860 for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
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.
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.
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!
28 /* Debugger information will be in COFF format. */
30 /* #define COFF_FORMAT */
31 #define COFF_NO_LONG_FILE_NAMES
33 /* Offset from address of function to start of its code.
34 Zero on most machines. */
36 #define FUNCTION_START_OFFSET 0
38 /* The call instruction puts its return address in register r1 and does
39 not change the stack pointer */
41 #define RETURN_ADDR_IN_REGISTER
43 /* Advance PC across any function entry prologue instructions
44 to reach some "real" code. */
46 #define SKIP_PROLOGUE(pc) \
47 { pc = skip_prologue (pc); }
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
54 #define SAVED_PC_AFTER_CALL(frame) \
55 (read_register(RP_REGNUM))
57 /* Address of end of stack space. */
59 #define STACK_END_ADDR 0xfc000000
61 /* Stack grows downward. */
65 /* Stack has strict alignment. */
67 #define ALIGN_STACK(ADDR) (((ADDR)+15)&-16)
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}
75 #define BREAKPOINT {0x00, 0x00, 0x00, 0x44}
76 #define BREAKFLOAT {0x48, 0x00, 0x06, 0x22}
78 /* Amount PC must be decremented by after a breakpoint.
79 This is often the number of bytes in BREAKPOINT
82 #define DECR_PC_AFTER_BREAK 0
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)
90 /* Return 1 if P points to an invalid floating point value. */
92 #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */
94 /* Largest integer type */
97 /* Name of the builtin type for the LONGEST type above. */
98 #define BUILTIN_TYPE_LONGEST builtin_type_long
100 /* Say how long (ordinary) registers are. */
102 #define REGISTER_TYPE long
104 /* Number of machine registers */
106 #define NUM_REGS i860REGCOUNT
108 /* Initializer for an array of names of registers.
109 There should be NUM_REGS strings in this initializer. */
110 #define REGISTER_NAMES \
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", \
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", \
124 "fsr1", "fsr2", "fsr3", \
125 "mul1", "", "mul2", "", "mul3", "", \
126 "add1", "", "add2", "", "add3", "", \
127 "KI", "", "KR", "", "T", "", \
129 "pfld1", "", "", "", "pfld2", "", "", "", "pfld3", "", "", "", \
131 "fpe_fp1","", "fpe_fp2", "", "fpe_fp3", "", \
133 "ieee_stat", "fpe_trapped_op", \
134 "fpe_fp5","", "fpe_fp6", "", \
135 "fpe_rfsr", "","","", \
137 "ccr", "bear", "err" \
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. */
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 */
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)
163 /* Index within `registers' of the first byte of the space for
166 #define REGISTER_BYTE(N) ((N)*4)
168 /* Number of bytes of storage in the actual machine representation
171 /* On the i860, all regs are 4 bytes. */
173 #define REGISTER_RAW_SIZE(N) (4)
175 /* Number of bytes of storage in the program's representation
178 /* On the i860, all regs are 4 bytes. */
180 #define REGISTER_VIRTUAL_SIZE(N) (4)
182 /* Largest value REGISTER_RAW_SIZE can have. */
184 #define MAX_REGISTER_RAW_SIZE 8
186 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
188 #define MAX_REGISTER_VIRTUAL_SIZE 8
190 /* Nonzero if register N requires conversion
191 from raw format to virtual format. */
193 #define REGISTER_CONVERTIBLE(N) (0)
195 /* Convert data from raw format for register REGNUM
196 to virtual format for register REGNUM. */
198 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
199 { bcopy ((FROM), (TO), 4); }
201 /* Convert data from virtual format for register REGNUM
202 to raw format for register REGNUM. */
204 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
205 { bcopy ((FROM), (TO), 4); }
207 /* Return the GDB type object for the "standard" data type
208 of data in register N. */
210 #define REGISTER_VIRTUAL_TYPE(N) \
211 ((N) < F0 ? builtin_type_int : (N) <= F31 ? builtin_type_float : builtin_type_int)
213 /* Store the address of the place in which to copy the structure the
214 subroutine will return. This is called from call_function. */
216 #define STORE_STRUCT_RETURN(ADDR, SP) { write_register (R16, (ADDR)); }
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,
222 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
223 i860_extract_return_value(TYPE, REGBUF, VALBUF)
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)
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). */
235 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
236 (*(int *) ((REGBUF) + REGISTER_BYTE(R16)))
239 /* Describe the pointer in each stack frame to the previous stack frame
241 #include <sys/types.h>
242 #include <sys/regset.h>
243 #include "i860_reg.h"
245 /* FRAME_CHAIN takes a frame's nominal address
246 and produces the frame's chain-pointer.
248 FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
249 and produces the nominal address of the caller frame.
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. */
255 /* In the case of the i860, the frame-chain's nominal address
256 is held in the frame pointer register.
258 On the i860 the frame (in %fp) points to %fp for the previous frame.
261 /* our FRAME_CHAIN requires a pointer to all the frame info (e.g. pc)
265 #define FRAME_CHAIN(thisframe) frame_chain(thisframe)
267 #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
269 /* Define other aspects of the stack frame. */
271 #define FRAME_SAVED_PC(frame_struct) frame_saved_pc(frame_struct)
273 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
275 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
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. */
280 /* We can't tell how many args there are */
282 #define FRAME_NUM_ARGS(val,fi) (val = -1)
284 #define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame)
286 /* extra stuff in frame structure to support
287 * backtraceing thru non fp frame based frames
288 * (trace stuff thats not -g compiled)
291 #define EXTRA_FRAME_INFO int is_minus_g; CORE_ADDR sp; CORE_ADDR rp;
293 #define INIT_EXTRA_FRAME_INFO(fromleaf,fci) (fci)->is_minus_g = 0; (fci)->sp = 0; (fci)->rp = 0;
295 /* Return number of bytes at start of arglist that are not really args. */
297 #define FRAME_ARGS_SKIP 8
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. */
305 /* Grind through the various st.l rx,Y(fp) and fst.z fx,Y(fp) */
307 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
308 frame_find_saved_regs(frame_info, &(frame_saved_regs))
310 /* Things needed for making the inferior call functions. */
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
318 #define PUSH_DUMMY_FRAME i860_push_frame()
320 /* Discard from the stack the innermost frame,
321 restoring all saved registers. */
323 #define POP_FRAME i860_pop_frame()
325 /* This sequence of words is the instructions:
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 */
340 /* account for reversal of instructions in memory */
342 #define CALL_DUMMY { \
343 0x4c00f802, 0xa0000000, 0x44000000, 0xa0000000 }
345 #define CALL_DUMMY { \
346 0xa0000000, 0x4c00F802, 0xa0000000, 0x44000000 }
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 */
354 #define CALL_DUMMY_LENGTH 16
356 /* Actually start at the calli */
358 #define CALL_DUMMY_START_OFFSET 4
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)
366 /* i860 has no reliable single step ptrace call */
368 #define NO_SINGLE_STEP 1
370 #define KERNEL_U_ADDR 0xfc7fe530
371 #define REGISTER_U_ADDR(addr,ar0,regno) \
372 addr = (REGISTER_BYTE(regno) + ar0 );
374 /* How many bytes are pushed on the stack for the argument list
376 #define STACK_ARG_BYTES(RESULT,ARGS,NARGS,STRUCT_RETURN) {(RESULT) = 0;}
378 /* Pass arguments to a function
381 #define PUSH_ARGUMENTS(NARGS,ARGS,STACKP,STRUCT_RETURN,STRUCT_ADDR) \
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); }
387 #define CALL_DUMMY_LOCATION AFTER_TEXT_END
389 #define NEED_TEXT_START_END
391 #define NONSTANDARD_MEMORY_LAYOUT
393 /* We support pseudo-frame structure so actual frame pointer value must be
394 * read from the register.
396 #define FP_FROM_REGISTER
398 /* Support a quit from info register command because we have so many regs
400 #define INFO_REGISTER_QUIT
402 /* Identify text or absolute symbols to put in misc function table. In the
403 * i860 case, only text symbols not starting with _L00
405 #define MISC_FUNCTION(cs) ((cs)->c_secnum == 1 && (cs)->c_value && \
406 strncmp((cs)->c_name, "_L00", 4) != 0)
408 /* Define our a.out magic number and undefine the 386 one if it's defined
411 #define AOUT_MAGIC I860MAGIC
413 #define AOUT_MAGIC 0515
420 /* The aouthdr may be larger than defined in a.out.h
422 #define AOUTHDR_VARIABLE
424 /* We have a bug where lineno information is not in symbol table correctly
428 /* Similarly, the Endndx of a structure definition is bogus in ld860
430 /* #define STRUCT_SYMBOL_BUG */
432 /* Also, we see T_ARG types when we shouldn't
436 /* Macro to sign extend to 32 bits */
437 #define SIGN_EXT(n,x) (((int) (x) << (32-n)) >> (32-n))
439 #define SIGN_EXT16(x) (((int) (x) << (16)) >> (16))
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)))
447 #define ADJ_PC(pc) (pc)
448 #define ADJ_FREG(freg) (freg)
449 #define ADJ_FREG_BYTE(freg) (freg)
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; \
464 { prev->pc = CLEAN_PC( nextframe ->rp); \
466 else prev->pc = CLEAN_PC((fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
467 prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ())); }
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);
This page took 0.038487 seconds and 4 git commands to generate.