* Makefile.in (VERSION): Roll to 4.6.8.
[deliverable/binutils-gdb.git] / gdb / tm-tahoe.h
1 /* Definitions to make GDB target for a tahoe running 4.3-Reno.
2 Copyright 1986, 1987, 1989, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /*
21 * Ported by the State University of New York at Buffalo by the Distributed
22 * Computer Systems Lab, Department of Computer Science, 1991.
23 */
24
25 #define TARGET_BYTE_ORDER BIG_ENDIAN
26 #define BITS_BIG_ENDIAN 0
27
28 /* Define this if the C compiler puts an underscore at the front
29 of external names before giving them to the linker. */
30
31 #define NAMES_HAVE_UNDERSCORE
32
33 /* Offset from address of function to start of its code.
34 Zero on most machines. */
35
36 #define FUNCTION_START_OFFSET 2
37
38 /* Advance PC across any function entry prologue instructions
39 to reach some "real" code. */
40
41 #define SKIP_PROLOGUE(pc) \
42 { register int op = (unsigned char) read_memory_integer (pc, 1); \
43 if (op == 0x11) pc += 2; /* skip brb */ \
44 if (op == 0x13) pc += 3; /* skip brw */ \
45 if (op == 0x2c && \
46 ((unsigned char) read_memory_integer (pc+2, 1)) == 0x5e) \
47 pc += 3; /* skip subl2 */ \
48 if (op == 0xe9 && \
49 ((unsigned char) read_memory_integer (pc+1, 1)) == 0xae && \
50 ((unsigned char) read_memory_integer(pc+3, 1)) == 0x5e) \
51 pc += 4; /* skip movab */ \
52 if (op == 0xe9 && \
53 ((unsigned char) read_memory_integer (pc+1, 1)) == 0xce && \
54 ((unsigned char) read_memory_integer(pc+4, 1)) == 0x5e) \
55 pc += 5; /* skip movab */ \
56 if (op == 0xe9 && \
57 ((unsigned char) read_memory_integer (pc+1, 1)) == 0xee && \
58 ((unsigned char) read_memory_integer(pc+6, 1)) == 0x5e) \
59 pc += 7; /* skip movab */ \
60 }
61
62 /* Immediately after a function call, return the saved pc.
63 Can't always go through the frames for this because on some machines
64 the new frame is not set up until the new function executes
65 some instructions. */
66
67 #define SAVED_PC_AFTER_CALL(frame) FRAME_SAVED_PC(frame)
68
69 /* Wrong for cross-debugging. I don't know the real values. */
70 #include <machine/param.h>
71 #define TARGET_UPAGES UPAGES
72 #define TARGET_NBPG NBPG
73
74 /* Address of end of stack space. */
75
76 #define STACK_END_ADDR (0xc0000000 - (TARGET_UPAGES * TARGET_NBPG))
77
78 /* On BSD, sigtramp is in the u area. Can't check the exact
79 addresses because for cross-debugging we don't have target include
80 files around. This should be close enough. */
81 #define IN_SIGTRAMP(pc, name) ((pc) >= STACK_END_ADDR && (pc < 0xc0000000))
82
83 /* Stack grows downward. */
84
85 #define INNER_THAN <
86
87 /* Sequence of bytes for breakpoint instruction. */
88
89 #define BREAKPOINT {0x30}
90
91 /* Amount PC must be decremented by after a breakpoint.
92 This is often the number of bytes in BREAKPOINT
93 but not always. */
94
95 #define DECR_PC_AFTER_BREAK 0
96
97 /* Nonzero if instruction at PC is a return instruction. */
98
99 #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x40)
100
101 /* Return 1 if P points to an invalid floating point value.
102 LEN is the length in bytes -- not relevant on the Tahoe. */
103
104 #define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000)
105
106 /* Say how long (ordinary) registers are. */
107
108 #define REGISTER_TYPE long
109
110 /* Number of machine registers */
111
112 #define NUM_REGS 19
113
114 /* Initializer for an array of names of registers.
115 There should be NUM_REGS strings in this initializer. */
116
117 #define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "fp", "sp", "pc", "ps", "al", "ah"}
118
119 #define FP_REGNUM 13 /* Contains address of executing stack frame */
120 #define SP_REGNUM 14 /* Contains address of top of stack */
121 #define PC_REGNUM 15 /* Contains program counter */
122 #define PS_REGNUM 16 /* Contains processor status */
123
124 #define AL_REGNUM 17 /* Contains accumulator */
125 #define AH_REGNUM 18
126
127 /* Total amount of space needed to store our copies of the machine's
128 register state, the array `registers'. */
129
130 #define REGISTER_BYTES (19*4)
131
132 /* Index within `registers' of the first byte of the space for
133 register N. */
134
135 #define REGISTER_BYTE(N) ((N) * 4)
136
137 /* Number of bytes of storage in the actual machine representation
138 for register N. On the tahoe, all regs are 4 bytes. */
139
140 #define REGISTER_RAW_SIZE(N) 4
141
142 /* Number of bytes of storage in the program's representation
143 for register N. On the tahoe, all regs are 4 bytes. */
144
145 #define REGISTER_VIRTUAL_SIZE(N) 4
146
147 /* Largest value REGISTER_RAW_SIZE can have. */
148
149 #define MAX_REGISTER_RAW_SIZE 4
150
151 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
152
153 #define MAX_REGISTER_VIRTUAL_SIZE 4
154
155 /* Nonzero if register N requires conversion
156 from raw format to virtual format. */
157
158 #define REGISTER_CONVERTIBLE(N) 0
159
160 /* Convert data from raw format for register REGNUM
161 to virtual format for register REGNUM. */
162
163 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
164 bcopy ((FROM), (TO), 4);
165
166 /* Convert data from virtual format for register REGNUM
167 to raw format for register REGNUM. */
168
169 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
170 bcopy ((FROM), (TO), 4);
171
172 /* Return the GDB type object for the "standard" data type
173 of data in register N. */
174
175 #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int
176
177 /* Store the address of the place in which to copy the structure the
178 subroutine will return. This is called from call_function. */
179
180 #define STORE_STRUCT_RETURN(ADDR, SP) \
181 { write_register (1, (ADDR)); }
182
183 /* Extract from an array REGBUF containing the (raw) register state
184 a function return value of type TYPE, and copy that, in virtual format,
185 into VALBUF. */
186
187 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
188 bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
189
190 /* Write into appropriate registers a function return value
191 of type TYPE, given in virtual format. */
192
193 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
194 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
195
196 /* Extract from an array REGBUF containing the (raw) register state
197 the address in which a function should return its structure value,
198 as a CORE_ADDR (or an expression that can be used as one). */
199
200 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
201
202 /* Describe the pointer in each stack frame to the previous stack frame
203 (its caller).
204
205 FRAME_CHAIN takes a frame's nominal address
206 and produces the frame's chain-pointer. */
207
208 /* In the case of the Tahoe, the frame's nominal address is the FP value,
209 and it points to the old FP */
210
211 #define FRAME_CHAIN(thisframe) \
212 (!inside_entry_file ((thisframe)->pc) ? \
213 read_memory_integer ((thisframe)->frame, 4) :\
214 0)
215
216 /* Define other aspects of the stack frame. */
217
218 /* Saved PC */
219
220 #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame - 8, 4))
221
222 /* In most of GDB, getting the args address is too important to
223 just say "I don't know". */
224
225 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
226
227 /* Address to use as an anchor for finding local variables */
228
229 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
230
231 /* Return number of args passed to a frame.
232 Can return -1, meaning no way to tell. */
233
234 #define FRAME_NUM_ARGS(numargs, fi) \
235 { numargs = ((0xffff & read_memory_integer(((fi)->frame-4),4)) - 4) >> 2; }
236
237 /* Return number of bytes at start of arglist that are not really args. */
238
239 #define FRAME_ARGS_SKIP 0
240
241 /* Put here the code to store, into a struct frame_saved_regs,
242 the addresses of the saved registers of frame described by FRAME_INFO.
243 This includes special registers such as pc and fp saved in special
244 ways in the stack frame. sp is even more special:
245 the address we return for it IS the sp for the next frame. */
246
247 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
248 { register int regnum; \
249 register int rmask = read_memory_integer ((frame_info)->frame-4, 4) >> 16;\
250 register CORE_ADDR next_addr; \
251 bzero (&frame_saved_regs, sizeof frame_saved_regs); \
252 next_addr = (frame_info)->frame - 8; \
253 for (regnum = 12; regnum >= 0; regnum--, rmask <<= 1) \
254 (frame_saved_regs).regs[regnum] = (rmask & 0x1000) ? (next_addr -= 4) : 0;\
255 (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 4; \
256 (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame - 8; \
257 (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
258 }
259
260 /* Things needed for making the inferior call functions. */
261
262 /* Push an empty stack frame, to record the current PC, etc. */
263
264 #define PUSH_DUMMY_FRAME \
265 { register CORE_ADDR sp = read_register (SP_REGNUM); \
266 register int regnum; \
267 printf("PUSH_DUMMY_FRAME\n"); \
268 sp = push_word (sp, read_register (FP_REGNUM)); \
269 write_register (FP_REGNUM, sp); \
270 sp = push_word (sp, 0x1fff0004); /*SAVE MASK*/ \
271 sp = push_word (sp, read_register (PC_REGNUM)); \
272 for (regnum = 12; regnum >= 0; regnum--) \
273 sp = push_word (sp, read_register (regnum)); \
274 write_register (SP_REGNUM, sp); \
275 }
276
277 /* Discard from the stack the innermost frame, restoring all registers. */
278
279 #define POP_FRAME \
280 { register CORE_ADDR fp = read_register (FP_REGNUM); \
281 register int regnum; \
282 register int regmask = read_memory_integer (fp-4, 4); \
283 printf("POP_FRAME\n"); \
284 regmask >>= 16; \
285 write_register (SP_REGNUM, fp+4); \
286 write_register (PC_REGNUM, read_memory_integer(fp-8, 4)); \
287 write_register (FP_REGNUM, read_memory_integer(fp, 4)); \
288 fp -= 8; \
289 for (regnum = 12; regnum >= 0; regnum--, regmask <<= 1) \
290 if (regmask & 0x1000) \
291 write_register (regnum, read_memory_integer (fp-=4, 4)); \
292 flush_cached_frames (); \
293 set_current_frame (create_new_frame (read_register (FP_REGNUM), \
294 read_pc ())); }
295
296 /* This sequence of words is the instructions
297 calls #69, @#32323232
298 bpt
299 Note this is 8 bytes. */
300
301 #define CALL_DUMMY {0xbf699f32, 0x32323230}
302
303 /* Start execution at beginning of dummy */
304
305 #define CALL_DUMMY_START_OFFSET 0
306
307 /* Insert the specified number of args and function address
308 into a call sequence of the above form stored at DUMMYNAME. */
309
310 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, valtype, using_gcc) \
311 { int temp = (int) fun; \
312 *((char *) dummyname + 1) = nargs; \
313 bcopy(&temp,(char *)dummyname+3,4); }
314
This page took 0.034672 seconds and 4 git commands to generate.