1 |
578 |
markom |
/* Parameters for execution on an NEC V850 processor.
|
2 |
|
|
Copyright 1996, 1997, 1998, 1999, 2000
|
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 |
|
|
#include "regcache.h"
|
23 |
|
|
|
24 |
|
|
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
|
25 |
|
|
|
26 |
|
|
#define NUM_REGS 66
|
27 |
|
|
|
28 |
|
|
#define REGISTER_NAMES \
|
29 |
|
|
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
|
30 |
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
|
31 |
|
|
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
|
32 |
|
|
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
|
33 |
|
|
\
|
34 |
|
|
"eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \
|
35 |
|
|
"sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \
|
36 |
|
|
"sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \
|
37 |
|
|
"sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \
|
38 |
|
|
\
|
39 |
|
|
"pc", "fp" }
|
40 |
|
|
|
41 |
|
|
/* Initializer for an array of names of registers.
|
42 |
|
|
Entries beyond the first NUM_REGS are ignored. */
|
43 |
|
|
|
44 |
|
|
extern char **v850_register_names;
|
45 |
|
|
#define REGISTER_NAME(i) v850_register_names[i]
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
#define REGISTER_BYTES (NUM_REGS * 4)
|
49 |
|
|
|
50 |
|
|
#define REGISTER_SIZE 4
|
51 |
|
|
#define MAX_REGISTER_RAW_SIZE 4
|
52 |
|
|
|
53 |
|
|
#define R0_REGNUM 0
|
54 |
|
|
#define R1_REGNUM 1
|
55 |
|
|
#define SAVE1_START_REGNUM 2
|
56 |
|
|
#define SAVE1_END_REGNUM 2
|
57 |
|
|
#define SP_REGNUM 3
|
58 |
|
|
#define ARG0_REGNUM 6
|
59 |
|
|
#define ARGLAST_REGNUM 9
|
60 |
|
|
#define V0_REGNUM 10
|
61 |
|
|
#define V1_REGNUM 11
|
62 |
|
|
#define R12_REGNUM 12
|
63 |
|
|
#define SAVE2_START_REGNUM 20
|
64 |
|
|
#define SAVE2_END_REGNUM 29
|
65 |
|
|
#define EP_REGNUM 30
|
66 |
|
|
#define SAVE3_START_REGNUM 31
|
67 |
|
|
#define SAVE3_END_REGNUM 31
|
68 |
|
|
#define RP_REGNUM 31
|
69 |
|
|
#define SR0_REGNUM 32
|
70 |
|
|
#define PS_REGNUM (SR0_REGNUM+5)
|
71 |
|
|
#define CTBP_REGNUM (SR0_REGNUM+20)
|
72 |
|
|
#define PC_REGNUM 64
|
73 |
|
|
#define FP_REGNUM 65
|
74 |
|
|
#define FP_RAW_REGNUM 29
|
75 |
|
|
|
76 |
|
|
#define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
|
77 |
|
|
#define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL))
|
78 |
|
|
|
79 |
|
|
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
|
80 |
|
|
|
81 |
|
|
#define REGISTER_BYTE(REG) ((REG) * 4)
|
82 |
|
|
#define REGISTER_VIRTUAL_SIZE(REG) 4
|
83 |
|
|
#define REGISTER_RAW_SIZE(REG) 4
|
84 |
|
|
|
85 |
|
|
#define MAX_REGISTER_VIRTUAL_SIZE 4
|
86 |
|
|
|
87 |
|
|
#define BREAKPOINT {0x85, 0x05} /* little-ended */
|
88 |
|
|
|
89 |
|
|
#define FUNCTION_START_OFFSET 0
|
90 |
|
|
|
91 |
|
|
#define DECR_PC_AFTER_BREAK 0
|
92 |
|
|
|
93 |
|
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
|
94 |
|
|
|
95 |
|
|
#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
|
96 |
|
|
|
97 |
|
|
struct frame_info;
|
98 |
|
|
struct frame_saved_regs;
|
99 |
|
|
struct type;
|
100 |
|
|
struct value;
|
101 |
|
|
|
102 |
|
|
#define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
|
103 |
|
|
|
104 |
|
|
extern void v850_init_extra_frame_info (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 (struct frame_info *fi,
|
109 |
|
|
struct frame_saved_regs *regaddr);
|
110 |
|
|
#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
|
111 |
|
|
|
112 |
|
|
extern CORE_ADDR v850_frame_chain (struct frame_info *fi);
|
113 |
|
|
#define FRAME_CHAIN(fi) v850_frame_chain (fi)
|
114 |
|
|
#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
|
115 |
|
|
|
116 |
|
|
extern CORE_ADDR v850_find_callers_reg (struct frame_info *fi, int regnum);
|
117 |
|
|
extern CORE_ADDR v850_frame_saved_pc (struct frame_info *);
|
118 |
|
|
#define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI))
|
119 |
|
|
|
120 |
|
|
#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
|
121 |
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE))
|
122 |
|
|
|
123 |
|
|
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
|
124 |
|
|
extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
|
125 |
|
|
REGISTER_RAW_SIZE (V0_REGNUM))
|
126 |
|
|
|
127 |
|
|
#define STORE_RETURN_VALUE(TYPE, VALBUF) \
|
128 |
|
|
write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE));
|
129 |
|
|
|
130 |
|
|
extern CORE_ADDR v850_skip_prologue (CORE_ADDR pc);
|
131 |
|
|
#define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc))
|
132 |
|
|
|
133 |
|
|
#define FRAME_ARGS_SKIP 0
|
134 |
|
|
|
135 |
|
|
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
|
136 |
|
|
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
|
137 |
|
|
#define FRAME_NUM_ARGS(fi) (-1)
|
138 |
|
|
|
139 |
|
|
extern void v850_pop_frame (struct frame_info *frame);
|
140 |
|
|
#define POP_FRAME v850_pop_frame (get_current_frame ())
|
141 |
|
|
|
142 |
|
|
#define USE_GENERIC_DUMMY_FRAMES 1
|
143 |
|
|
#define CALL_DUMMY {0}
|
144 |
|
|
#define CALL_DUMMY_START_OFFSET (0)
|
145 |
|
|
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
|
146 |
|
|
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
|
147 |
|
|
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
|
148 |
|
|
#define CALL_DUMMY_ADDRESS() entry_point_address ()
|
149 |
|
|
extern CORE_ADDR v850_push_return_address (CORE_ADDR, CORE_ADDR);
|
150 |
|
|
#define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP)
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
|
154 |
|
|
|
155 |
|
|
extern CORE_ADDR
|
156 |
|
|
v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
157 |
|
|
unsigned char struct_return, 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
|