1 /* Parameters for execution on a Mitsubishi m32r processor.
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
27 /* mvs_check REGISTER_NAMES */
28 #define REGISTER_NAMES \
29 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
30 "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
31 "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch", \
32 /* "cond", "sm", "bsm", "ie", "bie", "bcarry", */ \
34 /* mvs_check NUM_REGS */
37 /* mvs_check REGISTER_SIZE */
38 #define REGISTER_SIZE 4
39 /* mvs_check MAX_REGISTER_RAW_SIZE */
40 #define MAX_REGISTER_RAW_SIZE 4
42 /* mvs_check *_REGNUM */
44 #define STRUCT_RETURN_REGNUM 0
46 #define ARGLAST_REGNUM 3
58 #define ACCL_REGNUM 22
59 #define ACCH_REGNUM 23
61 /* mvs_check REGISTER_BYTES */
62 #define REGISTER_BYTES (NUM_REGS * 4)
64 /* mvs_check REGISTER_VIRTUAL_TYPE */
65 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
67 /* mvs_check REGISTER_BYTE */
68 #define REGISTER_BYTE(REG) ((REG) * 4)
69 /* mvs_check REGISTER_VIRTUAL_SIZE */
70 #define REGISTER_VIRTUAL_SIZE(REG) 4
71 /* mvs_check REGISTER_RAW_SIZE */
72 #define REGISTER_RAW_SIZE(REG) 4
74 /* mvs_check MAX_REGISTER_VIRTUAL_SIZE */
75 #define MAX_REGISTER_VIRTUAL_SIZE 4
77 /* mvs_check BREAKPOINT */
78 #define BREAKPOINT {0x10, 0xf1}
80 /* mvs_no_check FUNCTION_START_OFFSET */
81 #define FUNCTION_START_OFFSET 0
83 /* mvs_check DECR_PC_AFTER_BREAK */
84 #define DECR_PC_AFTER_BREAK 0
86 /* mvs_check INNER_THAN */
87 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
89 /* mvs_check SAVED_PC_AFTER_CALL */
90 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
93 struct frame_saved_regs;
97 /* Define other aspects of the stack frame.
98 We keep the offsets of all saved registers, 'cause we need 'em a lot!
99 We also keep the current size of the stack frame, and whether
100 the frame pointer is valid (for frameless functions, and when we're
101 still in the prologue of a function with a frame) */
103 /* mvs_check EXTRA_FRAME_INFO */
104 #define EXTRA_FRAME_INFO \
105 struct frame_saved_regs fsr; \
107 int using_frame_pointer;
110 extern void m32r_init_extra_frame_info (struct frame_info *fi);
111 /* mvs_check INIT_EXTRA_FRAME_INFO */
112 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) m32r_init_extra_frame_info (fi)
113 /* mvs_no_check DEPRECATED_INIT_FRAME_PC */
114 #define DEPRECATED_INIT_FRAME_PC init_frame_pc_noop
117 m32r_frame_find_saved_regs (struct frame_info *fi,
118 struct frame_saved_regs *regaddr);
120 /* Put here the code to store, into a struct frame_saved_regs,
121 the addresses of the saved registers of frame described by FRAME_INFO.
122 This includes special registers such as pc and fp saved in special
123 ways in the stack frame. sp is even more special:
124 the address we return for it IS the sp for the next frame. */
126 /* mvs_check FRAME_FIND_SAVED_REGS */
127 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
128 m32r_frame_find_saved_regs(frame_info, &(frame_saved_regs))
130 extern CORE_ADDR m32r_frame_chain (struct frame_info *fi);
131 /* mvs_check FRAME_CHAIN */
132 #define FRAME_CHAIN(fi) m32r_frame_chain (fi)
134 #define FRAME_CHAIN_VALID(fp, frame) generic_file_frame_chain_valid (fp, frame)
136 extern CORE_ADDR m32r_find_callers_reg (struct frame_info *fi, int regnum);
137 extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *);
138 /* mvs_check FRAME_SAVED_PC */
139 #define FRAME_SAVED_PC(fi) m32r_frame_saved_pc (fi)
141 /* mvs_check DEPRECATED_EXTRACT_RETURN_VALUE */
142 #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
144 (char *)(REGBUF) + REGISTER_BYTE (V0_REGNUM) + \
145 ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
148 /* mvs_check DEPRECATED_STORE_RETURN_VALUE */
149 #define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
150 deprecated_write_register_bytes(REGISTER_BYTE (V0_REGNUM) + \
151 ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
152 (VALBUF), TYPE_LENGTH (TYPE));
154 extern CORE_ADDR m32r_skip_prologue (CORE_ADDR pc);
155 /* mvs_check SKIP_PROLOGUE */
156 #define SKIP_PROLOGUE(pc) (m32r_skip_prologue (pc))
158 /* mvs_no_check FRAME_ARGS_SKIP */
159 #define FRAME_ARGS_SKIP 0
161 /* mvs_no_check FRAME_ARGS_ADDRESS */
162 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
163 /* mvs_no_check FRAME_LOCALS_ADDRESS */
164 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
165 /* mvs_no_check FRAME_NUM_ARGS */
166 #define FRAME_NUM_ARGS(fi) (-1)
168 extern void m32r_write_sp (CORE_ADDR val);
169 #define TARGET_WRITE_SP m32r_write_sp
176 /* struct passing and returning stuff */
177 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
178 write_register (0, STRUCT_ADDR)
180 extern use_struct_convention_fn m32r_use_struct_convention;
181 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) m32r_use_struct_convention (GCC_P, TYPE)
183 #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
184 extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
185 REGISTER_RAW_SIZE (V0_REGNUM))
187 #define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 8)
190 /* generic dummy frame stuff */
192 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
193 #define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
196 /* target-specific dummy_frame stuff */
198 extern struct frame_info *m32r_pop_frame (struct frame_info *frame);
199 /* mvs_check POP_FRAME */
200 #define POP_FRAME m32r_pop_frame (get_current_frame ())
202 /* mvs_no_check STACK_ALIGN */
203 /* #define STACK_ALIGN(x) ((x + 3) & ~3) */
205 extern CORE_ADDR m32r_push_return_address (CORE_ADDR, CORE_ADDR);
206 extern CORE_ADDR m32r_push_arguments (int nargs,
209 unsigned char struct_return,
210 CORE_ADDR struct_addr);
214 /* mvs_no_check PUSH_ARGUMENTS */
215 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
216 (m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
218 #define PUSH_RETURN_ADDRESS(PC, SP) m32r_push_return_address (PC, SP)
220 /* override the standard get_saved_register function with
221 one that takes account of generic CALL_DUMMY frames */
222 #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
223 deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
226 #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1
227 #define CALL_DUMMY {0}
228 #define CALL_DUMMY_LENGTH (0)
229 #define CALL_DUMMY_START_OFFSET (0)
230 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
231 #define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
232 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
233 #define CALL_DUMMY_ADDRESS() entry_point_address ()