OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [config/] [ns32k/] [tm-umax.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Definitions to make GDB run on an encore under umax 4.2
2
   Copyright 1987, 1989, 1991, 1993 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., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
/* This is also included by tm-ns32km3.h, as well as being used by umax.  */
22
 
23
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
24
 
25
/* Need to get function ends by adding this to epilogue address from .bf
26
   record, not using x_fsize field.  */
27
#define FUNCTION_EPILOGUE_SIZE 4
28
 
29
/* Offset from address of function to start of its code.
30
   Zero on most machines.  */
31
 
32
#define FUNCTION_START_OFFSET 0
33
 
34
/* Advance PC across any function entry prologue instructions
35
   to reach some "real" code.  */
36
 
37
extern CORE_ADDR umax_skip_prologue PARAMS ((CORE_ADDR));
38
#define SKIP_PROLOGUE(pc) (umax_skip_prologue (pc))
39
 
40
/* Immediately after a function call, return the saved pc.
41
   Can't always go through the frames for this because on some machines
42
   the new frame is not set up until the new function executes
43
   some instructions.  */
44
 
45
#define SAVED_PC_AFTER_CALL(frame) \
46
        read_memory_integer (read_register (SP_REGNUM), 4)
47
 
48
/* Address of end of stack space.  */
49
 
50
#ifndef STACK_END_ADDR
51
#define STACK_END_ADDR (0xfffff000)
52
#endif
53
 
54
/* Stack grows downward.  */
55
 
56
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
57
 
58
/* Sequence of bytes for breakpoint instruction.  */
59
 
60
#define BREAKPOINT {0xf2}
61
 
62
/* Amount PC must be decremented by after a breakpoint.
63
   This is often the number of bytes in BREAKPOINT
64
   but not always.  */
65
 
66
#define DECR_PC_AFTER_BREAK 0
67
 
68
#if 0                           /* Disable until fixed *correctly*.  */
69
#ifndef INVALID_FLOAT
70
#ifndef NaN
71
#include <nan.h>
72
#endif /* NaN */
73
 
74
/* Return 1 if P points to an invalid floating point value.  */
75
/* Surely wrong for cross-debugging.  */
76
#define INVALID_FLOAT(p, s) \
77
         ((s == sizeof (float))?        \
78
                NaF (*(float *) p) :    \
79
                NaD (*(double *) p))
80
#endif /* INVALID_FLOAT */
81
#endif
82
 
83
/* Say how long (ordinary) registers are.  This is a piece of bogosity
84
   used in push_word and a few other places; REGISTER_RAW_SIZE is the
85
   real way to know how big a register is.  */
86
 
87
#define REGISTER_SIZE 4
88
 
89
/* Number of machine registers */
90
 
91
#define NUM_REGS                25
92
 
93
#define NUM_GENERAL_REGS        8
94
 
95
/* Initializer for an array of names of registers.
96
   There should be NUM_REGS strings in this initializer.  */
97
 
98
#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
99
                        "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
100
                        "sp", "fp", "pc", "ps",                         \
101
                        "fsr",                                          \
102
                        "l0", "l1", "l2", "l3", "xx",                   \
103
                        }
104
 
105
/* Register numbers of various important registers.
106
   Note that some of these values are "real" register numbers,
107
   and correspond to the general registers of the machine,
108
   and some are "phony" register numbers which are too large
109
   to be actual register numbers as far as the user is concerned
110
   but do serve to get the desired values when passed to read_register.  */
111
 
112
#define R0_REGNUM 0             /* General register 0 */
113
#define FP0_REGNUM 8            /* Floating point register 0 */
114
#define SP_REGNUM 16            /* Contains address of top of stack */
115
#define AP_REGNUM FP_REGNUM
116
#define FP_REGNUM 17            /* Contains address of executing stack frame */
117
#define PC_REGNUM 18            /* Contains program counter */
118
#define PS_REGNUM 19            /* Contains processor status */
119
#define FPS_REGNUM 20           /* Floating point status register */
120
#define LP0_REGNUM 21           /* Double register 0 (same as FP0) */
121
 
