ee6ec00805d08d03471bc9ad717810154400f030
[external/binutils.git] / gdb / config / vax / tm-vax.h
1 /* Definitions to make GDB run on a vax under 4.2bsd.
2    Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2002
3    Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 /* Offset from address of function to start of its code.
23    Zero on most machines.  */
24
25 #define FUNCTION_START_OFFSET 2
26
27 extern CORE_ADDR vax_skip_prologue (CORE_ADDR);
28 #define SKIP_PROLOGUE(pc) (vax_skip_prologue (pc))
29
30 #define SAVED_PC_AFTER_CALL(frame) vax_saved_pc_after_call ((frame))
31 extern CORE_ADDR vax_saved_pc_after_call (struct frame_info *);
32
33 #define TARGET_UPAGES 14
34 #define TARGET_NBPG 512
35 #define STACK_END_ADDR (0x80000000 - (TARGET_UPAGES * TARGET_NBPG))
36
37 /* On the VAX, sigtramp is in the u area.  Can't check the exact
38    addresses because for cross-debugging we don't have VAX include
39    files around.  This should be close enough.  */
40 #define SIGTRAMP_START(pc)      STACK_END_ADDR
41 #define SIGTRAMP_END(pc)        0x80000000
42
43 /* Stack grows downward.  */
44
45 #define INNER_THAN(lhs,rhs) core_addr_lessthan ((lhs), (rhs))
46
47 /* Sequence of bytes for breakpoint instruction.  */
48
49 #define BREAKPOINT {3}
50
51 /* Amount PC must be decremented by after a breakpoint.
52    This is often the number of bytes in BREAKPOINT
53    but not always.  */
54
55 #define DECR_PC_AFTER_BREAK 0
56
57 /* Say how long (ordinary) registers are.  This is a piece of bogosity
58    used in push_word and a few other places; REGISTER_RAW_SIZE is the
59    real way to know how big a register is.  */
60
61 #define REGISTER_SIZE 4
62
63 /* Number of machine registers */
64
65 #define NUM_REGS 17
66
67 /* Return the name of the register specified by N.  */
68 #define REGISTER_NAME(N) vax_register_name ((N))
69 extern char *vax_register_name (int);
70
71 /* Register numbers of various important registers.
72    Note that some of these values are "real" register numbers,
73    and correspond to the general registers of the machine,
74    and some are "phony" register numbers which are too large
75    to be actual register numbers as far as the user is concerned
76    but do serve to get the desired values when passed to read_register.  */
77
78 #define AP_REGNUM 12
79 #define FP_REGNUM 13            /* Contains address of executing stack frame */
80 #define SP_REGNUM 14            /* Contains address of top of stack */
81 #define PC_REGNUM 15            /* Contains program counter */
82 #define PS_REGNUM 16            /* Contains processor status */
83
84 /* Total amount of space needed to store our copies of the machine's
85    register state, the array `registers'.  */
86 #define REGISTER_BYTES (17*4)
87
88 /* Index within `registers' of the first byte of the space for
89    register N.  */
90 #define REGISTER_BYTE(N) vax_register_byte ((N))
91 extern int vax_register_byte (int);
92
93 /* Number of bytes of storage in the actual machine representation
94    for register N.  On the vax, all regs are 4 bytes.  */
95 #define REGISTER_RAW_SIZE(N) vax_register_raw_size ((N))
96 extern int vax_register_raw_size (int);
97
98 /* Number of bytes of storage in the program's representation
99    for register N.  On the vax, all regs are 4 bytes.  */
100 #define REGISTER_VIRTUAL_SIZE(N) vax_register_virtual_size ((N))
101 extern int vax_register_virtual_size (int);
102
103 /* Largest value REGISTER_RAW_SIZE can have.  */
104
105 #define MAX_REGISTER_RAW_SIZE 4
106
107 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
108
109 #define MAX_REGISTER_VIRTUAL_SIZE 4
110
111 /* Return the GDB type object for the "standard" data type
112    of data in register N.  */
113 #define REGISTER_VIRTUAL_TYPE(N) vax_register_virtual_type ((N))
114 extern struct type *vax_register_virtual_type (int);
115
116 #define STORE_STRUCT_RETURN(ADDR, SP) vax_store_struct_return ((ADDR), (SP))
117 extern void vax_store_struct_return (CORE_ADDR, CORE_ADDR);
118
119 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
120   vax_extract_return_value ((TYPE), (REGBUF), (VALBUF))
121 extern void vax_extract_return_value (struct type *, char *, char *);
122
123 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
124   vax_store_return_value ((TYPE), (VALBUF))
125 extern void vax_store_return_value (struct type *, char *);
126
127 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
128   vax_extract_struct_value_address ((REGBUF))
129 extern CORE_ADDR vax_extract_struct_value_address (char *);
130 \f
131
132 #define FRAME_CHAIN(FI) vax_frame_chain ((FI))
133 extern CORE_ADDR vax_frame_chain (struct frame_info *);
134
135 #define FRAMELESS_FUNCTION_INVOCATION(FI) \
136   generic_frameless_function_invocation_not ((FI))
137
138 /* Offset to saved PC in sigcontext, from <sys/signal.h>.  */
139 /* XXXJRT should go away */
140 #define SIGCONTEXT_PC_OFFSET 12
141
142 #define FRAME_SAVED_PC(FRAME) vax_frame_saved_pc ((FRAME))
143 extern CORE_ADDR vax_frame_saved_pc (struct frame_info *);
144
145 /* XXXJRT not yet under gdbarch control */
146 #define FRAME_ARGS_ADDRESS_CORRECT(fi) vax_frame_args_address ((fi))
147 extern CORE_ADDR vax_frame_args_address (struct frame_info *);
148
149 #define FRAME_ARGS_ADDRESS(fi) vax_frame_args_address ((fi))
150 extern CORE_ADDR vax_frame_args_address (struct frame_info *);
151
152 #define FRAME_LOCALS_ADDRESS(fi) vax_frame_locals_address ((fi))
153 extern CORE_ADDR vax_frame_locals_address (struct frame_info *);
154
155 extern int vax_frame_num_args (struct frame_info *fi);
156 #define FRAME_NUM_ARGS(fi) (vax_frame_num_args ((fi)))
157
158 /* Return number of bytes at start of arglist that are not really args.  */
159
160 #define FRAME_ARGS_SKIP 4
161
162 #define FRAME_INIT_SAVED_REGS(fi) vax_frame_init_saved_regs ((fi))
163 extern void vax_frame_init_saved_regs (struct frame_info *);
164 \f
165 #define PUSH_DUMMY_FRAME vax_push_dummy_frame()
166 extern void vax_push_dummy_frame (void);
167
168 #define POP_FRAME vax_pop_frame()
169 extern void vax_pop_frame (void);
170
171 #define CALL_DUMMY_WORDS vax_call_dummy_words
172 extern LONGEST vax_call_dummy_words[];
173
174 #define SIZEOF_CALL_DUMMY_WORDS sizeof_vax_call_dummy_words
175 extern int sizeof_vax_call_dummy_words;
176
177 struct value;
178 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
179   vax_fix_call_dummy ((dummyname), (pc), (fun), (nargs), (args), (type), \
180                       (gcc_p))
181 extern void vax_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
182                                 struct value **, struct type *, int);
183
184 #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
185
186 #define CALL_DUMMY_BREAKPOINT_OFFSET 7
187
188 /* If vax pcc says CHAR or SHORT, it provides the correct address.  */
189
190 #define BELIEVE_PCC_PROMOTION 1