Include regcache.h
[deliverable/binutils-gdb.git] / gdb / config / fr30 / tm-fr30.h
CommitLineData
c906108c 1/* Parameters for execution on a Fujitsu FR30 processor.
b6ba6518 2 Copyright 1999, 2000 Free Software Foundation, Inc.
c906108c 3
c5aa993b 4 This file is part of GDB.
c906108c 5
c5aa993b
JM
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.
c906108c 10
c5aa993b
JM
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.
c906108c 15
c5aa993b
JM
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. */
c906108c 20
f88e2c52
AC
21#include "regcache.h"
22
c906108c
SS
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. */
c5aa993b 90#define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
c906108c
SS
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
a14ed312 99extern void fr30_pop_frame (void);
c906108c
SS
100#define POP_FRAME fr30_pop_frame()
101
7a292a7a 102#define USE_GENERIC_DUMMY_FRAMES 1
c906108c
SS
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
7a292a7a 136#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
c906108c
SS
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. */
392a587b 141#define FRAME_NUM_ARGS(fi) (-1)
c906108c 142
104c1213 143/* Forward decls for prototypes */
c906108c
SS
144struct frame_info;
145struct frame_saved_regs;
146struct type;
147struct value;
c906108c
SS
148
149#define EXTRA_FRAME_INFO \
150 struct frame_saved_regs fsr; \
151 int framesize; \
152 int frameoffset; \
153 int framereg;
154
a14ed312 155extern CORE_ADDR fr30_frame_chain (struct frame_info *fi);
c906108c
SS
156#define FRAME_CHAIN(fi) fr30_frame_chain (fi)
157
a14ed312 158extern CORE_ADDR fr30_frame_saved_pc (struct frame_info *);
c906108c
SS
159#define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
160
161#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
162
a14ed312 163extern CORE_ADDR fr30_skip_prologue (CORE_ADDR pc);
b83266a0 164#define SKIP_PROLOGUE(pc) (fr30_skip_prologue (pc))
c906108c 165
7a292a7a
SS
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. */
a14ed312 170extern void fr30_store_return_value (struct type *type, char *valbuf);
c906108c
SS
171
172#define STORE_RETURN_VALUE(TYPE,VALBUF) \
7a292a7a 173 (fr30_store_return_value ((TYPE), (VALBUF)))
c906108c
SS
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 */
7355ddba 191#define IEEE_FLOAT (1)
c906108c
SS
192
193/* Define other aspects of the stack frame. */
194
392a587b
JM
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. */
a14ed312 197extern int fr30_frameless_function_invocation (struct frame_info *frame);
392a587b 198#define FRAMELESS_FUNCTION_INVOCATION(FI) (fr30_frameless_function_invocation (FI));
c906108c 199
a14ed312 200extern void fr30_init_extra_frame_info (struct frame_info *fi);
c906108c
SS
201#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
202
c4093a6a 203#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
c906108c
SS
204
205extern CORE_ADDR
a14ed312
KB
206fr30_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
207 int struct_return, CORE_ADDR struct_addr);
c906108c 208#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
392a587b 209 (fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
c906108c 210
7a292a7a 211#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
c906108c
SS
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
7a292a7a
SS
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. */
b9a8e3bf 238#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
This page took 0.088074 seconds and 4 git commands to generate.