]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* 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 | ||
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
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. | |
c906108c | 12 | |
c5aa993b JM |
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. | |
c906108c | 17 | |
c5aa993b JM |
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. */ | |
c906108c SS |
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 | ||
0f71a2f6 JM |
41 | extern char *mn10300_register_name PARAMS ((int regnr)); |
42 | #define REGISTER_NAME(i) (mn10300_register_name (i)) | |
c906108c SS |
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 | ||
55 | /* Pseudo register that contains true address of executing stack frame */ | |
56 | #define FP_REGNUM 31 | |
57 | ||
58 | /* BREAKPOINT_FROM_PC uses the program counter value to determine the | |
59 | breakpoint that should be used */ | |
60 | extern breakpoint_from_pc_fn mn10300_breakpoint_from_pc; | |
61 | #define BREAKPOINT_FROM_PC(pcptr, lenptr) mn10300_breakpoint_from_pc (pcptr, lenptr) | |
62 | ||
63 | #define FUNCTION_START_OFFSET 0 | |
64 | ||
65 | #define DECR_PC_AFTER_BREAK 0 | |
66 | ||
67 | #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) | |
68 | ||
c5aa993b | 69 | extern CORE_ADDR mn10300_saved_pc_after_call PARAMS ((struct frame_info * frame)); |
c906108c | 70 | #define SAVED_PC_AFTER_CALL(frame) \ |
0f71a2f6 | 71 | mn10300_saved_pc_after_call (frame) |
c906108c SS |
72 | |
73 | #ifdef __STDC__ | |
74 | struct frame_info; | |
75 | struct type; | |
76 | struct value; | |
77 | #endif | |
78 | ||
79 | extern void mn10300_init_extra_frame_info PARAMS ((struct frame_info *)); | |
80 | #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10300_init_extra_frame_info (fi) | |
81 | #define INIT_FRAME_PC /* Not necessary */ | |
82 | ||
c5aa993b | 83 | #define FRAME_INIT_SAVED_REGS(fi) /* handled by init_extra_frame_info */ |
c906108c SS |
84 | |
85 | extern CORE_ADDR mn10300_frame_chain PARAMS ((struct frame_info *)); | |
86 | #define FRAME_CHAIN(fi) mn10300_frame_chain (fi) | |
87 | #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI) | |
88 | ||
89 | extern CORE_ADDR mn10300_find_callers_reg PARAMS ((struct frame_info *, int)); | |
c5aa993b | 90 | extern CORE_ADDR mn10300_frame_saved_pc PARAMS ((struct frame_info *)); |
c906108c SS |
91 | #define FRAME_SAVED_PC(FI) (mn10300_frame_saved_pc (FI)) |
92 | ||
93 | /* Extract from an array REGBUF containing the (raw) register state | |
94 | a function return value of type TYPE, and copy that, in virtual format, | |
95 | into VALBUF. */ | |
96 | ||
c5aa993b | 97 | extern void mn10300_extract_return_value PARAMS ((struct type * type, char *regbuf, char *valbuf)); |
c906108c | 98 | #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ |
0f71a2f6 | 99 | mn10300_extract_return_value (TYPE, REGBUF, VALBUF) |
c906108c | 100 | |
0f71a2f6 | 101 | CORE_ADDR mn10300_extract_struct_value_address PARAMS ((char *regbuf)); |
c906108c | 102 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ |
0f71a2f6 | 103 | mn10300_extract_struct_value_address (REGBUF) |
c906108c | 104 | |
c5aa993b | 105 | void mn10300_store_return_value PARAMS ((struct type * type, char *valbuf)); |
c906108c | 106 | #define STORE_RETURN_VALUE(TYPE, VALBUF) \ |
0f71a2f6 | 107 | mn10300_store_return_value (TYPE, VALBUF) |
c906108c SS |
108 | |
109 | #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \ | |
0f71a2f6 | 110 | (mn10300_store_struct_return (STRUCT_ADDR, SP)) |
c906108c SS |
111 | |
112 | extern CORE_ADDR mn10300_skip_prologue PARAMS ((CORE_ADDR)); | |
b83266a0 | 113 | #define SKIP_PROLOGUE(pc) (mn10300_skip_prologue (pc)) |
c906108c SS |
114 | |
115 | #define FRAME_ARGS_SKIP 0 | |
116 | ||
117 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
118 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
392a587b | 119 | #define FRAME_NUM_ARGS(fi) (-1) |
c906108c SS |
120 | |
121 | extern void mn10300_pop_frame PARAMS ((struct frame_info *)); | |
122 | #define POP_FRAME mn10300_pop_frame (get_current_frame ()) | |
123 | ||
7a292a7a | 124 | #define USE_GENERIC_DUMMY_FRAMES 1 |
c906108c SS |
125 | #define CALL_DUMMY {0} |
126 | #define CALL_DUMMY_START_OFFSET (0) | |
127 | #define CALL_DUMMY_BREAKPOINT_OFFSET (0) | |
128 | #define CALL_DUMMY_LOCATION AT_ENTRY_POINT | |
129 | #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) | |
130 | #define CALL_DUMMY_ADDRESS() entry_point_address () | |
131 | ||
43ff13b4 JM |
132 | #define TARGET_READ_FP() read_sp () |
133 | ||
c906108c SS |
134 | extern CORE_ADDR mn10300_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); |
135 | #define PUSH_RETURN_ADDRESS(PC, SP) mn10300_push_return_address (PC, SP) | |
136 | ||
137 | #define PUSH_DUMMY_FRAME generic_push_dummy_frame () | |
43ff13b4 | 138 | #define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP) |
c906108c SS |
139 | |
140 | extern CORE_ADDR | |
c5aa993b JM |
141 | mn10300_push_arguments PARAMS ((int, struct value **, CORE_ADDR, |
142 | unsigned char, CORE_ADDR)); | |
c906108c | 143 | #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ |
392a587b | 144 | (mn10300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)) |
c906108c | 145 | |
7a292a7a | 146 | #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) |
c906108c SS |
147 | |
148 | #define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \ | |
149 | (TYPE_LENGTH (TYPE) > 8) | |
150 | ||
151 | extern use_struct_convention_fn mn10300_use_struct_convention; | |
152 | #define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10300_use_struct_convention (GCC_P, TYPE) | |
153 | ||
154 | /* override the default get_saved_register function with | |
155 | one that takes account of generic CALL_DUMMY frames */ | |
7a292a7a SS |
156 | #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ |
157 | generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) | |
c906108c SS |
158 | |
159 | /* Cons up virtual frame pointer for trace */ | |
160 | extern void mn10300_virtual_frame_pointer PARAMS ((CORE_ADDR, long *, long *)); | |
161 | #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \ | |
162 | mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP)) |