Motorola 88000 port without tears, I mean without tdescs.
[deliverable/binutils-gdb.git] / gdb / tm-delta88.h
1 /* Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
18
19 /* g++ support is not yet included. */
20
21 #define TARGET_BYTE_ORDER BIG_ENDIAN
22
23 /* We cache information about saved registers in the frame structure,
24 to save us from having to re-scan function prologues every time
25 a register in a non-current frame is accessed. */
26
27 #define EXTRA_FRAME_INFO \
28 struct frame_saved_regs *fsr; \
29 CORE_ADDR locals_pointer; \
30 CORE_ADDR args_pointer;
31
32 /* Zero the frame_saved_regs pointer when the frame is initialized,
33 so that FRAME_FIND_SAVED_REGS () will know to allocate and
34 initialize a frame_saved_regs struct the first time it is called.
35 Set the arg_pointer to -1, which is not valid; 0 and other values
36 indicate real, cached values. */
37
38 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
39 init_extra_frame_info (fromleaf, fi)
40 extern void init_extra_frame_info ();
41
42 #define INIT_FRAME_PC(fromleaf, prev) \
43 init_frame_pc (fromleaf, prev)
44 extern void init_frame_pc ();
45
46 #define IEEE_FLOAT
47
48 /* Define this if the C compiler puts an underscore at the front
49 of external names before giving them to the linker. */
50
51 #define NAMES_HAVE_UNDERSCORE
52
53 /* Hook for read_relative_register_raw_bytes */
54
55 #define READ_RELATIVE_REGISTER_RAW_BYTES
56
57 /* Offset from address of function to start of its code.
58 Zero on most machines. */
59
60 #define FUNCTION_START_OFFSET 0
61
62 /* Advance PC across any function entry prologue instructions
63 to reach some "real" code. */
64
65 #define SKIP_PROLOGUE(frompc) \
66 skip_prologue (frompc)
67 extern CORE_ADDR skip_prologue ();
68
69 /* The m88k kernel aligns all instructions on 4-byte boundaries. The
70 kernel also uses the least significant two bits for its own hocus
71 pocus. When gdb receives an address from the kernel, it needs to
72 preserve those right-most two bits, but gdb also needs to be careful
73 to realize that those two bits are not really a part of the address
74 of an instruction. Shrug. */
75
76 #define ADDR_BITS_REMOVE(addr) ((addr) & ~3)
77 #define ADDR_BITS_SET(addr) (((addr) | 0x00000002) - 4)
78
79 /* Immediately after a function call, return the saved pc.
80 Can't always go through the frames for this because on some machines
81 the new frame is not set up until the new function executes
82 some instructions. */
83
84 #define SAVED_PC_AFTER_CALL(frame) \
85 (ADDR_BITS_REMOVE (read_register (SRP_REGNUM)))
86
87 /* Address of end of stack space (in core files). */
88
89 #define STACK_END_ADDR 0xF0000000
90
91 /* Stack grows downward. */
92
93 #define INNER_THAN <
94
95 /* Sequence of bytes for breakpoint instruction. */
96
97 /* instruction 0xF000D1FF is 'tb0 0,r0,511'
98 If Bit bit 0 of r0 is clear (always true),
99 initiate exception processing (trap).
100 */
101 #define BREAKPOINT {0xF0, 0x00, 0xD1, 0xFF}
102
103 /* Amount PC must be decremented by after a breakpoint.
104 This is often the number of bytes in BREAKPOINT
105 but not always. */
106
107 #define DECR_PC_AFTER_BREAK 0
108
109 /* Nonzero if instruction at PC is a return instruction. */
110 /* 'jmp r1' or 'jmp.n r1' is used to return from a subroutine. */
111
112 #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0xF800)
113
114 /* Return 1 if P points to an invalid floating point value.
115 LEN is the length in bytes. */
116
117 #define INVALID_FLOAT(p, len) IEEE_isNAN(p,len)
118
119 /* Say how long (ordinary) registers are. */
120
121 #define REGISTER_TYPE long
122
123 /* Number of machine registers */
124
125 #define NUM_REGS 38
126
127 /* Initializer for an array of names of registers.
128 There should be NUM_REGS strings in this initializer. */
129
130 #define REGISTER_NAMES {\
131 "r0",\
132 "r1",\
133 "r2",\
134 "r3",\
135 "r4",\
136 "r5",\
137 "r6",\
138 "r7",\
139 "r8",\
140 "r9",\
141 "r10",\
142 "r11",\
143 "r12",\
144 "r13",\
145 "r14",\
146 "r15",\
147 "r16",\
148 "r17",\
149 "r18",\
150 "r19",\
151 "r20",\
152 "r21",\
153 "r22",\
154 "r23",\
155 "r24",\
156 "r25",\
157 "r26",\
158 "r27",\
159 "r28",\
160 "r29",\
161 "r30",\
162 "r31",\
163 "psr",\
164 "fpsr",\
165 "fpcr",\
166 "sxip",\
167 "snip",\
168 "sfip",\
169 "vbr",\
170 "dmt0",\
171 "dmd0",\
172 "dma0",\
173 "dmt1",\
174 "dmd1",\
175 "dma1",\
176 "dmt2",\
177 "dmd2",\
178 "dma2",\
179 "sr0",\
180 "sr1",\
181 "sr2",\
182 "sr3",\
183 "fpecr",\
184 "fphs1",\
185 "fpls1",\
186 "fphs2",\
187 "fpls2",\
188 "fppt",\
189 "fprh",\
190 "fprl",\
191 "fpit",\
192 "fpsr",\
193 "fpcr",\
194 };
195
196
197 /* Register numbers of various important registers.
198 Note that some of these values are "real" register numbers,
199 and correspond to the general registers of the machine,
200 and some are "phony" register numbers which are too large
201 to be actual register numbers as far as the user is concerned
202 but do serve to get the desired values when passed to read_register. */
203
204 #define SRP_REGNUM 1 /* Contains subroutine return pointer */
205 #define RV_REGNUM 2 /* Contains simple return values */
206 #define SRA_REGNUM 12 /* Contains address of struct return values */
207 #define FP_REGNUM 31 /* Reg fetched to locate frame when pgm stops */
208 #define SP_REGNUM 31 /* Contains address of top of stack */
209 #define SXIP_REGNUM 35 /* Contains Shadow Execute Instruction Pointer */
210 #define SNIP_REGNUM 36 /* Contains Shadow Next Instruction Pointer */
211 #define PC_REGNUM SXIP_REGNUM /* Program Counter */
212 #define NPC_REGNUM SNIP_REGNUM /* Next Program Counter */
213 #define PSR_REGNUM 32 /* Processor Status Register */
214 #define FPSR_REGNUM 33 /* Floating Point Status Register */
215 #define FPCR_REGNUM 34 /* Floating Point Control Register */
216 #define SFIP_REGNUM 37 /* Contains Shadow Fetched Intruction pointer */
217 #define NNPC_REGNUM SFIP_REGNUM /* Next Next Program Counter */
218
219 /* PSR status bit definitions. */
220
221 #define PSR_MODE 0x80000000
222 #define PSR_BYTE_ORDER 0x40000000
223 #define PSR_SERIAL_MODE 0x20000000
224 #define PSR_CARRY 0x10000000
225 #define PSR_SFU_DISABLE 0x000003f0
226 #define PSR_SFU1_DISABLE 0x00000008
227 #define PSR_MXM 0x00000004
228 #define PSR_IND 0x00000002
229 #define PSR_SFRZ 0x00000001
230
231 /* BCS requires that the SXIP_REGNUM (or PC_REGNUM) contain the address
232 of the next instr to be executed when a breakpoint occurs. Because
233 the kernel gets the next instr (SNIP_REGNUM), the instr in SNIP needs
234 to be put back into SFIP, and the instr in SXIP should be shifted
235 to SNIP */
236
237 /* Are you sitting down? It turns out that the 88K BCS (binary compatibility
238 standard) folks originally felt that the debugger should be responsible
239 for backing up the IPs, not the kernel (as is usually done). Well, they
240 have reversed their decision, and in future releases our kernel will be
241 handling the backing up of the IPs. So, eventually, we won't need to
242 do the SHIFT_INST_REGS stuff. But, for now, since there are 88K systems out
243 there that do need the debugger to do the IP shifting, and since there
244 will be systems where the kernel does the shifting, the code is a little
245 more complex than perhaps it needs to be (we still go inside SHIFT_INST_REGS,
246 and if the shifting hasn't occurred then gdb goes ahead and shifts). */
247
248 #define SHIFT_INST_REGS
249
250 /* Total amount of space needed to store our copies of the machine's
251 register state, the array `registers'. */
252
253 #define REGISTER_BYTES (NUM_REGS * sizeof(REGISTER_TYPE))
254
255 /* Index within `registers' of the first byte of the space for
256 register N. */
257
258 #define REGISTER_BYTE(N) ((N)*sizeof(REGISTER_TYPE))
259
260 /* Number of bytes of storage in the actual machine representation
261 for register N. */
262
263 #define REGISTER_RAW_SIZE(N) (sizeof(REGISTER_TYPE))
264
265 /* Number of bytes of storage in the program's representation
266 for register N. */
267
268 #define REGISTER_VIRTUAL_SIZE(N) (sizeof(REGISTER_TYPE))
269
270 /* Largest value REGISTER_RAW_SIZE can have. */
271
272 #define MAX_REGISTER_RAW_SIZE (sizeof(REGISTER_TYPE))
273
274 /* Largest value REGISTER_VIRTUAL_SIZE can have.
275 /* Are FPS1, FPS2, FPR "virtual" regisers? */
276
277 #define MAX_REGISTER_VIRTUAL_SIZE (sizeof(REGISTER_TYPE))
278
279 /* Nonzero if register N requires conversion
280 from raw format to virtual format. */
281
282 #define REGISTER_CONVERTIBLE(N) (0)
283
284 /* Convert data from raw format for register REGNUM
285 to virtual format for register REGNUM. */
286
287 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), (sizeof(REGISTER_TYPE)));}
288
289 /* Convert data from virtual format for register REGNUM
290 to raw format for register REGNUM. */
291
292 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), (sizeof(REGISTER_TYPE)));}
293
294 /* Return the GDB type object for the "standard" data type
295 of data in register N. */
296
297 #define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
298
299 /* The 88k call/return conventions call for "small" values to be returned
300 into consecutive registers starting from r2. */
301
302 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
303 bcopy (&(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), (VALBUF), TYPE_LENGTH (TYPE))
304
305 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
306
307 /* Write into appropriate registers a function return value
308 of type TYPE, given in virtual format. */
309
310 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
311 write_register_bytes (2*sizeof(void*), (VALBUF), TYPE_LENGTH (TYPE))
312
313 /* In COFF, if PCC says a parameter is a short or a char, do not
314 change it to int (it seems the convention is to change it). */
315
316 #define BELIEVE_PCC_PROMOTION 1
317
318 /* Describe the pointer in each stack frame to the previous stack frame
319 (its caller). */
320
321 /* FRAME_CHAIN takes a frame's nominal address
322 and produces the frame's chain-pointer.
323
324 FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
325 and produces the nominal address of the caller frame.
326
327 However, if FRAME_CHAIN_VALID returns zero,
328 it means the given frame is the outermost one and has no caller.
329 In that case, FRAME_CHAIN_COMBINE is not used. */
330
331 extern CORE_ADDR frame_chain ();
332 extern int frame_chain_valid ();
333 extern CORE_ADDR frame_chain_combine ();
334 extern int frameless_function_invocation ();
335
336 #define FRAME_CHAIN(thisframe) \
337 frame_chain (thisframe)
338
339 #define FRAME_CHAIN_VALID(chain, thisframe) \
340 frame_chain_valid (chain, thisframe)
341
342 #define FRAME_CHAIN_COMBINE(chain, thisframe) \
343 frame_chain_combine (chain, thisframe)
344
345 #define FRAMELESS_FUNCTION_INVOCATION(frame, fromleaf) \
346 fromleaf = frameless_function_invocation (frame)
347
348 /* Define other aspects of the stack frame. */
349
350 #define FRAME_SAVED_PC(FRAME) \
351 frame_saved_pc (FRAME)
352 extern CORE_ADDR frame_saved_pc ();
353
354 #define FRAME_ARGS_ADDRESS(fi) \
355 frame_args_address (fi)
356 extern CORE_ADDR frame_args_address ();
357
358 #define FRAME_LOCALS_ADDRESS(fi) \
359 frame_locals_address (fi)
360 extern CORE_ADDR frame_locals_address ();
361
362 /* Return number of args passed to a frame.
363 Can return -1, meaning no way to tell. */
364
365 #define FRAME_NUM_ARGS(numargs, fi) ((numargs) = -1)
366
367 /* Return number of bytes at start of arglist that are not really args. */
368
369 #define FRAME_ARGS_SKIP 0
370
371 /* Put here the code to store, into a struct frame_saved_regs,
372 the addresses of the saved registers of frame described by FRAME_INFO.
373 This includes special registers such as pc and fp saved in special
374 ways in the stack frame. sp is even more special:
375 the address we return for it IS the sp for the next frame. */
376
377 /* On the 88k, parameter registers get stored into the so called "homing"
378 area. This *always* happens when you compiled with GCC and use -g.
379 Also, (with GCC and -g) the saving of the parameter register values
380 always happens right within the function prologue code, so these register
381 values can generally be relied upon to be already copied into their
382 respective homing slots by the time you will normally try to look at
383 them (we hope).
384
385 Note that homing area stack slots are always at *positive* offsets from
386 the frame pointer. Thus, the homing area stack slots for the parameter
387 registers (passed values) for a given function are actually part of the
388 frame area of the caller. This is unusual, but it should not present
389 any special problems for GDB.
390
391 Note also that on the 88k, we are only interested in finding the
392 registers that might have been saved in memory. This is a subset of
393 the whole set of registers because the standard calling sequence allows
394 the called routine to clobber many registers.
395
396 We could manage to locate values for all of the so called "preserved"
397 registers (some of which may get saved within any particular frame) but
398 that would require decoding all of the tdesc information. Tht would be
399 nice information for GDB to have, but it is not strictly manditory if we
400 can live without the ability to look at values within (or backup to)
401 previous frames.
402 */
403
404 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
405 frame_find_saved_regs (frame_info, &frame_saved_regs)
406
407 \f
408 /* There is not currently a functioning way to call functions in the
409 inferior. */
410
411 /* But if there was this is where we'd put the call dummy. */
412 /* #define CALL_DUMMY_LOCATION AFTER_TEXT_END */
413
414 /* When popping a frame on the 88k (say when doing a return command), the
415 calling function only expects to have the "preserved" registers restored.
416 Thus, those are the only ones that we even try to restore here. */
417
418 extern void pop_frame ();
419
420 #define POP_FRAME pop_frame ()
421
422 /* BCS is a standard for binary compatibility. This machine uses it. */
423 #if !defined (BCS)
424 #define BCS 1
425 #endif
426
427 #define DELTA88
This page took 0.039307 seconds and 5 git commands to generate.