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