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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [config/] [alpha/] [tm-alpha.h] - Blame information for rev 578

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

Line No. Rev Author Line
1 578 markom
/* Definitions to make GDB run on an Alpha box under OSF1.  This is
2
   also used by the Alpha/Netware and Alpha/Linux targets.
3
   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000
4
   Free Software Foundation, Inc.
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 59 Temple Place - Suite 330,
21
   Boston, MA 02111-1307, USA.  */
22
 
23
#ifndef TM_ALPHA_H
24
#define TM_ALPHA_H
25
 
26
#include "regcache.h"
27
#include "bfd.h"
28
#include "coff/sym.h"           /* Needed for PDR below.  */
29
#include "coff/symconst.h"
30
 
31
struct frame_info;
32
struct type;
33
struct value;
34
struct symbol;
35
 
36
#if !defined (TARGET_BYTE_ORDER)
37
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
38
#endif
39
 
40
/* Redefine some target bit sizes from the default.  */
41
 
42
#define TARGET_LONG_BIT 64
43
#define TARGET_LONG_LONG_BIT 64
44
#define TARGET_PTR_BIT 64
45
 
46
/* Floating point is IEEE compliant */
47
#define IEEE_FLOAT (1)
48
 
49
/* Number of traps that happen between exec'ing the shell
50
 * to run an inferior, and when we finally get to
51
 * the inferior code.  This is 2 on most implementations.
52
 */
53
#define START_INFERIOR_TRAPS_EXPECTED 3
54
 
55
/* Offset from address of function to start of its code.
56
   Zero on most machines.  */
57
 
58
#define FUNCTION_START_OFFSET 0
59
 
60
/* Advance PC across any function entry prologue instructions
61
   to reach some "real" code.  */
62
 
63
#define SKIP_PROLOGUE(pc)       (alpha_skip_prologue(pc, 0))
64
extern CORE_ADDR alpha_skip_prologue (CORE_ADDR addr, int lenient);
65
 
66
/* Immediately after a function call, return the saved pc.
67
   Can't always go through the frames for this because on some machines
68
   the new frame is not set up until the new function executes
69
   some instructions.  */
70
 
71
#define SAVED_PC_AFTER_CALL(frame)      alpha_saved_pc_after_call(frame)
72
extern CORE_ADDR alpha_saved_pc_after_call (struct frame_info *);
73
 
74
/* Are we currently handling a signal ?  */
75
 
76
#define IN_SIGTRAMP(pc, name)   ((name) && STREQ ("__sigtramp", (name)))
77
 
78
/* Stack grows downward.  */
79
 
80
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
81
 
82
#define BREAKPOINT {0x80, 0, 0, 0}      /* call_pal bpt */
83
 
84
/* Amount PC must be decremented by after a breakpoint.
85
   This is often the number of bytes in BREAKPOINT
86
   but not always.  */
87
 
88
#ifndef DECR_PC_AFTER_BREAK
89
#define DECR_PC_AFTER_BREAK 4
90
#endif
91
 
92
/* Say how long (ordinary) registers are.  This is a piece of bogosity
93
   used in push_word and a few other places; REGISTER_RAW_SIZE is the
94
   real way to know how big a register is.  */
95
 
96
#define REGISTER_SIZE 8
97
 
98
/* Number of machine registers */
99
 
100
#define NUM_REGS 66
101
 
102
/* Initializer for an array of names of registers.
103
   There should be NUM_REGS strings in this initializer.  */
104
 
105
#define REGISTER_NAMES  \
106
    {   "v0",   "t0",   "t1",   "t2",   "t3",   "t4",   "t5",   "t6", \
107
        "t7",   "s0",   "s1",   "s2",   "s3",   "s4",   "s5",   "fp", \
108
        "a0",   "a1",   "a2",   "a3",   "a4",   "a5",   "t8",   "t9", \
109
        "t10",  "t11",  "ra",   "t12",  "at",   "gp",   "sp",   "zero", \
110
        "f0",   "f1",   "f2",   "f3",   "f4",   "f5",   "f6",   "f7", \
111
        "f8",   "f9",   "f10",  "f11",  "f12",  "f13",  "f14",  "f15", \
112
        "f16",  "f17",  "f18",  "f19",  "f20",  "f21",  "f22",  "f23",\
113
        "f24",  "f25",  "f26",  "f27",  "f28",  "f29",  "f30",  "fpcr",\
114
        "pc",   "vfp",                                          \
115
    }
