1 /* Parameters for execution on an NEC V850 processor.
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
22 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
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", \
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", \
39 /* Initializer for an array of names of registers.
40 Entries beyond the first NUM_REGS are ignored. */
42 extern char **v850_register_names
;
43 #define REGISTER_NAME(i) v850_register_names[i]
46 #define REGISTER_BYTES (NUM_REGS * 4)
48 #define REGISTER_SIZE 4
49 #define MAX_REGISTER_RAW_SIZE 4
53 #define SAVE1_START_REGNUM 2
54 #define SAVE1_END_REGNUM 2
57 #define ARGLAST_REGNUM 9
61 #define SAVE2_START_REGNUM 20
62 #define SAVE2_END_REGNUM 29
64 #define SAVE3_START_REGNUM 31
65 #define SAVE3_END_REGNUM 31
68 #define PS_REGNUM (SR0_REGNUM+5)
69 #define CTBP_REGNUM (SR0_REGNUM+20)
72 #define FP_RAW_REGNUM 29
74 #define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
75 #define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL))
77 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
79 #define REGISTER_BYTE(REG) ((REG) * 4)
80 #define REGISTER_VIRTUAL_SIZE(REG) 4
81 #define REGISTER_RAW_SIZE(REG) 4
83 #define MAX_REGISTER_VIRTUAL_SIZE 4
85 #define BREAKPOINT {0x40, 0xF8} /* little-ended */
87 #define FUNCTION_START_OFFSET 0
89 #define DECR_PC_AFTER_BREAK 0
91 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
93 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
97 struct frame_saved_regs
;
102 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
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 */
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
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)
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))
119 #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
120 memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE))
122 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
123 extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
124 REGISTER_RAW_SIZE (V0_REGNUM))
126 #define STORE_RETURN_VALUE(TYPE, VALBUF) \
127 write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE));
129 extern CORE_ADDR v850_skip_prologue
PARAMS ((CORE_ADDR pc
));
130 #define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc))
132 #define FRAME_ARGS_SKIP 0
134 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
135 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
136 #define FRAME_NUM_ARGS(fi) (-1)
138 extern void v850_pop_frame
PARAMS ((struct frame_info
* frame
));
139 #define POP_FRAME v850_pop_frame (get_current_frame ())
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)
152 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
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))
161 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)
164 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
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);
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)
174 /* Define this for Wingdb */