1 |
106 |
markom |
/* Parameters for execution on a Matsushita mn10300 processor.
|
2 |
|
|
Copyright 1996, 1997 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
Contributed by Geoffrey Noer <noer@cygnus.com>
|
5 |
|
|
|
6 |
|
|
This file is part of GDB.
|
7 |
|
|
|
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.
|
12 |
|
|
|
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.
|
17 |
|
|
|
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. */
|
22 |
|
|
|
23 |
|
|
/* The mn10300 is little endian. */
|
24 |
|
|
#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
|
25 |
|
|
|
26 |
|
|
/* All registers are 32bits (phew!). */
|
27 |
|
|
#define REGISTER_SIZE 4
|
28 |
|
|
#define MAX_REGISTER_RAW_SIZE 4
|
29 |
|
|
#define NUM_REGS 32
|
30 |
|
|
|
31 |
|
|
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
|
32 |
|
|
|
33 |
|
|
#define REGISTER_BYTE(REG) ((REG) * 4)
|
34 |
|
|
#define REGISTER_VIRTUAL_SIZE(REG) 4
|
35 |
|
|
#define REGISTER_RAW_SIZE(REG) 4
|
36 |
|
|
|
37 |
|
|
#define MAX_REGISTER_VIRTUAL_SIZE 4
|
38 |
|
|
|
39 |
|
|
#define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
|
40 |
|
|
|
41 |
|
|
extern char *mn10300_register_name PARAMS ((int regnr));
|
42 |
|
|
#define REGISTER_NAME(i) (mn10300_register_name (i))
|
43 |
|
|
|
44 |
|
|
#define D2_REGNUM 2
|
45 |
|
|
#define D3_REGNUM 3
|
46 |
|
|
#define A2_REGNUM 6
|
47 |
|
|
#define A3_REGNUM 7
|
48 |
|
|
#define SP_REGNUM 8
|
49 |
|
|
#define PC_REGNUM 9
|
50 |
|
|
#define MDR_REGNUM 10
|
51 |
|
|
#define PSW_REGNUM 11
|
52 |
|
|
#define LIR_REGNUM 12
|
53 |
|
|
#define LAR_REGNUM 13
|
54 |
|
|
#define E0_REGNUM 14
|
55 |
|
|
|
56 |
|
|
/* Pseudo register that contains true address of executing stack frame */
|
57 |
|
|
#define FP_REGNUM 31
|
58 |
|
|
|
59 |
|
|
/* BREAKPOINT_FROM_PC uses the program counter value to determine the
|
60 |
|
|
breakpoint that should be used */
|
61 |
|
|
extern breakpoint_from_pc_fn mn10300_breakpoint_from_pc;
|
62 |
|
|
#define BREAKPOINT_FROM_PC(pcptr, lenptr) mn10300_breakpoint_from_pc (pcptr, lenptr)
|
63 |
|
|
|
64 |
|
|
#define FUNCTION_START_OFFSET 0
|
65 |
|
|
|
66 |
|
|
#define DECR_PC_AFTER_BREAK 0
|
67 |
|
|
|
68 |
|
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
69 |
|
|
|
70 |
|
|
extern CORE_ADDR mn10300_saved_pc_after_call PARAMS ((struct frame_info * frame));
|
71 |
|
|
#define SAVED_PC_AFTER_CALL(frame) \
|
72 |
|
|
mn10300_saved_pc_after_call (frame)
|
73 |
|
|
|
74 |
|
|
struct frame_info;
|
75 |
|
|
struct type;
|
76 |
|
|
struct value;
|
77 |
|
|
|
78 |
|
|
extern void mn10300_init_extra_frame_info PARAMS ((struct frame_info *));
|
79 |
|
|
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10300_init_extra_frame_info (fi)
|
80 |
|
|
#define INIT_FRAME_PC /* Not necessary */
|
81 |
|
|
|
82 |
|
|
#define FRAME_INIT_SAVED_REGS(fi) /* handled by init_extra_frame_info */
|
83 |
|
|
|
84 |
|
|
extern CORE_ADDR mn10300_frame_chain PARAMS ((struct frame_info *));
|
85 |
|
|
#define FRAME_CHAIN(fi) mn10300_frame_chain (fi)
|
86 |
|
|
#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
|
87 |
|
|
|
88 |
|
|
extern CORE_ADDR mn10300_find_callers_reg PARAMS ((struct frame_info *, int));
|
89 |
|
|
extern CORE_ADDR mn10300_frame_saved_pc PARAMS ((struct frame_info *));
|
90 |
|
|
#define FRAME_SAVED_PC(FI) (mn10300_frame_saved_pc (FI))
|
91 |
|
|
|
92 |
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
93 |
|
|
a function return value of type TYPE, and copy that, in virtual format,
|
94 |
|
|
into VALBUF. */
|
95 |
|
|
|
96 |
|
|
extern void mn10300_extract_return_value PARAMS ((struct type * type, char *regbuf, char *valbuf));
|
97 |
|
|
#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
|
98 |
|
|
mn10300_extract_return_value (TYPE, REGBUF, VALBUF)
|
99 |
|
|
|
100 |
|
|
CORE_ADDR mn10300_extract_struct_value_address PARAMS ((char *regbuf));
|
101 |
|
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
102 |
|
|
mn10300_extract_struct_value_address (REGBUF)
|
103 |
|
|
|
104 |
|
|
void mn10300_store_return_value PARAMS ((struct type * type, char *valbuf));
|
105 |
|
|
#define STORE_RETURN_VALUE(TYPE, VALBUF) \
|
106 |
|
|
mn10300_store_return_value (TYPE, VALBUF)
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
extern CORE_ADDR mn10300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
|
110 |
|
|
#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
|
111 |
|
|
(mn10300_store_struct_return (STRUCT_ADDR, SP))
|
112 |
|
|
|
113 |
|
|
extern CORE_ADDR mn10300_skip_prologue PARAMS ((CORE_ADDR));
|
114 |
|
|
#define SKIP_PROLOGUE(pc) (mn10300_skip_prologue (pc))
|
115 |
|
|
|
116 |
|
|
#define FRAME_ARGS_SKIP 0
|
117 |
|
|
|
118 |
|
|
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
|
119 |
|
|
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
|
120 |
|
|
#define FRAME_NUM_ARGS(fi) (-1)
|
121 |
|
|
|
122 |
|
|
extern void mn10300_pop_frame PARAMS ((struct frame_info *));
|
123 |
|
|
#define POP_FRAME mn10300_pop_frame (get_current_frame ())
|
124 |
|
|
|
125 |
|
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
126 |
|
|
#define CALL_DUMMY {0}
|
127 |
|
|
#define CALL_DUMMY_START_OFFSET (0)
|
128 |
|
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
129 |
|
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
130 |
|
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
131 |
|
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
132 |
|
|
|
133 |
|
|
#define TARGET_READ_FP() read_sp ()
|
134 |
|
|
|
135 |
|
|
extern CORE_ADDR mn10300_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
|
136 |
|
|
#define PUSH_RETURN_ADDRESS(PC, SP) mn10300_push_return_address (PC, SP)
|
137 |
|
|
|
138 |
|
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
139 |
|
|
#define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP)
|
140 |
|
|
|
141 |
|
|
extern CORE_ADDR
|
142 |
|
|
mn10300_push_arguments PARAMS ((int, struct value **, CORE_ADDR,
|
143 |
|
|
unsigned char, CORE_ADDR));
|
144 |
|
|
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
|
145 |
|
|
(mn10300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
|
146 |
|
|
|
147 |
|
|
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
|
148 |
|
|
|
149 |
|
|
#define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
|
150 |
|
|
(TYPE_LENGTH (TYPE) > 8)
|
151 |
|
|
|
152 |
|
|
extern use_struct_convention_fn mn10300_use_struct_convention;
|
153 |
|
|
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10300_use_struct_convention (GCC_P, TYPE)
|
154 |
|
|
|
155 |
|
|
/* override the default get_saved_register function with
|
156 |
|
|
one that takes account of generic CALL_DUMMY frames */
|
157 |
|
|
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
|
158 |
|
|
generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
|
159 |
|
|
|
160 |
|
|
/* Cons up virtual frame pointer for trace */
|
161 |
|
|
extern void mn10300_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *));
|
162 |
|
|
#define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
|
163 |
|
|
mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP))
|