e01ee7224e43242b1151eed0879ec9184973e9d9
1 /* Parameters for execution on a TI TMS320C80 (MVP) processor.
2 Copyright 1997, 1999, 2000
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. */
25 /* Forward declare structs used in prototypes */
30 struct frame_saved_regs
;
32 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
36 #define REGISTER_NAMES \
37 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
38 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
39 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
40 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
42 "a0", "a1", "a2", "a3", \
45 /* Various dedicated register numbers
46 FIXME: Shadow updates in sim/tic80/sim-calls.c */
48 #define SP_REGNUM 1 /* Contains address of top of stack */
49 #define ARG0_REGNUM 2 /* Contains argument 1 (r3 has high word) */
50 #define RET_REGNUM 2 /* Contains function return value */
51 #define ARGLAST_REGNUM 12 /* Contains argument 6 (r13 has high word) */
52 #define FP_REGNUM 30 /* Contains address of executing stack frame */
53 #define LR_REGNUM 31 /* Contains address of caller (link register) */
54 #define PC_REGNUM 32 /* Contains program counter (FIXME?) */
55 #define NPC_REGNUM 33 /* Contains the next program counter (FIXME?) */
56 #define A0_REGNUM 34 /* Accumulator register 0 */
57 #define A3_REGNUM 37 /* Accumulator register 1 */
59 #define R0_REGNUM 0 /* General Purpose Register 0 - for sim */
60 #define Rn_REGNUM 31 /* Last General Purpose Register - for sim */
61 #define An_REGNUM A3_REGNUM /* Last Accumulator register - for sim */
63 /* Total amount of space needed to store our copies of the machine's
64 register state, the array `registers'. */
66 #define REGISTER_BYTES (((NUM_REGS - 4) * 4) + (4 * 8))
68 /* Index within `registers' of the first byte of the space for
71 #define REGISTER_BYTE(N) \
72 (((N) >= A0_REGNUM) ? (((N) - A0_REGNUM) * 8 + A0_REGNUM * 4) : ((N) * 4))
74 /* Most registers are 4 bytes */
76 #define REGISTER_SIZE 4
78 /* Some registers are 8 bytes. */
80 #define REGISTER_RAW_SIZE(N) \
81 (((N) >= A0_REGNUM) ? 8 : 4)
83 /* Largest value REGISTER_RAW_SIZE can have. */
85 #define MAX_REGISTER_RAW_SIZE (8)
87 /* All regs are 4 bytes. */
89 #define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
91 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
93 #define MAX_REGISTER_VIRTUAL_SIZE (MAX_REGISTER_RAW_SIZE)
95 /* Return the GDB type object for the "standard" data type
96 of data in register N. */
98 #define REGISTER_VIRTUAL_TYPE(N) /* FIXME? */ \
99 (((N) >= A0_REGNUM) ? builtin_type_float : builtin_type_int)
101 /* Offset from address of function to start of its code.
102 Zero on most machines. */
104 #define FUNCTION_START_OFFSET 0
106 /* Stack grows downward. */
108 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
110 /* Sequence of bytes for breakpoint instruction.
111 This is padded out to the size of a machine word. */
113 #define BREAKPOINT {0x49, 0x80, 0x00, 0x00} /* FIXME! */
115 /* Amount PC must be decremented by after a breakpoint.
116 This is often the number of bytes in BREAKPOINT
119 #define DECR_PC_AFTER_BREAK 0 /* FIXME! */
121 /* Discard from the stack the innermost frame, restoring all registers. */
123 #define POP_FRAME tic80_pop_frame(get_current_frame ())
124 extern struct frame_info
*tic80_pop_frame (struct frame_info
*frame
);
126 /* Return number of bytes at start of arglist that are not really args. */
128 #define FRAME_ARGS_SKIP 0
130 /* Set VAL to the number of args passed to frame described by FI.
131 Can set VAL to -1, meaning no way to tell. */
132 /* We can't tell how many args there are */
134 #define FRAME_NUM_ARGS(fi) (-1)
136 #define FRAME_ARGS_SKIP 0
137 #define FRAME_ARGS_ADDRESS(fi) (fi)->frame
138 #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
140 /* Define other aspects of the stack frame.
141 We keep the offsets of all saved registers, 'cause we need 'em a lot!
142 We also keep the current size of the stack frame, and the offset of
143 the frame pointer from the stack pointer (for frameless functions, and
144 when we're still in the prologue of a function with a frame) */
146 #define EXTRA_FRAME_INFO \
147 struct frame_saved_regs fsr; \
152 extern void tic80_init_extra_frame_info (struct frame_info
*fi
);
153 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) tic80_init_extra_frame_info (fi)
154 #define INIT_FRAME_PC /* Not necessary */
156 /* Put here the code to store, into a struct frame_saved_regs,
157 the addresses of the saved registers of frame described by FRAME_INFO.
158 This includes special registers such as pc and fp saved in special
159 ways in the stack frame. sp is even more special:
160 the address we return for it IS the sp for the next frame. */
162 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
163 tic80_frame_find_saved_regs(frame_info, &(frame_saved_regs))
164 extern void tic80_frame_find_saved_regs (struct frame_info
*,
165 struct frame_saved_regs
*);
167 /* Advance PC across any function entry prologue instructions
168 to reach some "real" code. */
170 #define SKIP_PROLOGUE(pc) (tic80_skip_prologue (pc))
171 extern CORE_ADDR
tic80_skip_prologue (CORE_ADDR pc
);
173 /* Immediately after a function call, return the saved pc.
174 Can't always go through the frames for this because on some machines
175 the new frame is not set up until the new function executes
176 some instructions. */
178 #define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
180 /* Describe the pointer in each stack frame to the previous stack frame
183 /* FRAME_CHAIN takes a frame's nominal address
184 and produces the frame's chain-pointer. */
186 #define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
187 extern CORE_ADDR
tic80_frame_chain (struct frame_info
*);
189 #define FRAME_SAVED_PC(FRAME) tic80_frame_saved_pc (FRAME)
190 extern CORE_ADDR
tic80_frame_saved_pc (struct frame_info
*);
192 /* Store the address of the place in which to copy the structure the
193 subroutine will return. This is called from call_function.
195 We store structs through a pointer passed in R2 */
197 #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
198 write_register (ARG0_REGNUM, STRUCT_ADDR)
200 /* Extract from an array REGBUF containing the (raw) register state
201 a function return value of type TYPE, and copy that, in virtual format,
204 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
206 (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
207 ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
210 /* Write into appropriate registers a function return value
211 of type TYPE, given in virtual format. */
213 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
214 write_register_bytes(REGISTER_BYTE (RET_REGNUM) + \
215 ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
216 (VALBUF), TYPE_LENGTH (TYPE));
221 extern CORE_ADDR
tic80_push_arguments (int nargs
,
224 unsigned char struct_return
,
225 CORE_ADDR struct_addr
);
227 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
228 (tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
230 /* PUSH_RETURN_ADDRESS */
231 extern CORE_ADDR
tic80_push_return_address (CORE_ADDR
, CORE_ADDR
);
232 #define PUSH_RETURN_ADDRESS(PC, SP) tic80_push_return_address (PC, SP)
234 /* override the standard get_saved_register function with
235 one that takes account of generic CALL_DUMMY frames */
236 #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
237 generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
239 #define USE_GENERIC_DUMMY_FRAMES 1
240 #define CALL_DUMMY {0}
241 #define CALL_DUMMY_LENGTH (0)
242 #define CALL_DUMMY_START_OFFSET (0)
243 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
244 #define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
245 #define CALL_DUMMY_LOCATION AT_ENTRY_POINT
246 #define CALL_DUMMY_ADDRESS() entry_point_address ()
248 /* generic dummy frame stuff */
250 #define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
251 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
253 #endif /* TM_TIC80_H */
This page took 0.040063 seconds and 4 git commands to generate.