1130803Smarcel/* Common target dependent code for GDB on Alpha systems.
2130803Smarcel   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003 Free
3130803Smarcel   Software Foundation, Inc.
4130803Smarcel
5130803Smarcel   This file is part of GDB.
6130803Smarcel
7130803Smarcel   This program is free software; you can redistribute it and/or modify
8130803Smarcel   it under the terms of the GNU General Public License as published by
9130803Smarcel   the Free Software Foundation; either version 2 of the License, or
10130803Smarcel   (at your option) any later version.
11130803Smarcel
12130803Smarcel   This program is distributed in the hope that it will be useful,
13130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
14130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15130803Smarcel   GNU General Public License for more details.
16130803Smarcel
17130803Smarcel   You should have received a copy of the GNU General Public License
18130803Smarcel   along with this program; if not, write to the Free Software
19130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
20130803Smarcel   Boston, MA 02111-1307, USA.  */
21130803Smarcel
22130803Smarcel#ifndef ALPHA_TDEP_H
23130803Smarcel#define ALPHA_TDEP_H
24130803Smarcel
25130803Smarcel/* Say how long (ordinary) registers are.  This is a piece of bogosity
26130803Smarcel   used in push_word and a few other places;
27130803Smarcel   DEPRECATED_REGISTER_RAW_SIZE is the real way to know how big a
28130803Smarcel   register is.  */
29130803Smarcel#define ALPHA_REGISTER_SIZE 8
30130803Smarcel
31130803Smarcel/* Number of machine registers.  */
32130803Smarcel#define ALPHA_NUM_REGS 67
33130803Smarcel
34130803Smarcel/* Total amount of space needed to store our copies of the machine's
35130803Smarcel   register state.  */
36130803Smarcel#define ALPHA_REGISTER_BYTES (ALPHA_NUM_REGS * 8)
37130803Smarcel
38130803Smarcel/* Register numbers of various important registers.  Note that most of
39130803Smarcel   these values are "real" register numbers, and correspond to the
40130803Smarcel   general registers of the machine.  */
41130803Smarcel
42130803Smarcel#define ALPHA_V0_REGNUM	     0  /* Function integer return value */
43130803Smarcel#define ALPHA_T7_REGNUM	     8  /* Return address register for OSF/1 __add* */
44130803Smarcel#define ALPHA_GCC_FP_REGNUM 15  /* Used by gcc as frame register */
45130803Smarcel#define ALPHA_A0_REGNUM     16  /* Loc of first arg during a subr call */
46130803Smarcel#define ALPHA_T9_REGNUM     23  /* Return address register for OSF/1 __div* */
47130803Smarcel#define ALPHA_RA_REGNUM     26  /* Contains return address value */
48130803Smarcel#define ALPHA_T12_REGNUM    27  /* Contains start addr of current proc */
49130803Smarcel#define ALPHA_GP_REGNUM     29  /* Contains the global pointer */
50130803Smarcel#define ALPHA_SP_REGNUM     30  /* Contains address of top of stack */
51130803Smarcel#define ALPHA_ZERO_REGNUM   31  /* Read-only register, always 0 */
52130803Smarcel#define ALPHA_FP0_REGNUM    32  /* Floating point register 0 */
53130803Smarcel#define ALPHA_FPA0_REGNUM   48  /* First float arg during a subr call */
54130803Smarcel#define ALPHA_FPCR_REGNUM   63  /* Floating point control register */
55130803Smarcel#define ALPHA_PC_REGNUM     64  /* Contains program counter */
56130803Smarcel#define ALPHA_UNIQUE_REGNUM 66	/* PAL_rduniq value */
57130803Smarcel
58130803Smarcel/* The alpha has two different virtual pointers for arguments and locals.
59130803Smarcel
60130803Smarcel   The virtual argument pointer is pointing to the bottom of the argument
61130803Smarcel   transfer area, which is located immediately below the virtual frame
62130803Smarcel   pointer. Its size is fixed for the native compiler, it is either zero
63130803Smarcel   (for the no arguments case) or large enough to hold all argument registers.
64130803Smarcel   gcc uses a variable sized argument transfer area. As it has
65130803Smarcel   to stay compatible with the native debugging tools it has to use the same
66130803Smarcel   virtual argument pointer and adjust the argument offsets accordingly.
67130803Smarcel
68130803Smarcel   The virtual local pointer is localoff bytes below the virtual frame
69130803Smarcel   pointer, the value of localoff is obtained from the PDR.  */
70130803Smarcel#define ALPHA_NUM_ARG_REGS   6
71130803Smarcel
72130803Smarcel/* Target-dependent structure in gdbarch.  */
73130803Smarcelstruct gdbarch_tdep
74130803Smarcel{
75130803Smarcel  CORE_ADDR vm_min_address;	/* Used by alpha_heuristic_proc_start.  */
76130803Smarcel
77130803Smarcel  /* If PC is inside a dynamically-generated signal trampoline function
78130803Smarcel     (i.e. one copied onto the user stack at run-time), return how many
79130803Smarcel     bytes PC is beyond the start of that function.  Otherwise, return -1.  */
80130803Smarcel  LONGEST (*dynamic_sigtramp_offset) (CORE_ADDR);
81130803Smarcel
82130803Smarcel  /* Translate a signal handler stack base address into the address of
83130803Smarcel     the sigcontext structure for that signal handler.  */
84130803Smarcel  CORE_ADDR (*sigcontext_addr) (struct frame_info *);
85130803Smarcel
86130803Smarcel  /* Offset of registers in `struct sigcontext'.  */
87130803Smarcel  int sc_pc_offset;
88130803Smarcel  int sc_regs_offset;
89130803Smarcel  int sc_fpregs_offset;
90130803Smarcel
91130803Smarcel  int jb_pc;			/* Offset to PC value in jump buffer.
92130803Smarcel				   If htis is negative, longjmp support
93130803Smarcel				   will be disabled.  */
94130803Smarcel  size_t jb_elt_size;		/* And the size of each entry in the buf. */
95130803Smarcel};
96130803Smarcel
97130803Smarcelextern unsigned int alpha_read_insn (CORE_ADDR pc);
98130803Smarcelextern void alpha_software_single_step (enum target_signal, int);
99130803Smarcelextern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);
100130803Smarcel
101130803Smarcelextern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
102130803Smarcelextern void alpha_dwarf2_init_abi (struct gdbarch_info, struct gdbarch *);
103130803Smarcel
104130803Smarcelextern void alpha_supply_int_regs (int, const void *, const void *,
105130803Smarcel				   const void *);
106130803Smarcelextern void alpha_fill_int_regs (int, void *, void *, void *);
107130803Smarcelextern void alpha_supply_fp_regs (int, const void *, const void *);
108130803Smarcelextern void alpha_fill_fp_regs (int, void *, void *);
109130803Smarcel
110130803Smarcel#endif /* ALPHA_TDEP_H */
111