1 /* Parameters for execution on a Fujitsu FR30 processor.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 #define FR30_GENREGS 16
20 #define FR30_DEDICATEDREGS 8
21 #define FR30_REGSIZE 4 /* bytes */
23 #define NUM_REGS (FR30_GENREGS + FR30_DEDICATEDREGS)
24 #define REGISTER_BYTES ((FR30_GENREGS + FR30_DEDICATEDREGS)*FR30_REGSIZE)
26 /* Index within `registers' of the first byte of the space for
28 #define REGISTER_BYTE(N) ((N) * FR30_REGSIZE)
30 /* Initializer for an array of names of registers.
31 There should be NUM_REGS strings in this initializer. */
32 #define REGISTER_NAMES \
33 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
34 "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
35 "pc", "ps", "tbr", "rp", "ssp", "usp", "mdh", "mdl" }
37 /* Offset from address of function to start of its code.
38 Zero on most machines. */
39 #define FUNCTION_START_OFFSET 0
41 /* Amount PC must be decremented by after a breakpoint.
42 This is often the number of bytes in BREAKPOINT
45 #define DECR_PC_AFTER_BREAK 0
47 /* Stack grows downward. */
51 #define TARGET_BYTE_ORDER BIG_ENDIAN
55 #define FP_REGNUM 14 /* Frame pointer */
56 #define SP_REGNUM 15 /* Stack pointer */
57 #define PC_REGNUM 16 /* Program counter */
58 #define RP_REGNUM 19 /* Return pointer */
60 #define FIRST_ARGREG R4_REGNUM /* first arg (or struct ret val addr) */
61 #define LAST_ARGREG R7_REGNUM /* fourth (or third arg) */
62 #define RETVAL_REG R4_REGNUM /* return vaue */
64 /* Say how long (ordinary) registers are. This is a piece of bogosity
65 used in push_word and a few other places; REGISTER_RAW_SIZE is the
66 real way to know how big a register is. */
67 #define REGISTER_SIZE FR30_REGSIZE
69 /* Number of bytes of storage in the actual machine representation
71 #define REGISTER_RAW_SIZE(N) FR30_REGSIZE
73 /* Largest value REGISTER_RAW_SIZE can have. */
74 #define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
76 /* Number of bytes of storage in the program's representation
78 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
80 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
81 #define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
83 extern void fr30_pop_frame PARAMS ((void));
84 /* XXX do we need the parameter ? */
85 #define POP_FRAME fr30_pop_frame()
87 /* Number of bytes at start of arglist that are not really args. */
88 #define FRAME_ARGS_SKIP 0
90 /* Return the GDB type object for the "standard" data type
91 of data in register N. */
92 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
94 /* Extract from an array REGBUF containing the (raw) register state
95 a function return value of type TYPE, and copy that, in virtual format,
97 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
98 memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG), TYPE_LENGTH (TYPE))
100 /* Extract from an array REGBUF containing the (raw) register state
101 the address in which a function should return its structure value,
102 as a CORE_ADDR (or an expression that can be used as one). */
103 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
104 extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
105 REGISTER_RAW_SIZE (RETVAL_REG))
108 #define FRAME_ARGS_ADDRESS(fi) (fi->frame)
109 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
111 /* Return number of args passed to a frame.
112 Can return -1, meaning no way to tell. */
113 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
115 #ifdef __STDC__ /* Forward decls for prototypes */
117 struct frame_saved_regs;
122 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
124 extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
125 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
127 extern CORE_ADDR fr30_frame_saved_pc PARAMS ((struct frame_info *));
128 #define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
130 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
132 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
133 #define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
135 /* Write into appropriate registers a function return value
136 of type TYPE, given in virtual format. */
138 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
139 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
141 /* Put here the code to store, into a struct frame_saved_regs,
142 the addresses of the saved registers of frame described by FRAME_INFO.
143 This includes special registers such as pc and fp saved in special
144 ways in the stack frame. sp is even more special:
145 the address we return for it IS the sp for the next frame. */
146 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
148 /* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
149 #define FR30_BREAKOP 0x1f /* opcode, type D instruction */
150 #define BREAKPOINT_INTNUM 9 /* one of the reserved traps */
151 #define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
164 #ifdef __STDC__ /* Forward decls for prototypes */
169 #define TARGET_BYTE_ORDER_SELECTABLE
171 /* IEEE format floating point */
175 /* FIXME: may need a floatformat_ieee_double_bigbyte_littleword format for
176 BIG_ENDIAN use. -fnf */
178 #define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \
179 ? &floatformat_ieee_double_big \
180 : &floatformat_ieee_double_littlebyte_bigword)
182 /* When reading symbols, we need to zap the low bit of the address, which
183 may be set to 1 for Thumb functions. */
185 #define SMASH_TEXT_ADDRESS(addr) ((addr) &= ~0x1)
187 /* Remove useless bits from addresses in a running program. */
189 CORE_ADDR arm_addr_bits_remove PARAMS ((CORE_ADDR));
191 #define ADDR_BITS_REMOVE(val) (arm_addr_bits_remove (val))
193 /* Offset from address of function to start of its code.
194 Zero on most machines. */
196 #define FUNCTION_START_OFFSET 0
198 /* Advance PC across any function entry prologue instructions
199 to reach some "real" code. */
201 extern CORE_ADDR arm_skip_prologue PARAMS ((CORE_ADDR pc));
203 #define SKIP_PROLOGUE(pc) { pc = arm_skip_prologue (pc); }
205 /* Immediately after a function call, return the saved pc.
206 Can't always go through the frames for this because on some machines
207 the new frame is not set up until the new function executes
208 some instructions. */
210 #define SAVED_PC_AFTER_CALL(frame) arm_saved_pc_after_call (frame)
212 extern CORE_ADDR arm_saved_pc_after_call PARAMS ((struct frame_info *));
214 /* I don't know the real values for these. */
215 #define TARGET_UPAGES UPAGES
216 #define TARGET_NBPG NBPG
218 /* Address of end of stack space. */
220 #define STACK_END_ADDR (0x01000000 - (TARGET_UPAGES * TARGET_NBPG))
222 /* Stack grows downward. */
226 /* Sequence of bytes for breakpoint instruction. */
228 /* !!!! if we're using RDP, then we're inserting breakpoints and storing
229 their handles instread of what was in memory. It is nice that
230 this is the same size as a handle - otherwise remote-rdp will
233 #define ARM_LE_BREAKPOINT {0x00,0x00,0x18,0xef} /* BKPT_SWI from <sys/ptrace.h> */
234 #define ARM_BE_BREAKPOINT {0xef,0x18,0x00,0x00} /* BKPT_SWI from <sys/ptrace.h> */
235 #define THUMB_LE_BREAKPOINT {0x18,0xdf} /* swi 24 */
236 #define THUMB_BE_BREAKPOINT {0xdf,0x18} /* swi 24 */
238 /* The following has been superseded by BREAKPOINT_FOR_PC, but
239 is defined merely to keep mem-break.c happy. */
240 #define LITTLE_BREAKPOINT ARM_LE_BREAKPOINT
241 #define BIG_BREAKPOINT ARM_BE_BREAKPOINT
243 /* BREAKPOINT_FROM_PC uses the program counter value to determine whether a
244 16- or 32-bit breakpoint should be used. It returns a pointer
245 to a string of bytes that encode a breakpoint instruction, stores
246 the length of the string to *lenptr, and adjusts the pc (if necessary) to
247 point to the actual memory location where the breakpoint should be
250 unsigned char * arm_breakpoint_from_pc PARAMS ((CORE_ADDR * pcptr, int * lenptr));
251 #define BREAKPOINT_FROM_PC(pcptr, lenptr) arm_breakpoint_from_pc (pcptr, lenptr)
253 /* Amount PC must be decremented by after a breakpoint.
254 This is often the number of bytes in BREAKPOINT
257 #define DECR_PC_AFTER_BREAK 0
259 /* Nonzero if instruction at PC is a return instruction. */
261 #define ABOUT_TO_RETURN(pc) \
262 ((read_memory_integer(pc, 4) & 0x0fffffff == 0x01b0f00e) || \
263 (read_memory_integer(pc, 4) & 0x0ffff800 == 0x09eba800))
265 /* code to execute to print interesting information about the
266 * floating point processor (if any)
267 * No need to define if there is nothing to do.
269 #define FLOAT_INFO { arm_float_info (); }
271 /* Say how long (ordinary) registers are. This is a piece of bogosity
272 used in push_word and a few other places; REGISTER_RAW_SIZE is the
273 real way to know how big a register is. */
275 #define REGISTER_SIZE 4
277 /* Number of machine registers */
279 /* Note: I make a fake copy of the pc in register 25 (calling it ps) so
280 that I can clear the status bits from pc (register 15) */
284 /* Initializer for an array of names of registers.
285 There should be NUM_REGS strings in this initializer. */
287 #define ORIGINAL_REGISTER_NAMES \
288 { "a1", "a2", "a3", "a4", /* 0 1 2 3 */ \
289 "v1", "v2", "v3", "v4", /* 4 5 6 7 */ \
290 "v5", "v6", "sl", "fp", /* 8 9 10 11 */ \
291 "ip", "sp", "lr", "pc", /* 12 13 14 15 */ \
292 "f0", "f1", "f2", "f3", /* 16 17 18 19 */ \
293 "f4", "f5", "f6", "f7", /* 20 21 22 23 */ \
294 "fps","ps" } /* 24 25 */
296 /* These names are the ones which gcc emits, and
297 I find them less confusing. Toggle between them
298 using the `othernames' command. */
300 #define ADDITIONAL_REGISTER_NAMES \
301 { "r0", "r1", "r2", "r3", /* 0 1 2 3 */ \
302 "r4", "r5", "r6", "r7", /* 4 5 6 7 */ \
303 "r8", "r9", "sl", "fp", /* 8 9 10 11 */ \
304 "ip", "sp", "lr", "pc", /* 12 13 14 15 */ \
305 "f0", "f1", "f2", "f3", /* 16 17 18 19 */ \
306 "f4", "f5", "f6", "f7", /* 20 21 22 23 */ \
307 "fps","ps" } /* 24 25 */
309 #define REGISTER_NAMES ADDITIONAL_REGISTER_NAMES
310 #ifndef REGISTER_NAMES
311 #define REGISTER_NAMES ORIGINAL_REGISTER_NAMES
314 /* Register numbers of various important registers.
315 Note that some of these values are "real" register numbers,
316 and correspond to the general registers of the machine,
317 and some are "phony" register numbers which are too large
318 to be actual register numbers as far as the user is concerned
319 but do serve to get the desired values when passed to read_register. */
321 #define A1_REGNUM 0 /* first integer-like argument */
322 #define A4_REGNUM 3 /* last integer-like argument */
324 #define FP_REGNUM 11 /* Contains address of executing stack frame */
325 #define SP_REGNUM 13 /* Contains address of top of stack */
326 #define LR_REGNUM 14 /* address to return to from a function call */
327 #define PC_REGNUM 15 /* Contains program counter */
328 #define F0_REGNUM 16 /* first floating point register */
329 #define F3_REGNUM 19 /* last floating point argument register */
330 #define F7_REGNUM 23 /* last floating point register */
331 #define FPS_REGNUM 24 /* floating point status register */
332 #define PS_REGNUM 25 /* Contains processor status */
334 #define THUMB_FP_REGNUM 7 /* R7 is frame register on Thumb */
336 #define ARM_NUM_ARG_REGS 4
337 #define ARM_LAST_ARG_REGNUM A4_REGNUM
338 #define ARM_NUM_FP_ARG_REGS 4
339 #define ARM_LAST_FP_ARG_REGNUM F3_REGNUM
341 /* Instruction condition field values. */
359 #define FLAG_N 0x80000000
360 #define FLAG_Z 0x40000000
361 #define FLAG_C 0x20000000
362 #define FLAG_V 0x10000000
366 /* Total amount of space needed to store our copies of the machine's
367 register state, the array `registers'. */
368 #define REGISTER_BYTES (16*4 + 12*8 + 4 + 4)
370 /* Index within `registers' of the first byte of the space for
373 #define REGISTER_BYTE(N) (((N) < F0_REGNUM) ? (N)*4 : \
374 (((N) < PS_REGNUM) ? 16*4 + ((N) - 16)*12 : \
375 16*4 + 8*12 + ((N) - FPS_REGNUM) * 4))
377 /* Number of bytes of storage in the actual machine representation
378 for register N. On the vax, all regs are 4 bytes. */
380 #define REGISTER_RAW_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 12)
382 /* Number of bytes of storage in the program's representation
383 for register N. On the vax, all regs are 4 bytes. */
385 #define REGISTER_VIRTUAL_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 8)
387 /* Largest value REGISTER_RAW_SIZE can have. */
389 #define MAX_REGISTER_RAW_SIZE 12
391 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
393 #define MAX_REGISTER_VIRTUAL_SIZE 8
395 /* Nonzero if register N requires conversion
396 from raw format to virtual format. */
397 #define REGISTER_CONVERTIBLE(N) ((unsigned)(N) - F0_REGNUM < 8)
399 /* Convert data from raw format for register REGNUM in buffer FROM
400 to virtual format with type TYPE in buffer TO. */
402 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
405 convert_from_extended ((FROM), & val); \
406 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
409 /* Convert data from virtual format with type TYPE in buffer FROM
410 to raw format for register REGNUM in buffer TO. */
412 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
414 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
415 convert_to_extended (&val, (TO)); \
417 /* Return the GDB type object for the "standard" data type
418 of data in register N. */
420 #define REGISTER_VIRTUAL_TYPE(N) \
421 (((unsigned)(N) - F0_REGNUM) < 8 ? builtin_type_double : builtin_type_int)
423 /* The system C compiler uses a similar structure return convention to gcc */
425 #define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > 4)
427 /* Store the address of the place in which to copy the structure the
428 subroutine will return. This is called from call_function. */
430 #define STORE_STRUCT_RETURN(ADDR, SP) \
431 { write_register (0, (ADDR)); }
433 /* Extract from an array REGBUF containing the (raw) register state
434 a function return value of type TYPE, and copy that, in virtual format,
437 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
438 if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
439 convert_from_extended (REGBUF + REGISTER_BYTE (F0_REGNUM), VALBUF); \
441 memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE))
443 /* Write into appropriate registers a function return value
444 of type TYPE, given in virtual format. */
446 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
447 if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) { \
448 char _buf[MAX_REGISTER_RAW_SIZE]; \
449 convert_to_extended (VALBUF, _buf); \
450 write_register_bytes (REGISTER_BYTE (F0_REGNUM), _buf, MAX_REGISTER_RAW_SIZE); \
452 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
454 /* Extract from an array REGBUF containing the (raw) register state
455 the address in which a function should return its structure value,
456 as a CORE_ADDR (or an expression that can be used as one). */
458 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
460 /* Specify that for the native compiler variables for a particular
461 lexical context are listed after the beginning LBRAC instead of
462 before in the executables list of symbols. */
463 #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
466 /* Define other aspects of the stack frame.
467 We keep the offsets of all saved registers, 'cause we need 'em a lot!
468 We also keep the current size of the stack frame, and the offset of
469 the frame pointer from the stack pointer (for frameless functions, and
470 when we're still in the prologue of a function with a frame) */
472 #define EXTRA_FRAME_INFO \
473 struct frame_saved_regs fsr; \
478 extern void arm_init_extra_frame_info PARAMS ((struct frame_info *fi));
479 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) arm_init_extra_frame_info (fi)
481 /* Return the frame address. On ARM, it is R11; on Thumb it is R7. */
482 CORE_ADDR arm_target_read_fp PARAMS ((void));
483 #define TARGET_READ_FP() arm_target_read_fp ()
485 /* Describe the pointer in each stack frame to the previous stack frame
488 /* FRAME_CHAIN takes a frame's nominal address
489 and produces the frame's chain-pointer.
491 However, if FRAME_CHAIN_VALID returns zero,
492 it means the given frame is the outermost one and has no caller. */
494 #define FRAME_CHAIN(thisframe) (CORE_ADDR) arm_frame_chain (thisframe)
495 extern CORE_ADDR arm_frame_chain PARAMS ((struct frame_info *));
497 #define LOWEST_PC 0x20 /* the first 0x20 bytes are the trap vectors. */
499 #define FRAME_CHAIN_VALID(chain, thisframe) \
500 (chain != 0 && (FRAME_SAVED_PC (thisframe) >= LOWEST_PC))
502 /* Define other aspects of the stack frame. */
504 /* A macro that tells us whether the function invocation represented
505 by FI does not have a frame on the stack associated with it. If it
506 does not, FRAMELESS is set to 1, else 0. */
507 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
509 CORE_ADDR func_start, after_prologue; \
510 func_start = (get_pc_function_start ((FI)->pc) + \
511 FUNCTION_START_OFFSET); \
512 after_prologue = func_start; \
513 SKIP_PROLOGUE (after_prologue); \
514 (FRAMELESS) = (after_prologue == func_start); \
519 #define FRAME_SAVED_PC(FRAME) arm_frame_saved_pc (FRAME)
520 extern CORE_ADDR arm_frame_saved_pc PARAMS ((struct frame_info *));
522 #define FRAME_ARGS_ADDRESS(fi) (fi->frame)
524 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
526 /* Return number of args passed to a frame.
527 Can return -1, meaning no way to tell. */
529 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
531 /* Return number of bytes at start of arglist that are not really args. */
533 #define FRAME_ARGS_SKIP 0
535 /* Put here the code to store, into a struct frame_saved_regs,
536 the addresses of the saved registers of frame described by FRAME_INFO.
537 This includes special registers such as pc and fp saved in special
538 ways in the stack frame. sp is even more special:
539 the address we return for it IS the sp for the next frame. */
541 struct frame_saved_regs;
543 void frame_find_saved_regs PARAMS((struct frame_info *fi,
544 struct frame_saved_regs *fsr));
546 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
547 arm_frame_find_saved_regs (frame_info, &(frame_saved_regs));
550 /* Things needed for making the inferior call functions. */
552 #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
553 sp = arm_push_arguments ((nargs), (args), (sp), (struct_return), (struct_addr))
555 arm_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
557 /* Push an empty stack frame, to record the current PC, etc. */
559 void arm_push_dummy_frame PARAMS ((void));
561 #define PUSH_DUMMY_FRAME arm_push_dummy_frame ()
563 /* Discard from the stack the innermost frame, restoring all registers. */
565 void arm_pop_frame PARAMS ((void));
567 #define POP_FRAME arm_pop_frame ()
569 /* This sequence of words is the instructions
575 Note this is 12 bytes. */
577 #define CALL_DUMMY {0xe1a0e00f, 0xe1a0f004, 0xef180000}
579 #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
581 #define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset()
582 extern int arm_call_dummy_breakpoint_offset PARAMS ((void));
584 /* Insert the specified number of args and function address
585 into a call sequence of the above form stored at DUMMYNAME. */
587 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
588 arm_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
590 void arm_fix_call_dummy PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR fun,
591 int nargs, struct value **args,
592 struct type *type, int gcc_p));
594 CORE_ADDR arm_get_next_pc PARAMS ((CORE_ADDR));
596 /* Functions for dealing with Thumb call thunks. */
597 #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) arm_in_call_stub (pc, name)
598 #define SKIP_TRAMPOLINE_CODE(pc) arm_skip_stub (pc)
599 extern int arm_in_call_stub PARAMS ((CORE_ADDR pc, char *name));
600 extern CORE_ADDR arm_skip_stub PARAMS ((CORE_ADDR pc));
602 /* Function to determine whether MEMADDR is in a Thumb function. */
603 extern int arm_pc_is_thumb PARAMS ((bfd_vma memaddr));
605 /* Function to determine whether MEMADDR is in a call dummy called from
607 extern int arm_pc_is_thumb_dummy PARAMS ((bfd_vma memaddr));
609 /* Macros for setting and testing a bit in a minimal symbol that
610 marks it as Thumb function. The MSB of the minimal symbol's
611 "info" field is used for this purpose. This field is already
612 being used to store the symbol size, so the assumption is
613 that the symbol size cannot exceed 2^31.
615 COFF_MAKE_MSYMBOL_SPECIAL
616 ELF_MAKE_MSYMBOL_SPECIAL tests whether the COFF or ELF symbol corresponds
617 to a thumb function, and sets a "special" bit in a
618 minimal symbol to indicate that it does
619 MSYMBOL_SET_SPECIAL actually sets the "special" bit
620 MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol
621 MSYMBOL_SIZE returns the size of the minimal symbol, i.e.
622 the "info" field with the "special" bit masked out
625 extern int coff_sym_is_thumb(int val);
626 #define MSYMBOL_SET_SPECIAL(msym) \
627 MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000)
628 #define MSYMBOL_IS_SPECIAL(msym) \
629 (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
630 #define MSYMBOL_SIZE(msym) \
631 ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
633 /* Thumb symbol are of type STT_LOPROC, (synonymous with STT_ARM_TFUNC) */
634 #define ELF_MAKE_MSYMBOL_SPECIAL(sym,msym) \
635 { if(ELF_ST_TYPE(((elf_symbol_type *)(sym))->internal_elf_sym.st_info) == STT_LOPROC) \
636 MSYMBOL_SET_SPECIAL(msym); }
638 #define COFF_MAKE_MSYMBOL_SPECIAL(val,msym) \
639 { if(coff_sym_is_thumb(val)) MSYMBOL_SET_SPECIAL(msym); }
645 #define TARGET_BYTE_ORDER BIG_ENDIAN
649 #define REGISTER_NAMES \
650 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
651 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
652 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
653 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
655 "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \
656 "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \
657 "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \
658 "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \
662 #define REGISTER_BYTES (NUM_REGS * 4)
664 #define REGISTER_SIZE 4
665 #define MAX_REGISTER_RAW_SIZE 4
669 #define SAVE1_START_REGNUM 2
670 #define SAVE1_END_REGNUM 2
672 #define ARG0_REGNUM 6
673 #define ARGLAST_REGNUM 9
676 #define R12_REGNUM 12
677 #define SAVE2_START_REGNUM 20
678 #define SAVE2_END_REGNUM 29
680 #define SAVE3_START_REGNUM 31
681 #define SAVE3_END_REGNUM 31
686 #define FP_RAW_REGNUM 29
688 #define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
689 #define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL))
691 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
693 #define REGISTER_BYTE(REG) ((REG) * 4)
694 #define REGISTER_VIRTUAL_SIZE(REG) 4
695 #define REGISTER_RAW_SIZE(REG) 4
697 #define MAX_REGISTER_VIRTUAL_SIZE 4
699 #define BREAKPOINT {0x40, 0xF8} /* little-ended */
701 #define FUNCTION_START_OFFSET 0
703 #define DECR_PC_AFTER_BREAK 0
707 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
711 struct frame_saved_regs;
716 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
718 extern void fr30_init_extra_frame_info PARAMS ((struct frame_info *fi));
719 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
720 #define INIT_FRAME_PC /* Not necessary */
722 extern void fr30_frame_find_saved_regs PARAMS ((struct frame_info *fi, struct frame_saved_regs *regaddr));
723 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
725 extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
726 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
727 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
729 extern CORE_ADDR fr30_find_callers_reg PARAMS ((struct frame_info *fi, int regnum));
730 extern CORE_ADDR fr30_frame_saved_pc PARAMS ((struct frame_info *));
731 #define FRAME_SAVED_PC(FI) (fr30_frame_saved_pc (FI))
733 #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
734 memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE))
736 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
737 extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
738 REGISTER_RAW_SIZE (V0_REGNUM))
740 #define STORE_RETURN_VALUE(TYPE, VALBUF) \
741 write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE));
743 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
744 #define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
746 #define FRAME_ARGS_SKIP 0
748 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
749 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
750 #define FRAME_NUM_ARGS(val, fi) ((val) = -1)
752 extern void fr30_pop_frame PARAMS ((void));
753 #define POP_FRAME fr30_pop_frame()
755 #define USE_GENERIC_DUMMY_FRAMES
756 #define CALL_DUMMY {0}
757 #define CALL_DUMMY_START_OFFSET (0)
758 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
759 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
760 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
761 #define CALL_DUMMY_ADDRESS() entry_point_address ()
762 extern CORE_ADDR fr30_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
763 #define PUSH_RETURN_ADDRESS(PC, SP) fr30_push_return_address (PC, SP)
766 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
769 fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
770 unsigned char struct_return,
771 CORE_ADDR struct_addr));
772 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
773 (SP) = fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
775 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)
778 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
780 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \
781 (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4)
783 /* override the default get_saved_register function with
784 one that takes account of generic CALL_DUMMY frames */
785 #define GET_SAVED_REGISTER
787 /* Define this for Wingdb */