122
/* Total amount of space needed to store our copies of the machine's
123
   register state, the array `registers'.  */
124
#define REGISTER_BYTES \
125
  ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \
126
   + 4            * REGISTER_RAW_SIZE(LP0_REGNUM))
127
 
128
/* Index within `registers' of the first byte of the space for
129
   register N.  */
130
 
131
#define REGISTER_BYTE(N) ((N) >= LP0_REGNUM ? \
132
        LP0_REGNUM * 4 + ((N) - LP0_REGNUM) * 8 : (N) * 4)
133
 
134
/* Number of bytes of storage in the actual machine representation
135
   for register N.  On the 32000, all regs are 4 bytes
136
   except for the doubled floating registers. */
137
 
138
#define REGISTER_RAW_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4)
139
 
140
/* Number of bytes of storage in the program's representation
141
   for register N.  On the 32000, all regs are 4 bytes
142
   except for the doubled floating registers. */
143
 
144
#define REGISTER_VIRTUAL_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4)
145
 
146
/* Largest value REGISTER_RAW_SIZE can have.  */
147
 
148
#define MAX_REGISTER_RAW_SIZE 8
149
 
150
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
151
 
152
#define MAX_REGISTER_VIRTUAL_SIZE 8
153
 
154
/* Return the GDB type object for the "standard" data type
155
   of data in register N.  */
156
 
157
#define REGISTER_VIRTUAL_TYPE(N) \
158
        (((N) < FP0_REGNUM) ?                           \
159
                builtin_type_int :                      \
160
                ((N) < FP0_REGNUM + 8) ?                \
161
                        builtin_type_float :            \
162
                        ((N) < LP0_REGNUM) ?            \
163
                                builtin_type_int :      \
164
                                builtin_type_double)
165
 
166
/* Store the address of the place in which to copy the structure the
167
   subroutine will return.  This is called from call_function.
168
 
169
   On this machine this is a no-op, because gcc isn't used on it
170
   yet.  So this calling convention is not used. */
171
 
172
#define STORE_STRUCT_RETURN(ADDR, SP)
173
 
174
/* Extract from an array REGBUF containing the (raw) register state
175
   a function return value of type TYPE, and copy that, in virtual format,
176
   into VALBUF.  */
177
 
178
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
179
  memcpy (VALBUF, REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), TYPE_LENGTH (TYPE))
180
 
181
/* Write into appropriate registers a function return value
182
   of type TYPE, given in virtual format.  */
183
 
184
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
185
  write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), VALBUF, TYPE_LENGTH (TYPE))
186
 
187
/* Extract from an array REGBUF containing the (raw) register state
188
   the address in which a function should return its structure value,
189
   as a CORE_ADDR (or an expression that can be used as one).  */
190
 
191
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
192
 
193
/* Describe the pointer in each stack frame to the previous stack frame
194
   (its caller).  */
195
 
196
/* FRAME_CHAIN takes a frame's nominal address
197
   and produces the frame's chain-pointer. */
198
 
199
/* In the case of the ns32000 series, the frame's nominal address is the FP
200
   value, and at that address is saved previous FP value as a 4-byte word.  */
201
 
202
#define FRAME_CHAIN(thisframe)  \
203
  (!inside_entry_file ((thisframe)->pc) ? \
204
   read_memory_integer ((thisframe)->frame, 4) :\
205
   0)
206
 
207
/* Define other aspects of the stack frame.  */
208
 
209
#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
210
 
211
/* Compute base of arguments. */
212
 
213
#define FRAME_ARGS_ADDRESS(fi)  \
214
  ((ns32k_get_enter_addr ((fi)->pc) > 1) ? \
215
        ((fi)->frame) : (read_register (SP_REGNUM) - 4))