116
 
117
/* Register numbers of various important registers.
118
   Note that most of these values are "real" register numbers,
119
   and correspond to the general registers of the machine,
120
   and FP_REGNUM is a "phony" register number which is too large
121
   to be an actual register number as far as the user is concerned
122
   but serves to get the desired value when passed to read_register.  */
123
 
124
#define V0_REGNUM 0             /* Function integer return value */
125
#define T7_REGNUM 8             /* Return address register for OSF/1 __add* */
126
#define GCC_FP_REGNUM 15        /* Used by gcc as frame register */
127
#define A0_REGNUM 16            /* Loc of first arg during a subr call */
128
#define T9_REGNUM 23            /* Return address register for OSF/1 __div* */
129
#define T12_REGNUM 27           /* Contains start addr of current proc */
130
#define SP_REGNUM 30            /* Contains address of top of stack */
131
#define RA_REGNUM 26            /* Contains return address value */
132
#define ZERO_REGNUM 31          /* Read-only register, always 0 */
133
#define FP0_REGNUM 32           /* Floating point register 0 */
134
#define FPA0_REGNUM 48          /* First float arg during a subr call */
135
#define FPCR_REGNUM 63          /* Floating point control register */
136
#define PC_REGNUM 64            /* Contains program counter */
137
#define FP_REGNUM 65            /* Virtual frame pointer */
138
 
139
#define CANNOT_FETCH_REGISTER(regno) \
140
  ((regno) == FP_REGNUM || (regno) == ZERO_REGNUM)
141
#define CANNOT_STORE_REGISTER(regno) \
142
  ((regno) == FP_REGNUM || (regno) == ZERO_REGNUM)
143
 
144
/* Total amount of space needed to store our copies of the machine's
145
   register state, the array `registers'.  */
146
#define REGISTER_BYTES (NUM_REGS * 8)
147
 
148
/* Index within `registers' of the first byte of the space for
149
   register N.  */
150
 
151
#define REGISTER_BYTE(N) ((N) * 8)
152
 
153
/* Number of bytes of storage in the actual machine representation
154
   for register N.  On Alphas, all regs are 8 bytes.  */
155
 
156
#define REGISTER_RAW_SIZE(N) 8
157
 
158
/* Number of bytes of storage in the program's representation
159
   for register N.  On Alphas, all regs are 8 bytes.  */
160
 
161
#define REGISTER_VIRTUAL_SIZE(N) 8
162
 
163
/* Largest value REGISTER_RAW_SIZE can have.  */
164
 
165
#define MAX_REGISTER_RAW_SIZE 8
166
 
167
/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
168
 
169
#define MAX_REGISTER_VIRTUAL_SIZE 8
170
 
171
/* Nonzero if register N requires conversion
172
   from raw format to virtual format.
173
   The alpha needs a conversion between register and memory format if
174
   the register is a floating point register and
175
   memory format is float, as the register format must be double
176
   or
177
   memory format is an integer with 4 bytes or less, as the representation
178
   of integers in floating point registers is different. */
179
 
180
#define REGISTER_CONVERTIBLE(N) ((N) >= FP0_REGNUM && (N) < FP0_REGNUM + 31)
181
 
182
/* Convert data from raw format for register REGNUM in buffer FROM
183
   to virtual format with type TYPE in buffer TO.  */
184
 
185
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM, TYPE, FROM, TO) \
186
  alpha_register_convert_to_virtual (REGNUM, TYPE, FROM, TO)
187
extern void
188
alpha_register_convert_to_virtual (int, struct type *, char *, char *);
189
 
190
/* Convert data from virtual format with type TYPE in buffer FROM
191
   to raw format for register REGNUM in buffer TO.  */
192
 
