8214f7797aacfc3a450ef4dd5507fbc04784a3e7
[deliverable/binutils-gdb.git] / gdb / config / fr30 / tm-fr30.h
1 /* Parameters for execution on a Fujitsu FR30 processor.
2
3 This file is part of GDB.
4
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.
9
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.
14
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. */
18
19 #define FR30_GENREGS 16
20 #define FR30_DEDICATEDREGS 8
21 #define FR30_REGSIZE 4 /* bytes */
22
23 #define NUM_REGS (FR30_GENREGS + FR30_DEDICATEDREGS)
24 #define REGISTER_BYTES ((FR30_GENREGS + FR30_DEDICATEDREGS)*FR30_REGSIZE)
25
26 /* Index within `registers' of the first byte of the space for
27 register N. */
28 #define REGISTER_BYTE(N) ((N) * FR30_REGSIZE)
29
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" }
36
37 /* Offset from address of function to start of its code.
38 Zero on most machines. */
39 #define FUNCTION_START_OFFSET 0
40
41 /* Amount PC must be decremented by after a breakpoint.
42 This is often the number of bytes in BREAKPOINT
43 but not always. */
44
45 #define DECR_PC_AFTER_BREAK 0
46
47 /* Stack grows downward. */
48
49 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
50
51 #define TARGET_BYTE_ORDER BIG_ENDIAN
52
53 #define R0_REGNUM 0
54 #define R1_REGNUM 1
55 #define R2_REGNUM 2
56 #define R3_REGNUM 3
57 #define R4_REGNUM 4
58 #define R5_REGNUM 5
59 #define R6_REGNUM 6
60 #define R7_REGNUM 7
61 #define R8_REGNUM 8
62 #define R9_REGNUM 9
63 #define R10_REGNUM 10
64 #define R11_REGNUM 11
65 #define R12_REGNUM 12
66 #define R13_REGNUM 13
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 */
71
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 */
75
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
80
81 /* Number of bytes of storage in the actual machine representation
82 for register N. */
83 #define REGISTER_RAW_SIZE(N) FR30_REGSIZE
84
85 /* Largest value REGISTER_RAW_SIZE can have. */
86 #define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
87
88 /* Number of bytes of storage in the program's representation
89 for register N. */
90 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
91
92 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
93 #define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
94
95 extern void fr30_pop_frame PARAMS ((void));
96 #define POP_FRAME fr30_pop_frame()
97
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 extern CORE_ADDR fr30_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
106 #define PUSH_RETURN_ADDRESS(PC, SP) fr30_push_return_address (PC, SP)
107
108
109 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
110
111
112 /* Number of bytes at start of arglist that are not really args. */
113 #define FRAME_ARGS_SKIP 0
114
115 /* Return the GDB type object for the "standard" data type
116 of data in register N. */
117 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
118
119 /* Extract from an array REGBUF containing the (raw) register state
120 a function return value of type TYPE, and copy that, in virtual format,
121 into VALBUF. */
122 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
123 memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG), TYPE_LENGTH (TYPE))
124
125 /* Extract from an array REGBUF containing the (raw) register state
126 the address in which a function should return its structure value,
127 as a CORE_ADDR (or an expression that can be used as one). */
128 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
129 extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
130 REGISTER_RAW_SIZE (RETVAL_REG))
131
132 #define STORE_STRUCT_RETURN(ADDR, SP) \
133 { write_register (RETVAL_REG, (ADDR)); }
134
135
136
137 #define FRAME_ARGS_ADDRESS(fi) (fi->frame)
138 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
139
140 /* Return number of args passed to a frame.
141 Can return -1, meaning no way to tell. */
142 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
143
144 #ifdef __STDC__ /* Forward decls for prototypes */
145 struct frame_info;
146 struct frame_saved_regs;
147 struct type;
148 struct value;
149 #endif
150
151 #define EXTRA_FRAME_INFO \
152 struct frame_saved_regs fsr; \
153 int framesize; \
154 int frameoffset; \
155 int framereg;
156
157 extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
158 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
159
160 extern CORE_ADDR fr30_frame_saved_pc PARAMS ((struct frame_info *));
161 #define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
162
163 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
164
165 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
166 #define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
167
168 /* Write into appropriate registers a function return value
169 of type TYPE, given in virtual format. */
170
171 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
172 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
173
174 /* Put here the code to store, into a struct frame_saved_regs,
175 the addresses of the saved registers of frame described by FRAME_INFO.
176 This includes special registers such as pc and fp saved in special
177 ways in the stack frame. sp is even more special:
178 the address we return for it IS the sp for the next frame. */
179 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
180
181 /* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
182 #define FR30_BREAKOP 0x1f /* opcode, type D instruction */
183 #define BREAKPOINT_INTNUM 9 /* one of the reserved traps */
184 #define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
185
186 /* Define this for Wingdb */
187 #define TARGET_FR30
188
189 #if(1) /* Z.R. */
190
191 /*ARM example*/
192
193 /* IEEE format floating point */
194 #define IEEE_FLOAT
195
196 /* Define other aspects of the stack frame. */
197
198 /* A macro that tells us whether the function invocation represented
199 by FI does not have a frame on the stack associated with it. If it
200 does not, FRAMELESS is set to 1, else 0. */
201 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
202 { \
203 CORE_ADDR func_start, after_prologue; \
204 func_start = (get_pc_function_start ((FI)->pc) + \
205 FUNCTION_START_OFFSET); \
206 after_prologue = func_start; \
207 SKIP_PROLOGUE (after_prologue); \
208 (FRAMELESS) = (after_prologue == func_start); \
209 }
210
211 /*V850 example*/
212
213 extern void fr30_init_extra_frame_info PARAMS ((struct frame_info *fi));
214 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
215
216 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
217
218 extern CORE_ADDR
219 fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
220 int struct_return,
221 CORE_ADDR struct_addr));
222 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
223 (SP) = fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
224
225 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
226
227 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \
228 (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4)
229
230 #endif /* Z.R. */
This page took 0.047977 seconds and 4 git commands to generate.