]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/config/tic80/tm-tic80.h
PARAMS removal.
[thirdparty/binutils-gdb.git] / gdb / config / tic80 / tm-tic80.h
CommitLineData
e49d4fa6
SS
1/* Parameters for execution on a TI TMS320C80 (MVP) processor.
2 Copyright 1997
3 Free Software Foundation, Inc.
4
c5aa993b 5 This file is part of GDB.
e49d4fa6 6
c5aa993b
JM
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.
e49d4fa6 11
c5aa993b
JM
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.
e49d4fa6 16
c5aa993b
JM
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. */
e49d4fa6
SS
21
22#ifndef TM_TIC80_H
23#define TM_TIC80_H
24
104c1213 25/* Forward declare structs used in prototypes */
e49d4fa6
SS
26struct frame_info;
27struct type;
28struct value;
29struct symbol;
30struct frame_saved_regs;
e49d4fa6
SS
31
32#define TARGET_BYTE_ORDER LITTLE_ENDIAN
33
e49d4fa6
SS
34#define NUM_REGS 38
35
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", \
41 "pc", "npc", \
42 "a0", "a1", "a2", "a3", \
43}
44
45/* Various dedicated register numbers
46 FIXME: Shadow updates in sim/tic80/sim-calls.c */
47
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 */
58
c5aa993b
JM
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 */
e49d4fa6
SS
62
63/* Total amount of space needed to store our copies of the machine's
64 register state, the array `registers'. */
65
66#define REGISTER_BYTES (((NUM_REGS - 4) * 4) + (4 * 8))
67
68/* Index within `registers' of the first byte of the space for
69 register N. */
70
71#define REGISTER_BYTE(N) \
72 (((N) >= A0_REGNUM) ? (((N) - A0_REGNUM) * 8 + A0_REGNUM * 4) : ((N) * 4))
73
74/* Most registers are 4 bytes */
75
76#define REGISTER_SIZE 4
77
78/* Some registers are 8 bytes. */
79
80#define REGISTER_RAW_SIZE(N) \
81 (((N) >= A0_REGNUM) ? 8 : 4)
82
83/* Largest value REGISTER_RAW_SIZE can have. */
84
85#define MAX_REGISTER_RAW_SIZE (8)
86
87/* All regs are 4 bytes. */
88
89#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
90
91/* Largest value REGISTER_VIRTUAL_SIZE can have. */
92
93#define MAX_REGISTER_VIRTUAL_SIZE (MAX_REGISTER_RAW_SIZE)
94
95/* Return the GDB type object for the "standard" data type
96 of data in register N. */
97
98#define REGISTER_VIRTUAL_TYPE(N) /* FIXME? */ \
99 (((N) >= A0_REGNUM) ? builtin_type_float : builtin_type_int)
100
101/* Offset from address of function to start of its code.
102 Zero on most machines. */
103
104#define FUNCTION_START_OFFSET 0
105
106/* Stack grows downward. */
107
108#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
109
110/* Sequence of bytes for breakpoint instruction.
111 This is padded out to the size of a machine word. */
112
113#define BREAKPOINT {0x49, 0x80, 0x00, 0x00} /* FIXME! */
114
115/* Amount PC must be decremented by after a breakpoint.
116 This is often the number of bytes in BREAKPOINT
117 but not always. */
118
c5aa993b 119#define DECR_PC_AFTER_BREAK 0 /* FIXME! */
e49d4fa6
SS
120
121/* Discard from the stack the innermost frame, restoring all registers. */
122
123#define POP_FRAME tic80_pop_frame(get_current_frame ())
a14ed312 124extern struct frame_info *tic80_pop_frame (struct frame_info *frame);
e49d4fa6
SS
125
126/* Return number of bytes at start of arglist that are not really args. */
127
128#define FRAME_ARGS_SKIP 0
129
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 */
133
392a587b 134#define FRAME_NUM_ARGS(fi) (-1)
e49d4fa6
SS
135
136#define FRAME_ARGS_SKIP 0
137#define FRAME_ARGS_ADDRESS(fi) (fi)->frame
138#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
139
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) */
145
146#define EXTRA_FRAME_INFO \
147 struct frame_saved_regs fsr; \
148 int framesize; \
149 int frameoffset; \
150 int framereg;
151
a14ed312 152extern void tic80_init_extra_frame_info (struct frame_info *fi);
e49d4fa6
SS
153#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) tic80_init_extra_frame_info (fi)
154#define INIT_FRAME_PC /* Not necessary */
155
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. */
161
162#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
163 tic80_frame_find_saved_regs(frame_info, &(frame_saved_regs))
a14ed312
KB
164extern void tic80_frame_find_saved_regs (struct frame_info *,
165 struct frame_saved_regs *);
e49d4fa6
SS
166
167/* Advance PC across any function entry prologue instructions
168 to reach some "real" code. */
169
b83266a0 170#define SKIP_PROLOGUE(pc) (tic80_skip_prologue (pc))
a14ed312 171extern CORE_ADDR tic80_skip_prologue (CORE_ADDR pc);
e49d4fa6
SS
172
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. */
177
178#define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
179
180/* Describe the pointer in each stack frame to the previous stack frame
181 (its caller). */
182
183/* FRAME_CHAIN takes a frame's nominal address
184 and produces the frame's chain-pointer. */
185
186#define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
a14ed312 187extern CORE_ADDR tic80_frame_chain (struct frame_info *);
e49d4fa6
SS
188
189#define FRAME_SAVED_PC(FRAME) tic80_frame_saved_pc (FRAME)
a14ed312 190extern CORE_ADDR tic80_frame_saved_pc (struct frame_info *);
e49d4fa6
SS
191
192/* Store the address of the place in which to copy the structure the
193 subroutine will return. This is called from call_function.
194
195 We store structs through a pointer passed in R2 */
196
197#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
198 write_register (ARG0_REGNUM, STRUCT_ADDR)
199
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,
202 into VALBUF. */
203
204#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
205 memcpy ((VALBUF), \
206 (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
207 ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
208 TYPE_LENGTH (TYPE))
209
210/* Write into appropriate registers a function return value
211 of type TYPE, given in virtual format. */
212
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));
217
218
219
220/* PUSH_ARGUMENTS */
a14ed312
KB
221extern CORE_ADDR tic80_push_arguments (int nargs,
222 struct value **args,
223 CORE_ADDR sp,
224 unsigned char struct_return,
225 CORE_ADDR struct_addr);
e49d4fa6
SS
226
227#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
392a587b 228 (tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
e49d4fa6
SS
229
230/* PUSH_RETURN_ADDRESS */
a14ed312 231extern CORE_ADDR tic80_push_return_address (CORE_ADDR, CORE_ADDR);
e49d4fa6
SS
232#define PUSH_RETURN_ADDRESS(PC, SP) tic80_push_return_address (PC, SP)
233
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)
238
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 ()
247
248/* generic dummy frame stuff */
249
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)
252
c5aa993b 253#endif /* TM_TIC80_H */