193
#define REGISTER_CONVERT_TO_RAW(TYPE, REGNUM, FROM, TO) \
194
  alpha_register_convert_to_raw (TYPE, REGNUM, FROM, TO)
195
extern void
196
alpha_register_convert_to_raw (struct type *, int, char *, char *);
197
 
198
/* Return the GDB type object for the "standard" data type
199
   of data in register N.  */
200
 
201
#define REGISTER_VIRTUAL_TYPE(N) \
202
        (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+31)  \
203
         ? builtin_type_double : builtin_type_long) \
204
 
205
/* Store the address of the place in which to copy the structure the
206
   subroutine will return.  Handled by alpha_push_arguments.  */
207
 
208
#define STORE_STRUCT_RETURN(addr, sp)
209
/**/
210
 
211
/* Extract from an array REGBUF containing the (raw) register state
212
   a function return value of type TYPE, and copy that, in virtual format,
213
   into VALBUF.  */
214
 
215
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
216
  alpha_extract_return_value(TYPE, REGBUF, VALBUF)
217
extern void alpha_extract_return_value (struct type *, char *, char *);
218
 
219
/* Write into appropriate registers a function return value
220
   of type TYPE, given in virtual format.  */
221
 
222
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
223
  alpha_store_return_value(TYPE, VALBUF)
224
extern void alpha_store_return_value (struct type *, char *);
225
 
226
/* Extract from an array REGBUF containing the (raw) register state
227
   the address in which a function should return its structure value,
228
   as a CORE_ADDR (or an expression that can be used as one).  */
229
/* The address is passed in a0 upon entry to the function, but when
230
   the function exits, the compiler has copied the value to v0.  This
231
   convention is specified by the System V ABI, so I think we can rely
232
   on it.  */
233
 
234
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
235
  (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
236
                    REGISTER_RAW_SIZE (V0_REGNUM)))
237
 
238
/* Structures are returned by ref in extra arg0 */
239
#define USE_STRUCT_CONVENTION(gcc_p, type)      1
240
 
241
 
242
/* Describe the pointer in each stack frame to the previous stack frame
243
   (its caller).  */
244
 
245
/* FRAME_CHAIN takes a frame's nominal address
246
   and produces the frame's chain-pointer. */
247
 
248
#define FRAME_CHAIN(thisframe) (CORE_ADDR) alpha_frame_chain (thisframe)
249
extern CORE_ADDR alpha_frame_chain (struct frame_info *);
250
 
251
/* Define other aspects of the stack frame.  */
252
 
253
 
254
/* An expression that tells us whether the function invocation represented
255
   by FI does not have a frame on the stack associated with it. */
256
/* We handle this differently for alpha, and maybe we should not */
257
 
258
#define FRAMELESS_FUNCTION_INVOCATION(FI)  (0)
259
 
260
/* Saved Pc.  */
261
 
262
#define FRAME_SAVED_PC(FRAME)   (alpha_frame_saved_pc(FRAME))
263
extern CORE_ADDR alpha_frame_saved_pc (struct frame_info *);
264
 
265
/* The alpha has two different virtual pointers for arguments and locals.
266
 
267
   The virtual argument pointer is pointing to the bottom of the argument
268
   transfer area, which is located immediately below the virtual frame
269
   pointer. Its size is fixed for the native compiler, it is either zero
270
   (for the no arguments case) or large enough to hold all argument registers.
271
   gcc uses a variable sized argument transfer area. As it has
272
   to stay compatible with the native debugging tools it has to use the same
273
   virtual argument pointer and adjust the argument offsets accordingly.
274
 
275
   The virtual local pointer is localoff bytes below the virtual frame
276
   pointer, the value of localoff is obtained from the PDR.  */
277
 
278
#define ALPHA_NUM_ARG_REGS      6
279
 
280
#define FRAME_ARGS_ADDRESS(fi)  ((fi)->frame - (ALPHA_NUM_ARG_REGS * 8))
281
 
282
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame - (fi)->localoff)
283
 
284
/* Return number of args passed to a frame.
285
   Can return -1, meaning no way to tell.  */
286
 
