1 /* Parameters for execution on a Matsushita mn10300 processor.
2 Copyright 1996, 1997 Free Software Foundation, Inc.
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, Boston, MA 02111-1307, USA. */
22 /* The mn10300 is little endian. */
23 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
25 /* All registers are 32bits (phew!). */
26 #define REGISTER_SIZE 4
27 #define MAX_REGISTER_RAW_SIZE 4
30 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
32 #define REGISTER_BYTE(REG) ((REG) * 4)
33 #define REGISTER_VIRTUAL_SIZE(REG) 4
34 #define REGISTER_RAW_SIZE(REG) 4
36 #define MAX_REGISTER_VIRTUAL_SIZE 4
38 #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
40 extern char **mn10300_register_names;
41 #define REGISTER_NAME(i) mn10300_register_names[i]
53 /* start-sanitize-am33 */
55 /* end-sanitize-am33 */
57 /* Pseudo register that contains true address of executing stack frame */
60 /* BREAKPOINT_FROM_PC uses the program counter value to determine the
61 breakpoint that should be used */
62 extern breakpoint_from_pc_fn mn10300_breakpoint_from_pc;
63 #define BREAKPOINT_FROM_PC(pcptr, lenptr) mn10300_breakpoint_from_pc (pcptr, lenptr)
65 #define FUNCTION_START_OFFSET 0
67 #define DECR_PC_AFTER_BREAK 0
69 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
71 #define SAVED_PC_AFTER_CALL(frame) \
72 read_memory_integer (read_register (SP_REGNUM), 4)
76 struct frame_saved_regs;
81 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size;
83 extern void mn10300_init_extra_frame_info PARAMS ((struct frame_info *));
84 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10300_init_extra_frame_info (fi)
85 #define INIT_FRAME_PC /* Not necessary */
87 extern void mn10300_frame_find_saved_regs PARAMS ((struct frame_info *,
88 struct frame_saved_regs *));
89 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
91 extern CORE_ADDR mn10300_frame_chain PARAMS ((struct frame_info *));
92 #define FRAME_CHAIN(fi) mn10300_frame_chain (fi)
93 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
95 extern CORE_ADDR mn10300_find_callers_reg PARAMS ((struct frame_info *, int));
96 extern CORE_ADDR mn10300_frame_saved_pc PARAMS ((struct frame_info *));
97 #define FRAME_SAVED_PC(FI) (mn10300_frame_saved_pc (FI))
99 /* Extract from an array REGBUF containing the (raw) register state
100 a function return value of type TYPE, and copy that, in virtual format,
103 #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
104 if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
105 memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \
107 memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE));
110 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
111 extract_address (REGBUF + REGISTER_BYTE (4), \
112 REGISTER_RAW_SIZE (4))
114 #define STORE_RETURN_VALUE(TYPE, VALBUF) \
115 if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
116 write_register_bytes(REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \
118 write_register_bytes(REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE));
120 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
121 (SP) = mn10300_store_struct_return (STRUCT_ADDR, SP)
123 extern CORE_ADDR mn10300_skip_prologue PARAMS ((CORE_ADDR));
124 #define SKIP_PROLOGUE(pc) pc = mn10300_skip_prologue (pc)
126 #define FRAME_ARGS_SKIP 0
128 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
129 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
130 #define FRAME_NUM_ARGS(val, fi) ((val) = -1)
132 extern void mn10300_pop_frame PARAMS ((struct frame_info *));
133 #define POP_FRAME mn10300_pop_frame (get_current_frame ())
135 #define USE_GENERIC_DUMMY_FRAMES
136 #define CALL_DUMMY {0}
137 #define CALL_DUMMY_START_OFFSET (0)
138 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
139 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
140 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
141 #define CALL_DUMMY_ADDRESS() entry_point_address ()
143 extern CORE_ADDR mn10300_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
144 #define PUSH_RETURN_ADDRESS(PC, SP) mn10300_push_return_address (PC, SP)
146 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
149 mn10300_push_arguments PARAMS ((int, struct value **, CORE_ADDR,
150 unsigned char, CORE_ADDR ));
151 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
152 (SP) = mn10300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
154 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
156 #define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
157 (TYPE_LENGTH (TYPE) > 8)
159 extern use_struct_convention_fn mn10300_use_struct_convention;
160 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10300_use_struct_convention (GCC_P, TYPE)
162 /* override the default get_saved_register function with
163 one that takes account of generic CALL_DUMMY frames */
164 #define GET_SAVED_REGISTER
166 /* Cons up virtual frame pointer for trace */
167 extern void mn10300_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *));
168 #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
169 mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP))
171 /* Define this for Wingdb */
173 #define TARGET_MN10300