]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/v850/tm-v850.h
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / config / v850 / tm-v850.h
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,
20 Boston, MA 02111-1307, USA. */
21
22 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
23
24 #define NUM_REGS 66
25
26 #define REGISTER_NAMES \
27 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
28 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
29 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
30 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
31 \
32 "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \
33 "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \
34 "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \
35 "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \
36 \
37 "pc", "fp" }
38
39 /* Initializer for an array of names of registers.
40 Entries beyond the first NUM_REGS are ignored. */
41
42 extern char **v850_register_names;
43 #define REGISTER_NAME(i) v850_register_names[i]
44
45
46 #define REGISTER_BYTES (NUM_REGS * 4)
47
48 #define REGISTER_SIZE 4
49 #define MAX_REGISTER_RAW_SIZE 4
50
51 #define R0_REGNUM 0
52 #define R1_REGNUM 1
53 #define SAVE1_START_REGNUM 2
54 #define SAVE1_END_REGNUM 2
55 #define SP_REGNUM 3
56 #define ARG0_REGNUM 6
57 #define ARGLAST_REGNUM 9
58 #define V0_REGNUM 10
59 #define V1_REGNUM 11
60 #define R12_REGNUM 12
61 #define SAVE2_START_REGNUM 20
62 #define SAVE2_END_REGNUM 29
63 #define EP_REGNUM 30
64 #define SAVE3_START_REGNUM 31
65 #define SAVE3_END_REGNUM 31
66 #define RP_REGNUM 31
67 #define SR0_REGNUM 32
68 #define PS_REGNUM (SR0_REGNUM+5)
69 #define CTBP_REGNUM (SR0_REGNUM+20)
70 #define PC_REGNUM 64
71 #define FP_REGNUM 65
72 #define FP_RAW_REGNUM 29
73
74 #define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
75 #define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL))
76
77 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
78
79 #define REGISTER_BYTE(REG) ((REG) * 4)
80 #define REGISTER_VIRTUAL_SIZE(REG) 4
81 #define REGISTER_RAW_SIZE(REG) 4
82
83 #define MAX_REGISTER_VIRTUAL_SIZE 4
84
85 #define BREAKPOINT {0x40, 0xF8} /* little-ended */
86
87 #define FUNCTION_START_OFFSET 0
88
89 #define DECR_PC_AFTER_BREAK 0
90
91 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
92
93 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
94
95 #ifdef __STDC__
96 struct frame_info;
97 struct frame_saved_regs;
98 struct type;
99 struct value;
100 #endif
101
102 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
103
104 extern void v850_init_extra_frame_info PARAMS ((struct frame_info * fi));
105 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) v850_init_extra_frame_info (fi)
106 #define INIT_FRAME_PC /* Not necessary */
107
108 extern void v850_frame_find_saved_regs PARAMS ((struct frame_info * fi, struct frame_saved_regs * regaddr));
109 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
110
111 extern CORE_ADDR v850_frame_chain PARAMS ((struct frame_info * fi));
112 #define FRAME_CHAIN(fi) v850_frame_chain (fi)
113 #define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI)
114
115 extern CORE_ADDR v850_find_callers_reg PARAMS ((struct frame_info * fi, int regnum));
116 extern CORE_ADDR v850_frame_saved_pc PARAMS ((struct frame_info *));
117 #define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI))
118
119 #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
120 memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE))
121
122 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
123 extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
124 REGISTER_RAW_SIZE (V0_REGNUM))
125
126 #define STORE_RETURN_VALUE(TYPE, VALBUF) \
127 write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE));
128
129 extern CORE_ADDR v850_skip_prologue PARAMS ((CORE_ADDR pc));
130 #define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc))
131
132 #define FRAME_ARGS_SKIP 0
133
134 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
135 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
136 #define FRAME_NUM_ARGS(fi) (-1)
137
138 extern void v850_pop_frame PARAMS ((struct frame_info * frame));
139 #define POP_FRAME v850_pop_frame (get_current_frame ())
140
141 #define USE_GENERIC_DUMMY_FRAMES 1
142 #define CALL_DUMMY {0}
143 #define CALL_DUMMY_START_OFFSET (0)
144 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
145 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
146 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
147 #define CALL_DUMMY_ADDRESS() entry_point_address ()
148 extern CORE_ADDR v850_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
149 #define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP)
150
151
152 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
153
154 extern CORE_ADDR
155 v850_push_arguments PARAMS ((int nargs, struct value ** args, CORE_ADDR sp,
156 unsigned char struct_return,
157 CORE_ADDR struct_addr));
158 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
159 (v850_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
160
161 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)
162
163
164 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
165
166 extern use_struct_convention_fn v850_use_struct_convention;
167 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) v850_use_struct_convention (GCC_P, TYPE);
168
169 /* override the default get_saved_register function with
170 one that takes account of generic CALL_DUMMY frames */
171 #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
172 generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
173
174 /* Define this for Wingdb */
175
176 #define TARGET_V850