287
#define FRAME_NUM_ARGS(fi)      (-1)
288
 
289
/* Return number of bytes at start of arglist that are not really args.  */
290
 
291
#define FRAME_ARGS_SKIP 0
292
 
293
/* Put here the code to store, into a struct frame_saved_regs,
294
   the addresses of the saved registers of frame described by FRAME_INFO.
295
   This includes special registers such as pc and fp saved in special
296
   ways in the stack frame.  sp is even more special:
297
   the address we return for it IS the sp for the next frame.  */
298
 
299
extern void alpha_find_saved_regs (struct frame_info *);
300
 
301
#define FRAME_INIT_SAVED_REGS(frame_info) \
302
  do { \
303
    if ((frame_info)->saved_regs == NULL) \
304
      alpha_find_saved_regs (frame_info); \
305
    (frame_info)->saved_regs[SP_REGNUM] = (frame_info)->frame; \
306
  } while (0)
307
 
308
 
309
/* Things needed for making the inferior call functions.  */
310
 
311
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
312
  (alpha_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
313
extern CORE_ADDR
314
alpha_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
315
 
316
/* Push an empty stack frame, to record the current PC, etc.  */
317
 
318
#define PUSH_DUMMY_FRAME        alpha_push_dummy_frame()
319
extern void alpha_push_dummy_frame (void);
320
 
321
/* Discard from the stack the innermost frame, restoring all registers.  */
322
 
323
#define POP_FRAME               alpha_pop_frame()
324
extern void alpha_pop_frame (void);
325
 
326
/* Alpha OSF/1 inhibits execution of code on the stack.
327
   But there is no need for a dummy on the alpha. PUSH_ARGUMENTS
328
   takes care of all argument handling and bp_call_dummy takes care
329
   of stopping the dummy.  */
330
 
331
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
332
 
333
/* On the Alpha the call dummy code is never copied to user space,
334
   stopping the user call is achieved via a bp_call_dummy breakpoint.
335
   But we need a fake CALL_DUMMY definition to enable the proper
336
   call_function_by_hand and to avoid zero length array warnings
337
   in valops.c  */
338
 
339
#define CALL_DUMMY { 0 }        /* Content doesn't matter. */
340
 
341
#define CALL_DUMMY_START_OFFSET (0)
342
 
343
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
344
 
345
extern CORE_ADDR alpha_call_dummy_address (void);
346
#define CALL_DUMMY_ADDRESS() alpha_call_dummy_address()
347
 
348
/* Insert the specified number of args and function address
349
   into a call sequence of the above form stored at DUMMYNAME.
350
   We only have to set RA_REGNUM to the dummy breakpoint address
351
   and T12_REGNUM (the `procedure value register') to the function address.  */
352
 
353
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)    \
354
{                                                                       \
355
  CORE_ADDR bp_address = CALL_DUMMY_ADDRESS ();                 \
356
  if (bp_address == 0)                                                   \
357
    error ("no place to put call");                                     \
358
  write_register (RA_REGNUM, bp_address);                               \
359
  write_register (T12_REGNUM, fun);                                     \
360
}
361
 
362
/* There's a mess in stack frame creation.  See comments in blockframe.c
363
   near reference to INIT_FRAME_PC_FIRST.  */
364
 
365
#define INIT_FRAME_PC(fromleaf, prev)   /* nada */
366
 
367
#define INIT_FRAME_PC_FIRST(fromleaf, prev) \
368
  (prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \
369
              (prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ());
370
 
371
/* Special symbol found in blocks associated with routines.  We can hang
372
   alpha_extra_func_info_t's off of this.  */
373
 
374
#define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
375
extern void ecoff_relocate_efi (struct symbol *, CORE_ADDR);
376
 
377
/* Specific information about a procedure.
378
   This overlays the ALPHA's PDR records,
379
   alpharead.c (ab)uses this to save memory */
380
 
381
typedef struct alpha_extra_func_info
382
  {
383
    long numargs;               /* number of args to procedure (was iopt) */
384
    PDR pdr;                    /* Procedure descriptor record */
385
  }
386
 *alpha_extra_func_info_t;
387
 
388
/* Define the extra_func_info that mipsread.c needs.
389
   FIXME: We should define our own PDR interface, perhaps in a separate
390
   header file. This would get rid of the <bfd.h> inclusion in all sources
391
   and would abstract the mips/alpha interface from ecoff.  */
392
#define mips_extra_func_info alpha_extra_func_info
393
#define mips_extra_func_info_t alpha_extra_func_info_t
394
 
395
#define EXTRA_FRAME_INFO \
396
  int localoff; \
397
  int pc_reg; \
398
  alpha_extra_func_info_t proc_desc;
399
 
400
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci)
401
extern void init_extra_frame_info (struct frame_info *);
402
 
