1 /* Parameters for execution on a Matsushita mn10200 processor.
2 Copyright 1997 Free Software Foundation, Inc.
4 Contributed by Geoffrey Noer <noer@cygnus.com>
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* The mn10200 is little endian. */
24 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
26 /* ints are only 16bits on the mn10200. */
28 #define TARGET_INT_BIT 16
30 /* The mn10200 doesn't support long long types. */
31 #undef TARGET_LONG_LONG_BIT
32 #define TARGET_LONG_LONG_BIT 32
34 /* The mn10200 doesn't support double or long double either. */
35 #undef TARGET_DOUBLE_BIT
36 #undef TARGET_LONG_DOUBLE_BIT
37 #define TARGET_DOUBLE_BIT 32
38 #define TARGET_LONG_DOUBLE_BIT 32
40 /* Not strictly correct, but the machine independent code is not
41 ready to handle any of the basic sizes not being a power of two. */
43 #define TARGET_PTR_BIT 32
45 /* The mn10200 really has 24 bit registers but the simulator reads/writes
46 them as 32bit values, so we claim they're 32bits each. This may have
47 to be tweaked if the Matsushita emulator/board really deals with them
49 #define REGISTER_SIZE 4
51 #define MAX_REGISTER_RAW_SIZE REGISTER_SIZE
54 #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
56 #define REGISTER_NAMES \
57 { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "sp", \
66 /* Treat the registers as 32bit values. */
67 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_long
69 #define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE)
70 #define REGISTER_VIRTUAL_SIZE(REG) REGISTER_SIZE
71 #define REGISTER_RAW_SIZE(REG) REGISTER_SIZE
73 #define MAX_REGISTER_VIRTUAL_SIZE REGISTER_SIZE
75 /* The breakpoint instruction must be the same size as te smallest
76 instruction in the instruction set.
78 The Matsushita mn10x00 processors have single byte instructions
79 so we need a single byte breakpoint. Matsushita hasn't defined
80 one, so we defined it ourselves.
82 0xff is the only available single byte insn left on the mn10200. */
83 #define BREAKPOINT {0xff}
85 #define FUNCTION_START_OFFSET 0
87 #define DECR_PC_AFTER_BREAK 0
89 /* Stacks grow the normal way. */
90 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
92 #define SAVED_PC_AFTER_CALL(frame) \
93 (read_memory_integer (read_register (SP_REGNUM), REGISTER_SIZE) & 0xffffff)
97 struct frame_saved_regs
;
102 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size;
104 extern void mn10200_init_extra_frame_info
PARAMS ((struct frame_info
*));
105 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi)
106 #define INIT_FRAME_PC(x,y)
108 extern void mn10200_frame_find_saved_regs
PARAMS ((struct frame_info
*,
109 struct frame_saved_regs
*));
110 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
112 extern CORE_ADDR mn10200_frame_chain
PARAMS ((struct frame_info
*));
113 #define FRAME_CHAIN(fi) mn10200_frame_chain (fi)
114 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
116 extern CORE_ADDR mn10200_find_callers_reg
PARAMS ((struct frame_info
*, int));
117 extern CORE_ADDR mn10200_frame_saved_pc
PARAMS ((struct frame_info
*));
118 #define FRAME_SAVED_PC(FI) (mn10200_frame_saved_pc (FI))
120 /* Extract from an array REGBUF containing the (raw) register state
121 a function return value of type TYPE, and copy that, in virtual format,
124 #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
126 if (TYPE_LENGTH (TYPE) > 8) \
128 else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
130 memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), 2); \
131 memcpy (VALBUF + 2, REGBUF + REGISTER_BYTE (1), 2); \
133 else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
135 memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \
139 memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); \
143 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
144 extract_address (REGBUF + REGISTER_BYTE (4), \
145 REGISTER_RAW_SIZE (4))
147 #define STORE_RETURN_VALUE(TYPE, VALBUF) \
149 if (TYPE_LENGTH (TYPE) > 8) \
151 else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
153 write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \
154 write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \
156 else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
158 write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \
162 write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \
166 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
167 (SP) = mn10200_store_struct_return (STRUCT_ADDR, SP)
169 extern CORE_ADDR mn10200_skip_prologue
PARAMS ((CORE_ADDR
));
170 #define SKIP_PROLOGUE(pc) (mn10200_skip_prologue (pc))
172 #define FRAME_ARGS_SKIP 0
174 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
175 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
176 #define FRAME_NUM_ARGS(fi) (-1)
178 extern void mn10200_pop_frame
PARAMS ((struct frame_info
*));
179 #define POP_FRAME mn10200_pop_frame (get_current_frame ())
181 #define USE_GENERIC_DUMMY_FRAMES 1
182 #define CALL_DUMMY {0}
183 #define CALL_DUMMY_START_OFFSET (0)
184 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
185 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
186 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
187 #define CALL_DUMMY_ADDRESS() entry_point_address ()
189 extern CORE_ADDR mn10200_push_return_address
PARAMS ((CORE_ADDR
, CORE_ADDR
));
190 #define PUSH_RETURN_ADDRESS(PC, SP) mn10200_push_return_address (PC, SP)
192 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
195 mn10200_push_arguments
PARAMS ((int, struct value
**, CORE_ADDR
,
196 unsigned char, CORE_ADDR
));
197 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
198 (mn10200_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
200 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
202 #define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
203 (TYPE_LENGTH (TYPE) > 8)
205 extern use_struct_convention_fn mn10200_use_struct_convention
;
206 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10200_use_struct_convention (GCC_P, TYPE)
208 /* Override the default get_saved_register function with
209 one that takes account of generic CALL_DUMMY frames. */
210 #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
211 generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
213 /* Define this for Wingdb */
214 #define TARGET_MN10200