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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [config/] [fr30/] [tm-fr30.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* Parameters for execution on a Fujitsu FR30 processor.
2
   Copyright 1999, 2000 Free Software Foundation, Inc.
3
 
4
   This file is part of GDB.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2 of the License, or
9
   (at your option) any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
#include "regcache.h"
22
 
23
#define FR30_GENREGS            16
24
#define FR30_DEDICATEDREGS      8
25
#define FR30_REGSIZE            4       /* bytes */
26
 
27
#define NUM_REGS (FR30_GENREGS + FR30_DEDICATEDREGS)
28
#define REGISTER_BYTES ((FR30_GENREGS + FR30_DEDICATEDREGS)*FR30_REGSIZE)
29
 
30
/* Index within `registers' of the first byte of the space for
31
   register N.  */
32
#define REGISTER_BYTE(N) ((N) * FR30_REGSIZE)
33
 
34
/* Initializer for an array of names of registers.
35
   There should be NUM_REGS strings in this initializer.  */
36
#define REGISTER_NAMES \
37
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
38
  "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
39
  "pc", "ps", "tbr", "rp", "ssp", "usp", "mdh", "mdl" }
40
 
41
/* Offset from address of function to start of its code.
42
   Zero on most machines.  */
43
#define FUNCTION_START_OFFSET 0
44
 
45
/* Amount PC must be decremented by after a breakpoint.
46
   This is often the number of bytes in BREAKPOINT
47
   but not always.  */
48
 
49
#define DECR_PC_AFTER_BREAK 0
50
 
51
/* Stack grows downward.  */
52
 
53
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
54
 
55
#define TARGET_BYTE_ORDER BIG_ENDIAN
56
 
57
#define R0_REGNUM  0
58
#define R1_REGNUM  1
59
#define R2_REGNUM  2
60
#define R3_REGNUM  3
61
#define R4_REGNUM  4
62
#define R5_REGNUM  5
63
#define R6_REGNUM  6
64
#define R7_REGNUM  7
65
#define R8_REGNUM  8
66
#define R9_REGNUM  9
67
#define R10_REGNUM  10
68
#define R11_REGNUM  11
69
#define R12_REGNUM  12
70
#define R13_REGNUM  13
71
#define FP_REGNUM 14            /* Frame pointer */
72
#define SP_REGNUM 15            /* Stack pointer */
73
#define PC_REGNUM 16            /* Program counter */
74
#define RP_REGNUM 19            /* Return pointer */
75
 
76
#define FIRST_ARGREG    R4_REGNUM       /* first arg (or struct ret val addr) */
77
#define LAST_ARGREG     R7_REGNUM       /* fourth (or third arg) */
78
#define RETVAL_REG      R4_REGNUM       /* return vaue */
79
 
80
/* Say how long (ordinary) registers are.  This is a piece of bogosity
81
   used in push_word and a few other places; REGISTER_RAW_SIZE is the
82
   real way to know how big a register is.  */
83
#define REGISTER_SIZE FR30_REGSIZE
84
 
85
/* Number of bytes of storage in the actual machine representation
86
   for register N.  */
87
#define REGISTER_RAW_SIZE(N) FR30_REGSIZE
88
 
89
/* Largest value REGISTER_RAW_SIZE can have.  */
90
#define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
91
 
92
/* Number of bytes of storage in the program's representation
93
   for register N.  */
94
#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
95
 
96
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
97
#define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
98
 
99
extern void fr30_pop_frame (void);
100
#define POP_FRAME fr30_pop_frame()
101
 
102
#define USE_GENERIC_DUMMY_FRAMES 1
103
#define CALL_DUMMY                   {0}
104
#define CALL_DUMMY_START_OFFSET      (0)
105
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
106
#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
107
#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
108
#define CALL_DUMMY_ADDRESS()         entry_point_address ()
109
#define PUSH_RETURN_ADDRESS(PC, SP)  (write_register(RP_REGNUM, CALL_DUMMY_ADDRESS()), SP)
110
#define PUSH_DUMMY_FRAME        generic_push_dummy_frame ()
111
 
112
/* Number of bytes at start of arglist that are not really args.  */
113
#define FRAME_ARGS_SKIP 0
114
 
115
/* Return the GDB type object for the "standard" data type
116
   of data in register N.  */
117
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
118
 
119
/* Extract from an array REGBUF containing the (raw) register state
120
   a function return value of type TYPE, and copy that, in virtual format,
121
   into VALBUF.  */
122
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
123
    memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG) +  \
124
        (TYPE_LENGTH(TYPE) < 4 ? 4 - TYPE_LENGTH(TYPE) : 0), TYPE_LENGTH (TYPE))
125
 