403
#define PRINT_EXTRA_FRAME_INFO(fi) \
404
  { \
405
    if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \
406
      printf_filtered (" frame pointer is at %s+%ld\n", \
407
                       REGISTER_NAME (fi->proc_desc->pdr.framereg), \
408
                                 fi->proc_desc->pdr.frameoffset); \
409
  }
410
 
411
/* It takes two values to specify a frame on the ALPHA.  Sigh.
412
 
413
   In fact, at the moment, the *PC* is the primary value that sets up
414
   a frame.  The PC is looked up to see what function it's in; symbol
415
   information from that function tells us which register is the frame
416
   pointer base, and what offset from there is the "virtual frame pointer".
417
   (This is usually an offset from SP.)  FIXME -- this should be cleaned
418
   up so that the primary value is the SP, and the PC is used to disambiguate
419
   multiple functions with the same SP that are at different stack levels. */
420
 
421
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
422
extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
423
 
424
/* This is used by heuristic_proc_start.  It should be shot it the head.  */
425
#ifndef VM_MIN_ADDRESS
426
#define VM_MIN_ADDRESS (CORE_ADDR)0x120000000
427
#endif
428
 
429
/* If PC is in a shared library trampoline code, return the PC
430
   where the function itself actually starts.  If not, return 0.  */
431
#define SKIP_TRAMPOLINE_CODE(pc)  find_solib_trampoline_target (pc)
432
 
433
/* If the current gcc for for this target does not produce correct debugging
434
   information for float parameters, both prototyped and unprototyped, then
435
   define this macro.  This forces gdb to  always assume that floats are
436
   passed as doubles and then converted in the callee.
437
 
438
   For the alpha, it appears that the debug info marks the parameters as
439
   floats regardless of whether the function is prototyped, but the actual
440
   values are always passed in as doubles.  Thus by setting this to 1, both
441
   types of calls will work. */
442
 
443
#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
444
 
445
/* Return TRUE if procedure descriptor PROC is a procedure descriptor
446
   that refers to a dynamically generated sigtramp function.
447
 
448
   OSF/1 doesn't use dynamic sigtramp functions, so this is always
449
   FALSE.  */
450
 
451
#define PROC_DESC_IS_DYN_SIGTRAMP(proc) (0)
452
#define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc)
453
 
454
/* If PC is inside a dynamically generated sigtramp function, return
455
   how many bytes the program counter is beyond the start of that
456
   function.  Otherwise, return a negative value.
457
 
458
   OSF/1 doesn't use dynamic sigtramp functions, so this always
459
   returns -1.  */
460
 
461
#define DYNAMIC_SIGTRAMP_OFFSET(pc)     (-1)
462
 
463
/* Translate a signal handler frame into the address of the sigcontext
464
   structure.  */
465
 
466
#define SIGCONTEXT_ADDR(frame) \
467
  (read_memory_integer ((frame)->next ? frame->next->frame : frame->frame, 8))
468
 
469
/* If FRAME refers to a sigtramp frame, return the address of the next
470
   frame.  */
471
 
472
#define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) \
473
  (alpha_osf_skip_sigtramp_frame (frame, pc))
474
extern CORE_ADDR alpha_osf_skip_sigtramp_frame (struct frame_info *,
475
                                                CORE_ADDR);
476
 
477
#endif /* TM_ALPHA_H */

powered by: WebSVN 2.1.0

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