OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [gdb/] [config/] [tic80/] [tm-tic80.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Parameters for execution on a TI TMS320C80 (MVP) processor.
2
   Copyright 1997
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
#ifndef TM_TIC80_H
23
#define TM_TIC80_H
24
 
25
/* Forward declare structs used in prototypes */
26
struct frame_info;
27
struct type;
28
struct value;
29
struct symbol;
30
struct frame_saved_regs;
31
 
32
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
33
 
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
 
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 */
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
 
119
#define DECR_PC_AFTER_BREAK     0        /* FIXME! */
120
 
121
/* Discard from the stack the innermost frame, restoring all registers.  */
122
 
123
#define POP_FRAME tic80_pop_frame(get_current_frame ())
124
extern struct frame_info *tic80_pop_frame PARAMS ((struct frame_info * frame));
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
 
134
#define FRAME_NUM_ARGS(fi) (-1)
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
 
152
extern void tic80_init_extra_frame_info PARAMS ((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 */
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))
164
extern void tic80_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
165
 
166
/* Advance PC across any function entry prologue instructions
167
   to reach some "real" code.  */
168
 
169
#define SKIP_PROLOGUE(pc) (tic80_skip_prologue (pc))
170
extern CORE_ADDR tic80_skip_prologue PARAMS ((CORE_ADDR pc));
171
 
172
/* Immediately after a function call, return the saved pc.
173
   Can't always go through the frames for this because on some machines
174
   the new frame is not set up until the new function executes
175
   some instructions.  */
176
 
177
#define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
178
 
179
/* Describe the pointer in each stack frame to the previous stack frame
180
   (its caller).  */
181
 
182
/* FRAME_CHAIN takes a frame's nominal address
183
   and produces the frame's chain-pointer. */
184
 
185
#define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
186
extern CORE_ADDR tic80_frame_chain PARAMS ((struct frame_info *));
187
 
188
#define FRAME_SAVED_PC(FRAME)   tic80_frame_saved_pc (FRAME)
189
extern CORE_ADDR tic80_frame_saved_pc PARAMS ((struct frame_info *));
190
 
191
/* Store the address of the place in which to copy the structure the
192
   subroutine will return.  This is called from call_function.
193
 
194
   We store structs through a pointer passed in R2 */
195
 
196
#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)    \
197
        write_register (ARG0_REGNUM, STRUCT_ADDR)
198
 
199
/* Extract from an array REGBUF containing the (raw) register state
200
   a function return value of type TYPE, and copy that, in virtual format,
201
   into VALBUF.  */
202
 
203
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
204
  memcpy ((VALBUF), \
205
          (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
206
          ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
207
          TYPE_LENGTH (TYPE))
208
 
209
/* Write into appropriate registers a function return value
210
   of type TYPE, given in virtual format.  */
211
 
212
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
213
  write_register_bytes(REGISTER_BYTE (RET_REGNUM) + \
214
                       ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
215
                       (VALBUF), TYPE_LENGTH (TYPE));
216
 
217
 
218
 
219
/* PUSH_ARGUMENTS */
220
extern CORE_ADDR tic80_push_arguments PARAMS ((int nargs,
221
                                               struct value ** args,
222
                                               CORE_ADDR sp,
223
                                               unsigned char struct_return,
224
                                               CORE_ADDR struct_addr));
225
 
226
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
227
  (tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
228
 
229
/* PUSH_RETURN_ADDRESS */
230
extern CORE_ADDR tic80_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
231
#define PUSH_RETURN_ADDRESS(PC, SP)     tic80_push_return_address (PC, SP)
232
 
233
/* override the standard get_saved_register function with
234
   one that takes account of generic CALL_DUMMY frames */
235
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
236
      generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
237
 
238
#define USE_GENERIC_DUMMY_FRAMES 1
239
#define CALL_DUMMY                   {0}
240
#define CALL_DUMMY_LENGTH            (0)
241
#define CALL_DUMMY_START_OFFSET      (0)
242
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
243
#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
244
#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
245
#define CALL_DUMMY_ADDRESS()         entry_point_address ()
246
 
247
/* generic dummy frame stuff */
248
 
249
#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
250
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
251
 
252
#endif /* TM_TIC80_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.