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. */
49 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
51 #define TARGET_BYTE_ORDER BIG_ENDIAN
67 #define FP_REGNUM 14 /* Frame pointer */
68 #define SP_REGNUM 15 /* Stack pointer */
69 #define PC_REGNUM 16 /* Program counter */
70 #define RP_REGNUM 19 /* Return pointer */
72 #define FIRST_ARGREG R4_REGNUM /* first arg (or struct ret val addr) */
73 #define LAST_ARGREG R7_REGNUM /* fourth (or third arg) */
74 #define RETVAL_REG R4_REGNUM /* return vaue */
76 /* Say how long (ordinary) registers are. This is a piece of bogosity
77 used in push_word and a few other places; REGISTER_RAW_SIZE is the
78 real way to know how big a register is. */
79 #define REGISTER_SIZE FR30_REGSIZE
81 /* Number of bytes of storage in the actual machine representation
83 #define REGISTER_RAW_SIZE(N) FR30_REGSIZE
85 /* Largest value REGISTER_RAW_SIZE can have. */
86 #define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
88 /* Number of bytes of storage in the program's representation
90 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
92 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
93 #define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
95 extern void fr30_pop_frame PARAMS ((void));
96 #define POP_FRAME fr30_pop_frame()
98 #define USE_GENERIC_DUMMY_FRAMES
99 #define CALL_DUMMY {0}
100 #define CALL_DUMMY_START_OFFSET (0)
101 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
102 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
103 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
104 #define CALL_DUMMY_ADDRESS() entry_point_address ()
105 #define PUSH_RETURN_ADDRESS(PC, SP) (write_register(RP_REGNUM, CALL_DUMMY_ADDRESS()), SP)
106 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
108 /* Number of bytes at start of arglist that are not really args. */
109 #define FRAME_ARGS_SKIP 0
111 /* Return the GDB type object for the "standard" data type
112 of data in register N. */
113 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
115 /* Extract from an array REGBUF containing the (raw) register state
116 a function return value of type TYPE, and copy that, in virtual format,
118 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
119 memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG) + \
120 (TYPE_LENGTH(TYPE) < 4 ? 4 - TYPE_LENGTH(TYPE) : 0), TYPE_LENGTH (TYPE))
122 /* Extract from an array REGBUF containing the (raw) register state
123 the address in which a function should return its structure value,
124 as a CORE_ADDR (or an expression that can be used as one). */
125 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
126 extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
127 REGISTER_RAW_SIZE (RETVAL_REG))
129 #define STORE_STRUCT_RETURN(ADDR, SP) \
130 { write_register (RETVAL_REG, (ADDR)); }
132 #define FRAME_ARGS_ADDRESS(fi) (fi->frame)
133 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
135 /* Return number of args passed to a frame.
136 Can return -1, meaning no way to tell. */
137 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
139 #ifdef __STDC__ /* Forward decls for prototypes */
141 struct frame_saved_regs;
146 #define EXTRA_FRAME_INFO \
147 struct frame_saved_regs fsr; \
152 extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
153 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
155 extern CORE_ADDR fr30_frame_saved_pc PARAMS ((struct frame_info *));
156 #define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
158 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
160 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
161 #define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
163 /* Write into appropriate registers a function return value
164 of type TYPE, given in virtual format. */
166 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
167 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
169 /* Put here the code to store, into a struct frame_saved_regs,
170 the addresses of the saved registers of frame described by FRAME_INFO.
171 This includes special registers such as pc and fp saved in special
172 ways in the stack frame. sp is even more special:
173 the address we return for it IS the sp for the next frame. */
174 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
176 /* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
177 #define FR30_BREAKOP 0x1f /* opcode, type D instruction */
178 #define BREAKPOINT_INTNUM 9 /* one of the reserved traps */
179 #define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
181 /* Define this for Wingdb */
184 /* IEEE format floating point */
187 /* Define other aspects of the stack frame. */
189 /* A macro that tells us whether the function invocation represented
190 by FI does not have a frame on the stack associated with it. If it
191 does not, FRAMELESS is set to 1, else 0. */
192 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
194 CORE_ADDR func_start, after_prologue; \
195 func_start = (get_pc_function_start ((FI)->pc) + \
196 FUNCTION_START_OFFSET); \
197 after_prologue = func_start; \
198 SKIP_PROLOGUE (after_prologue); \
199 (FRAMELESS) = (after_prologue == func_start); \
202 extern void fr30_init_extra_frame_info PARAMS ((struct frame_info *fi));
203 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
205 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
208 fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
210 CORE_ADDR struct_addr));
211 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
212 (SP) = fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
214 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
216 /* always pass struct by value as a pointer */
217 /* XXX Z.R. GCC does not do that today */
218 #define REG_STRUCT_HAS_ADDR(gcc_p,type) \
219 ((TYPE_LENGTH(type) > 4) && (TYPE_LENGTH(type) & 0x3))
220 /* alway return struct by value by input pointer */
221 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) 1