]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Parameters for execution on an NEC V850 processor. |
2 | Copyright 1996 | |
3 | Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #define TARGET_BYTE_ORDER LITTLE_ENDIAN | |
22 | ||
23 | #define NUM_REGS 66 | |
24 | ||
25 | #define REGISTER_NAMES \ | |
26 | { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ | |
27 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ | |
28 | "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ | |
29 | "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ | |
30 | \ | |
31 | "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \ | |
32 | "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \ | |
33 | "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \ | |
34 | "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \ | |
35 | \ | |
36 | "pc", "fp" } | |
37 | ||
38 | /* Initializer for an array of names of registers. | |
39 | Entries beyond the first NUM_REGS are ignored. */ | |
40 | ||
41 | extern char **v850_register_names; | |
42 | #define REGISTER_NAME(i) v850_register_names[i] | |
43 | ||
44 | ||
45 | #define REGISTER_BYTES (NUM_REGS * 4) | |
46 | ||
47 | #define REGISTER_SIZE 4 | |
48 | #define MAX_REGISTER_RAW_SIZE 4 | |
49 | ||
50 | #define R0_REGNUM 0 | |
51 | #define R1_REGNUM 1 | |
52 | #define SAVE1_START_REGNUM 2 | |
53 | #define SAVE1_END_REGNUM 2 | |
54 | #define SP_REGNUM 3 | |
55 | #define ARG0_REGNUM 6 | |
56 | #define ARGLAST_REGNUM 9 | |
57 | #define V0_REGNUM 10 | |
58 | #define V1_REGNUM 11 | |
59 | #define R12_REGNUM 12 | |
60 | #define SAVE2_START_REGNUM 20 | |
61 | #define SAVE2_END_REGNUM 29 | |
62 | #define EP_REGNUM 30 | |
63 | #define SAVE3_START_REGNUM 31 | |
64 | #define SAVE3_END_REGNUM 31 | |
65 | #define RP_REGNUM 31 | |
66 | #define SR0_REGNUM 32 | |
67 | #define PS_REGNUM (SR0_REGNUM+5) | |
68 | #define CTBP_REGNUM (SR0_REGNUM+20) | |
69 | #define PC_REGNUM 64 | |
70 | #define FP_REGNUM 65 | |
71 | #define FP_RAW_REGNUM 29 | |
72 | ||
73 | #define TARGET_READ_FP() read_register (FP_RAW_REGNUM) | |
74 | #define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL)) | |
75 | ||
76 | #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int | |
77 | ||
78 | #define REGISTER_BYTE(REG) ((REG) * 4) | |
79 | #define REGISTER_VIRTUAL_SIZE(REG) 4 | |
80 | #define REGISTER_RAW_SIZE(REG) 4 | |
81 | ||
82 | #define MAX_REGISTER_VIRTUAL_SIZE 4 | |
83 | ||
84 | #define BREAKPOINT {0x40, 0xF8} /* little-ended */ | |
85 | ||
86 | #define FUNCTION_START_OFFSET 0 | |
87 | ||
88 | #define DECR_PC_AFTER_BREAK 0 | |
89 | ||
90 | #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) | |
91 | ||
92 | #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM) | |
93 | ||
94 | #ifdef __STDC__ | |
95 | struct frame_info; | |
96 | struct frame_saved_regs; | |
97 | struct type; | |
98 | struct value; | |
99 | #endif | |
100 | ||
101 | #define EXTRA_FRAME_INFO struct frame_saved_regs fsr; | |
102 | ||
103 | extern void v850_init_extra_frame_info PARAMS ((struct frame_info *fi)); | |
104 | #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) v850_init_extra_frame_info (fi) | |
105 | #define INIT_FRAME_PC /* Not necessary */ | |
106 | ||
107 | extern void v850_frame_find_saved_regs PARAMS ((struct frame_info *fi, struct frame_saved_regs *regaddr)); | |
108 | #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr | |
109 | ||
110 | extern CORE_ADDR v850_frame_chain PARAMS ((struct frame_info *fi)); | |
111 | #define FRAME_CHAIN(fi) v850_frame_chain (fi) | |
112 | #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI) | |
113 | ||
114 | extern CORE_ADDR v850_find_callers_reg PARAMS ((struct frame_info *fi, int regnum)); | |
115 | extern CORE_ADDR v850_frame_saved_pc PARAMS ((struct frame_info *)); | |
116 | #define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI)) | |
117 | ||
118 | #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ | |
119 | memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE)) | |
120 | ||
121 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ | |
122 | extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ | |
123 | REGISTER_RAW_SIZE (V0_REGNUM)) | |
124 | ||
125 | #define STORE_RETURN_VALUE(TYPE, VALBUF) \ | |
126 | write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE)); | |
127 | ||
128 | extern CORE_ADDR v850_skip_prologue PARAMS ((CORE_ADDR pc)); | |
b83266a0 | 129 | #define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc)) |
c906108c SS |
130 | |
131 | #define FRAME_ARGS_SKIP 0 | |
132 | ||
133 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
134 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
135 | #define FRAME_NUM_ARGS(val, fi) ((val) = -1) | |
136 | ||
137 | extern void v850_pop_frame PARAMS ((struct frame_info *frame)); | |
138 | #define POP_FRAME v850_pop_frame (get_current_frame ()) | |
139 | ||
7a292a7a | 140 | #define USE_GENERIC_DUMMY_FRAMES 1 |
c906108c SS |
141 | #define CALL_DUMMY {0} |
142 | #define CALL_DUMMY_START_OFFSET (0) | |
143 | #define CALL_DUMMY_BREAKPOINT_OFFSET (0) | |
144 | #define CALL_DUMMY_LOCATION AT_ENTRY_POINT | |
145 | #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) | |
146 | #define CALL_DUMMY_ADDRESS() entry_point_address () | |
147 | extern CORE_ADDR v850_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); | |
148 | #define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP) | |
149 | ||
150 | ||
151 | #define PUSH_DUMMY_FRAME generic_push_dummy_frame () | |
152 | ||
153 | extern CORE_ADDR | |
154 | v850_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp, | |
155 | unsigned char struct_return, | |
156 | CORE_ADDR struct_addr)); | |
157 | #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ | |
158 | (SP) = v850_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) | |
159 | ||
160 | #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) | |
161 | ||
162 | ||
7a292a7a | 163 | #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) |
c906108c SS |
164 | |
165 | extern use_struct_convention_fn v850_use_struct_convention; | |
166 | #define USE_STRUCT_CONVENTION(GCC_P, TYPE) v850_use_struct_convention (GCC_P, TYPE); | |
167 | ||
168 | /* override the default get_saved_register function with | |
169 | one that takes account of generic CALL_DUMMY frames */ | |
7a292a7a SS |
170 | #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ |
171 | generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) | |
c906108c SS |
172 | |
173 | /* Define this for Wingdb */ | |
174 | ||
175 | #define TARGET_V850 |