126
/* Extract from an array REGBUF containing the (raw) register state
127
   the address in which a function should return its structure value,
128
   as a CORE_ADDR (or an expression that can be used as one).  */
129
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
130
  extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
131
                   REGISTER_RAW_SIZE (RETVAL_REG))
132
 
133
#define STORE_STRUCT_RETURN(ADDR, SP) \
134
  { write_register (RETVAL_REG, (ADDR)); }
135
 
136
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
137
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
138
 
139
/* Return number of args passed to a frame.
140
   Can return -1, meaning no way to tell.  */
141
#define FRAME_NUM_ARGS(fi) (-1)
142
 
143
/* Forward decls for prototypes */
144
struct frame_info;
145
struct frame_saved_regs;
146
struct type;
147
struct value;
148
 
149
#define EXTRA_FRAME_INFO \
150
  struct frame_saved_regs fsr;  \
151
  int framesize;                \
152
  int frameoffset;              \
153
  int framereg;
154
 
155
extern CORE_ADDR fr30_frame_chain (struct frame_info *fi);
156
#define FRAME_CHAIN(fi) fr30_frame_chain (fi)
157
 
158
extern CORE_ADDR fr30_frame_saved_pc (struct frame_info *);
159
#define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
160
 
161
#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
162
 
163
extern CORE_ADDR fr30_skip_prologue (CORE_ADDR pc);
164
#define SKIP_PROLOGUE(pc) (fr30_skip_prologue (pc))
165
 
166
/* Write into appropriate registers a function return value of type
167
   TYPE, given in virtual format.  VALBUF is in the target byte order;
168
   it's typically the VALUE_CONTENTS of some struct value, and those
169
   are in the target's byte order.  */
170
extern void fr30_store_return_value (struct type *type, char *valbuf);
171
 
172
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
173
  (fr30_store_return_value ((TYPE), (VALBUF)))
174
 
175
/* Put here the code to store, into a struct frame_saved_regs,
176
   the addresses of the saved registers of frame described by FRAME_INFO.
177
   This includes special registers such as pc and fp saved in special
178
   ways in the stack frame.  sp is even more special:
179
   the address we return for it IS the sp for the next frame.  */
180
#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
181
 
182
/* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
183
#define FR30_BREAKOP    0x1f    /* opcode, type D instruction */
184
#define BREAKPOINT_INTNUM 9     /* one of the reserved traps */
185
#define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
186
 
187
/* Define this for Wingdb */
188
#define TARGET_FR30
189
 
190
/* IEEE format floating point */
191
#define IEEE_FLOAT (1)
192
 
193
/* Define other aspects of the stack frame.  */
194
 
195
/* An expression that tells us whether the function invocation represented
196
   by FI does not have a frame on the stack associated with it.  */
197
extern int fr30_frameless_function_invocation (struct frame_info *frame);
198
#define FRAMELESS_FUNCTION_INVOCATION(FI) (fr30_frameless_function_invocation (FI));
199
 
200
extern void fr30_init_extra_frame_info (struct frame_info *fi);
201
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
202
 
203
#define FRAME_CHAIN_VALID(FP, FI)       generic_file_frame_chain_valid (FP, FI)
204
 
205
extern CORE_ADDR
206
fr30_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
207
                     int struct_return, CORE_ADDR struct_addr);
208
#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
209
  (fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
210
 
211
#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
212
 
213
/* Fujitsu's ABI requires all structs to be passed using a pointer.
214
   That is obviously not very efficient, so I am leaving the definitions
215
   to make gdb work with GCC style struct passing, in case we decide
216
   to go for better performance, rather than for compatibility with
217
   Fujitsu (just change STRUCT_ALWAYS_BY_ADDR to 0) */
218
 
219
#define STRUCT_ALWAYS_BY_ADDR   1
220
 
221
#if(STRUCT_ALWAYS_BY_ADDR)
222
#define REG_STRUCT_HAS_ADDR(gcc_p,type)         1
223
#else
224
/* more standard GCC (optimized) */
225
#define REG_STRUCT_HAS_ADDR(gcc_p,type)         \
226
                ((TYPE_LENGTH(type) > 4) && (TYPE_LENGTH(type) & 0x3))
227
#endif
228
/* alway return struct by value by input pointer */
229
#define USE_STRUCT_CONVENTION(GCC_P, TYPE)      1
230
 
231
/* The stack should always be aligned on a four-word boundary.  */
232
#define STACK_ALIGN(len) (((len) + 3) & ~3)
233
 
234
/* I think the comment about this in value_arg_coerce is wrong; this
235
   should be true on any system where you can rely on the prototyping
236
   information.  When this is true, value_arg_coerce will promote
237
   floats to doubles iff the function is not prototyped.  */
238
#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)

powered by: WebSVN 2.1.0

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