216
 
217
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
218
 
219
/* Get the address of the enter opcode for this function, if it is active.
220
   Returns positive address > 1 if pc is between enter/exit,
221
   1 if pc before enter or after exit, 0 otherwise. */
222
 
223
extern CORE_ADDR ns32k_get_enter_addr ();
224
 
225
/* Return number of bytes at start of arglist that are not really args.  */
226
 
227
#define FRAME_ARGS_SKIP 8
228
 
229
/* Put here the code to store, into a struct frame_saved_regs,
230
   the addresses of the saved registers of frame described by FRAME_INFO.
231
   This includes special registers such as pc and fp saved in special
232
   ways in the stack frame.  sp is even more special:
233
   the address we return for it IS the sp for the next frame.  */
234
 
235
extern int umax_frame_num_args PARAMS ((struct frame_info * fi));
236
#define FRAME_NUM_ARGS(fi) (umax_frame_num_args ((fi)))
237
 
238
/* Things needed for making the inferior call functions.  */
239
 
240
/* Push an empty stack frame, to record the current PC, etc.  */
241
 
242
#define PUSH_DUMMY_FRAME \
243
{ register CORE_ADDR sp = read_register (SP_REGNUM);\
244
  register int regnum;                              \
245
  sp = push_word (sp, read_register (PC_REGNUM));   \
246
  sp = push_word (sp, read_register (FP_REGNUM));   \
247
  write_register (FP_REGNUM, sp);                   \
248
  for (regnum = 0; regnum < 8; regnum++)  \
249
    sp = push_word (sp, read_register (regnum));    \
250
  write_register (SP_REGNUM, sp);                       \
251
}
252
 
253
/* Discard from the stack the innermost frame, restoring all registers.  */
254
 
255
#define POP_FRAME  \
256
{ register struct frame_info *frame = get_current_frame ();      \
257
  register CORE_ADDR fp;                                         \
258
  register int regnum;                                           \
259
  struct frame_saved_regs fsr;                                   \
260
  struct frame_info *fi;                                                 \
261
  fp = frame->frame;                                             \
262
  get_frame_saved_regs (frame, &fsr);                            \
263
  for (regnum = 0; regnum < 8; regnum++)                  \
264
    if (fsr.regs[regnum])                                        \
265
      write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
266
  write_register (FP_REGNUM, read_memory_integer (fp, 4));       \
267
  write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));   \
268
  write_register (SP_REGNUM, fp + 8);                            \
269
  flush_cached_frames ();                                        \
270
}
271
 
272
/* This sequence of words is the instructions
273
   enter        0xff,0          82 ff 00
274
   jsr  @0x00010203     7f ae c0 01 02 03
275
   adjspd       0x69696969      7f a5 01 02 03 04
276
   bpt                  f2
277
   Note this is 16 bytes.  */
278
 
279
#define CALL_DUMMY { 0x7f00ff82, 0x0201c0ae, 0x01a57f03, 0xf2040302 }
280
 
281
#define CALL_DUMMY_START_OFFSET 3
282
#define CALL_DUMMY_LENGTH       16
283
#define CALL_DUMMY_ADDR         5
284
#define CALL_DUMMY_NARGS        11
285
 
286
/* Insert the specified number of args and function address
287
   into a call sequence of the above form stored at DUMMYNAME.  */
288
 
289
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)            \
290
{                                                               \
291
        int     flipped;                                        \
292
        flipped = fun | 0xc0000000;                             \
293
        flip_bytes (&flipped, 4);                               \
294
        *((int *) (((char *) dummyname)+CALL_DUMMY_ADDR)) = flipped;    \
295
        flipped = - nargs * 4;                                  \
296
        flip_bytes (&flipped, 4);                               \
297
        *((int *) (((char *) dummyname)+CALL_DUMMY_NARGS)) = flipped;   \
298
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.