Still some bogus code; checkpoint.
[external/binutils.git] / gdb / config / fr30 / tm-fr30.h
1 /* Parameters for execution on a Fujitsu FR30 processor.
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
19 #define FR30_GENREGS            16
20 #define FR30_DEDICATEDREGS      8
21 #define FR30_REGSIZE            4       /* bytes */
22
23 #define NUM_REGS (FR30_GENREGS + FR30_DEDICATEDREGS)
24 #define REGISTER_BYTES ((FR30_GENREGS + FR30_DEDICATEDREGS)*FR30_REGSIZE)
25
26 /* Index within `registers' of the first byte of the space for
27    register N.  */
28 #define REGISTER_BYTE(N) ((N) * FR30_REGSIZE)
29
30 /* Initializer for an array of names of registers.
31    There should be NUM_REGS strings in this initializer.  */
32 #define REGISTER_NAMES \
33 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
34   "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
35   "pc", "ps", "tbr", "rp", "ssp", "usp", "mdh", "mdl" }
36
37 /* Offset from address of function to start of its code.
38    Zero on most machines.  */
39 #define FUNCTION_START_OFFSET 0
40
41 /* Amount PC must be decremented by after a breakpoint.
42    This is often the number of bytes in BREAKPOINT
43    but not always.  */
44
45 #define DECR_PC_AFTER_BREAK 0
46
47 /* Stack grows downward.  */
48
49 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
50
51 #define TARGET_BYTE_ORDER BIG_ENDIAN
52
53 #define R4_REGNUM  4
54 #define R7_REGNUM  7
55 #define FP_REGNUM 14            /* Frame pointer */
56 #define SP_REGNUM 15            /* Stack pointer */
57 #define PC_REGNUM 16            /* Program counter */
58 #define RP_REGNUM 19            /* Return pointer */
59
60 #define FIRST_ARGREG    R4_REGNUM       /* first arg (or struct ret val addr) */
61 #define LAST_ARGREG     R7_REGNUM       /* fourth (or third arg) */
62 #define RETVAL_REG      R4_REGNUM       /* return vaue */
63
64 /* Say how long (ordinary) registers are.  This is a piece of bogosity
65    used in push_word and a few other places; REGISTER_RAW_SIZE is the
66    real way to know how big a register is.  */
67 #define REGISTER_SIZE FR30_REGSIZE
68
69 /* Number of bytes of storage in the actual machine representation
70    for register N.  */
71 #define REGISTER_RAW_SIZE(N) FR30_REGSIZE
72
73 /* Largest value REGISTER_RAW_SIZE can have.  */
74 #define MAX_REGISTER_RAW_SIZE FR30_REGSIZE 
75
76 /* Number of bytes of storage in the program's representation
77    for register N.  */
78 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
79
80 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
81 #define MAX_REGISTER_VIRTUAL_SIZE FR30_REGSIZE
82
83 extern void fr30_pop_frame PARAMS ((void));
84 #define POP_FRAME fr30_pop_frame()
85
86 #define USE_GENERIC_DUMMY_FRAMES
87 #define CALL_DUMMY                   {0}
88 #define CALL_DUMMY_START_OFFSET      (0)
89 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
90 #define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
91 #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
92 #define CALL_DUMMY_ADDRESS()         entry_point_address ()
93 extern CORE_ADDR fr30_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
94 #define PUSH_RETURN_ADDRESS(PC, SP)  fr30_push_return_address (PC, SP)
95
96
97 #define PUSH_DUMMY_FRAME        generic_push_dummy_frame ()
98
99
100 /* Number of bytes at start of arglist that are not really args.  */
101 #define FRAME_ARGS_SKIP 0
102
103 /* Return the GDB type object for the "standard" data type
104    of data in register N.  */
105 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
106
107 /* Extract from an array REGBUF containing the (raw) register state
108    a function return value of type TYPE, and copy that, in virtual format,
109    into VALBUF.  */
110 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
111     memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG), TYPE_LENGTH (TYPE))
112
113 /* Extract from an array REGBUF containing the (raw) register state
114    the address in which a function should return its structure value,
115    as a CORE_ADDR (or an expression that can be used as one).  */
116 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
117   extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
118                    REGISTER_RAW_SIZE (RETVAL_REG))
119
120 #define STORE_STRUCT_RETURN(ADDR, SP) \
121   { write_register (RETVAL_REG, (ADDR)); }
122
123
124
125 #define FRAME_ARGS_ADDRESS(fi) (fi->frame)
126 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
127
128 /* Return number of args passed to a frame.
129    Can return -1, meaning no way to tell.  */
130 #define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
131
132 #ifdef __STDC__         /* Forward decls for prototypes */
133 struct frame_info;
134 struct frame_saved_regs;
135 struct type;
136 struct value;
137 #endif
138
139 #define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
140
141 extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
142 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
143
144 extern CORE_ADDR fr30_frame_saved_pc   PARAMS ((struct frame_info *));
145 #define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
146
147 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
148
149 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
150 #define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
151
152 /* Write into appropriate registers a function return value
153    of type TYPE, given in virtual format.  */
154
155 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
156     write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
157
158 /* Put here the code to store, into a struct frame_saved_regs,
159    the addresses of the saved registers of frame described by FRAME_INFO.
160    This includes special registers such as pc and fp saved in special
161    ways in the stack frame.  sp is even more special:
162    the address we return for it IS the sp for the next frame.  */
163 #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
164
165 /* Use INT #BREAKPOINT_INTNUM instruction for breakpoint */
166 #define FR30_BREAKOP    0x1f    /* opcode, type D instruction */
167 #define BREAKPOINT_INTNUM 9     /* one of the reserved traps */
168 #define BREAKPOINT {FR30_BREAKOP, BREAKPOINT_INTNUM}
169
170 /* Define this for Wingdb */
171 #define TARGET_FR30
172
173 #if(1) /* Z.R. */
174
175 /*ARM example*/
176
177 /* IEEE format floating point */
178 #define IEEE_FLOAT
179
180 /* Define other aspects of the stack frame.  */
181
182 /* A macro that tells us whether the function invocation represented
183    by FI does not have a frame on the stack associated with it.  If it
184    does not, FRAMELESS is set to 1, else 0.  */
185 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
186 {                                                       \
187   CORE_ADDR func_start, after_prologue;                 \
188   func_start = (get_pc_function_start ((FI)->pc) +      \
189                 FUNCTION_START_OFFSET);                 \
190   after_prologue = func_start;                          \
191   SKIP_PROLOGUE (after_prologue);                       \
192   (FRAMELESS) = (after_prologue == func_start);         \
193 }
194
195 /*V850 example*/
196
197 extern void fr30_init_extra_frame_info PARAMS ((struct frame_info *fi));
198 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
199
200 #define FRAME_CHAIN_VALID(FP, FI)       generic_frame_chain_valid (FP, FI)
201
202 extern CORE_ADDR
203 fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
204                              int struct_return,
205                              CORE_ADDR struct_addr));
206 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
207   (SP) = fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
208
209 #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
210
211 #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \
212         (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4)
213
214 #endif /* Z.R. */