1 |
1181 |
sfurman |
/* Parameters for execution on a Matsushita mn10200 processor.
|
2 |
|
|
|
3 |
|
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
|
4 |
|
|
Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
Contributed by Geoffrey Noer <noer@cygnus.com>
|
7 |
|
|
|
8 |
|
|
This file is part of GDB.
|
9 |
|
|
|
10 |
|
|
This program is free software; you can redistribute it and/or modify
|
11 |
|
|
it under the terms of the GNU General Public License as published by
|
12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
(at your option) any later version.
|
14 |
|
|
|
15 |
|
|
This program is distributed in the hope that it will be useful,
|
16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
GNU General Public License for more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License
|
21 |
|
|
along with this program; if not, write to the Free Software
|
22 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
23 |
|
|
Boston, MA 02111-1307, USA. */
|
24 |
|
|
|
25 |
|
|
/* FIXME: cagney/2001-03-01: The below macros refer to functions
|
26 |
|
|
declared in "regcache.h". The ``correct fix'' is to convert those
|
27 |
|
|
macros into functions. */
|
28 |
|
|
#include "regcache.h"
|
29 |
|
|
#include "symtab.h" /* For namespace_enum. */
|
30 |
|
|
#include "symfile.h" /* For entry_point_address(). */
|
31 |
|
|
|
32 |
|
|
/* ints are only 16bits on the mn10200. */
|
33 |
|
|
#undef TARGET_INT_BIT
|
34 |
|
|
#define TARGET_INT_BIT 16
|
35 |
|
|
|
36 |
|
|
/* The mn10200 doesn't support long long types. */
|
37 |
|
|
#undef TARGET_LONG_LONG_BIT
|
38 |
|
|
#define TARGET_LONG_LONG_BIT 32
|
39 |
|
|
|
40 |
|
|
/* The mn10200 doesn't support double or long double either. */
|
41 |
|
|
#undef TARGET_DOUBLE_BIT
|
42 |
|
|
#undef TARGET_LONG_DOUBLE_BIT
|
43 |
|
|
#define TARGET_DOUBLE_BIT 32
|
44 |
|
|
#define TARGET_LONG_DOUBLE_BIT 32
|
45 |
|
|
|
46 |
|
|
/* Not strictly correct, but the machine independent code is not
|
47 |
|
|
ready to handle any of the basic sizes not being a power of two. */
|
48 |
|
|
#undef TARGET_PTR_BIT
|
49 |
|
|
#define TARGET_PTR_BIT 32
|
50 |
|
|
|
51 |
|
|
/* The mn10200 really has 24 bit registers but the simulator reads/writes
|
52 |
|
|
them as 32bit values, so we claim they're 32bits each. This may have
|
53 |
|
|
to be tweaked if the Matsushita emulator/board really deals with them
|
54 |
|
|
as 24bits each. */
|
55 |
|
|
#define REGISTER_SIZE 4
|
56 |
|
|
|
57 |
|
|
#define MAX_REGISTER_RAW_SIZE REGISTER_SIZE
|
58 |
|
|
#define NUM_REGS 11
|
59 |
|
|
|
60 |
|
|
#define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
|
61 |
|
|
|
62 |
|
|
#define REGISTER_NAMES \
|
63 |
|
|
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "sp", \
|
64 |
|
|
"pc", "mdr", "psw"}
|
65 |
|
|
|
66 |
|
|
#define FP_REGNUM 6
|
67 |
|
|
#define SP_REGNUM 7
|
68 |
|
|
#define PC_REGNUM 8
|
69 |
|
|
#define MDR_REGNUM 9
|
70 |
|
|
#define PSW_REGNUM 10
|
71 |
|
|
|
72 |
|
|
/* Treat the registers as 32bit values. */
|
73 |
|
|
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_long
|
74 |
|
|
|
75 |
|
|
#define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE)
|
76 |
|
|
#define REGISTER_VIRTUAL_SIZE(REG) REGISTER_SIZE
|
77 |
|
|
#define REGISTER_RAW_SIZE(REG) REGISTER_SIZE
|
78 |
|
|
|
79 |
|
|
#define MAX_REGISTER_VIRTUAL_SIZE REGISTER_SIZE
|
80 |
|
|
|
81 |
|
|
/* The breakpoint instruction must be the same size as te smallest
|
82 |
|
|
instruction in the instruction set.
|
83 |
|
|
|
84 |
|
|
The Matsushita mn10x00 processors have single byte instructions
|
85 |
|
|
so we need a single byte breakpoint. Matsushita hasn't defined
|
86 |
|
|
one, so we defined it ourselves.
|
87 |
|
|
|
88 |
|
|
0xff is the only available single byte insn left on the mn10200. */
|
89 |
|
|
#define BREAKPOINT {0xff}
|
90 |
|
|
|
91 |
|
|
#define FUNCTION_START_OFFSET 0
|
92 |
|
|
|
93 |
|
|
#define DECR_PC_AFTER_BREAK 0
|
94 |
|
|
|
95 |
|
|
/* Stacks grow the normal way. */
|
96 |
|
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
97 |
|
|
|
98 |
|
|
#define SAVED_PC_AFTER_CALL(frame) \
|
99 |
|
|
(read_memory_integer (read_register (SP_REGNUM), REGISTER_SIZE) & 0xffffff)
|
100 |
|
|
|
101 |
|
|
struct frame_info;
|
102 |
|
|
struct frame_saved_regs;
|
103 |
|
|
struct type;
|
104 |
|
|
struct value;
|
105 |
|
|
|
106 |
|
|
#define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size;
|
107 |
|
|
|
108 |
|
|
extern void mn10200_init_extra_frame_info (struct frame_info *);
|
109 |
|
|
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi)
|
110 |
|
|
#define INIT_FRAME_PC(x,y)
|
111 |
|
|
|
112 |
|
|
extern void mn10200_frame_find_saved_regs (struct frame_info *,
|
113 |
|
|
struct frame_saved_regs *);
|
114 |
|
|
#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
|
115 |
|
|
|
116 |
|
|
extern CORE_ADDR mn10200_frame_chain (struct frame_info *);
|
117 |
|
|
#define FRAME_CHAIN(fi) mn10200_frame_chain (fi)
|
118 |
|
|
#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
|
119 |
|
|
|
120 |
|
|
extern CORE_ADDR mn10200_find_callers_reg (struct frame_info *, int);
|
121 |
|
|
extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *);
|
122 |
|
|
#define FRAME_SAVED_PC(FI) (mn10200_frame_saved_pc (FI))
|
123 |
|
|
|
124 |
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
125 |
|
|
a function return value of type TYPE, and copy that, in virtual format,
|
126 |
|
|
into VALBUF. */
|
127 |
|
|
|
128 |
|
|
#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
|
129 |
|
|
{ \
|
130 |
|
|
if (TYPE_LENGTH (TYPE) > 8) \
|
131 |
|
|
internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
|
132 |
|
|
else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
|
133 |
|
|
{ \
|
134 |
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), 2); \
|
135 |
|
|
memcpy (VALBUF + 2, REGBUF + REGISTER_BYTE (1), 2); \
|
136 |
|
|
} \
|
137 |
|
|
else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
|
138 |
|
|
{ \
|
139 |
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \
|
140 |
|
|
} \
|
141 |
|
|
else \
|
142 |
|
|
{ \
|
143 |
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); \
|
144 |
|
|
} \
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
148 |
|
|
extract_address (REGBUF + REGISTER_BYTE (4), \
|
149 |
|
|
REGISTER_RAW_SIZE (4))
|
150 |
|
|
|
151 |
|
|
#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
|
152 |
|
|
{ \
|
153 |
|
|
if (TYPE_LENGTH (TYPE) > 8) \
|
154 |
|
|
internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
|
155 |
|
|
else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
|
156 |
|
|
{ \
|
157 |
|
|
write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \
|
158 |
|
|
write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \
|
159 |
|
|
} \
|
160 |
|
|
else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
|
161 |
|
|
{ \
|
162 |
|
|
write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \
|
163 |
|
|
} \
|
164 |
|
|
else \
|
165 |
|
|
{ \
|
166 |
|
|
write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \
|
167 |
|
|
} \
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
extern CORE_ADDR mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
|
172 |
|
|
#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
|
173 |
|
|
(SP) = mn10200_store_struct_return (STRUCT_ADDR, SP)
|
174 |
|
|
|
175 |
|
|
extern CORE_ADDR mn10200_skip_prologue (CORE_ADDR);
|
176 |
|
|
#define SKIP_PROLOGUE(pc) (mn10200_skip_prologue (pc))
|
177 |
|
|
|
178 |
|
|
#define FRAME_ARGS_SKIP 0
|
179 |
|
|
|
180 |
|
|
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
|
181 |
|
|
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
|
182 |
|
|
#define FRAME_NUM_ARGS(fi) (-1)
|
183 |
|
|
|
184 |
|
|
extern void mn10200_pop_frame (struct frame_info *);
|
185 |
|
|
#define POP_FRAME mn10200_pop_frame (get_current_frame ())
|
186 |
|
|
|
187 |
|
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
188 |
|
|
#define CALL_DUMMY {0}
|
189 |
|
|
#define CALL_DUMMY_START_OFFSET (0)
|
190 |
|
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
191 |
|
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
192 |
|
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
193 |
|
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
194 |
|
|
|
195 |
|
|
extern CORE_ADDR mn10200_push_return_address (CORE_ADDR, CORE_ADDR);
|
196 |
|
|
#define PUSH_RETURN_ADDRESS(PC, SP) mn10200_push_return_address (PC, SP)
|
197 |
|
|
|
198 |
|
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
199 |
|
|
|
200 |
|
|
extern CORE_ADDR mn10200_push_arguments (int, struct value **, CORE_ADDR,
|
201 |
|
|
unsigned char, CORE_ADDR);
|
202 |
|
|
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
|
203 |
|
|
(mn10200_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
|
204 |
|
|
|
205 |
|
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
206 |
|
|
|
207 |
|
|
#define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
|
208 |
|
|
(TYPE_LENGTH (TYPE) > 8)
|
209 |
|
|
|
210 |
|
|
extern use_struct_convention_fn mn10200_use_struct_convention;
|
211 |
|
|
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10200_use_struct_convention (GCC_P, TYPE)
|
212 |
|
|
|
213 |
|
|
/* Override the default get_saved_register function with
|
214 |
|
|
one that takes account of generic CALL_DUMMY frames. */
|
215 |
|
|
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
|
216 |
|
|
generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
|
217 |
|
|
|
218 |
|
|
/* Define this for Wingdb */
|
219 |
|
|
#define TARGET_MN10200
|