Commit | Line | Data |
---|---|---|
0543f387 | 1 | /* Target-dependent code for the VAX. |
464e0365 | 2 | |
61baf725 | 3 | Copyright (C) 1986-2017 Free Software Foundation, Inc. |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 10 | (at your option) any later version. |
c906108c | 11 | |
c5aa993b JM |
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. | |
c906108c | 16 | |
c5aa993b | 17 | You should have received a copy of the GNU General Public License |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
19 | |
20 | #include "defs.h" | |
0543f387 MK |
21 | #include "arch-utils.h" |
22 | #include "dis-asm.h" | |
c11c3a98 | 23 | #include "frame.h" |
7def7fef MK |
24 | #include "frame-base.h" |
25 | #include "frame-unwind.h" | |
0543f387 MK |
26 | #include "gdbcore.h" |
27 | #include "gdbtypes.h" | |
4be87837 | 28 | #include "osabi.h" |
0543f387 | 29 | #include "regcache.h" |
8b910bab | 30 | #include "regset.h" |
0543f387 MK |
31 | #include "trad-frame.h" |
32 | #include "value.h" | |
8b910bab | 33 | |
f267bd6a JT |
34 | #include "vax-tdep.h" |
35 | ||
5e6b39ff MK |
36 | /* Return the name of register REGNUM. */ |
37 | ||
fa88f677 | 38 | static const char * |
d93859e2 | 39 | vax_register_name (struct gdbarch *gdbarch, int regnum) |
51eb8b08 | 40 | { |
a121b7c1 | 41 | static const char *register_names[] = |
51eb8b08 | 42 | { |
5e6b39ff MK |
43 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", |
44 | "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc", | |
51eb8b08 JT |
45 | "ps", |
46 | }; | |
47 | ||
5e6b39ff MK |
48 | if (regnum >= 0 && regnum < ARRAY_SIZE (register_names)) |
49 | return register_names[regnum]; | |
51eb8b08 | 50 | |
5e6b39ff | 51 | return NULL; |
51eb8b08 JT |
52 | } |
53 | ||
5e6b39ff | 54 | /* Return the GDB type object for the "standard" data type of data in |
581e13c1 | 55 | register REGNUM. */ |
51eb8b08 | 56 | |
f267bd6a | 57 | static struct type * |
5e6b39ff | 58 | vax_register_type (struct gdbarch *gdbarch, int regnum) |
51eb8b08 | 59 | { |
0dfff4cb | 60 | return builtin_type (gdbarch)->builtin_int; |
51eb8b08 JT |
61 | } |
62 | \f | |
8b910bab MK |
63 | /* Core file support. */ |
64 | ||
65 | /* Supply register REGNUM from the buffer specified by GREGS and LEN | |
66 | in the general-purpose register set REGSET to register cache | |
67 | REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | |
68 | ||
69 | static void | |
70 | vax_supply_gregset (const struct regset *regset, struct regcache *regcache, | |
71 | int regnum, const void *gregs, size_t len) | |
72 | { | |
19ba03f4 | 73 | const gdb_byte *regs = (const gdb_byte *) gregs; |
8b910bab MK |
74 | int i; |
75 | ||
76 | for (i = 0; i < VAX_NUM_REGS; i++) | |
77 | { | |
78 | if (regnum == i || regnum == -1) | |
79 | regcache_raw_supply (regcache, i, regs + i * 4); | |
80 | } | |
81 | } | |
52efde73 | 82 | |
8b910bab MK |
83 | /* VAX register set. */ |
84 | ||
3ca7dae4 | 85 | static const struct regset vax_gregset = |
8b910bab MK |
86 | { |
87 | NULL, | |
88 | vax_supply_gregset | |
89 | }; | |
90 | ||
f73d3ce7 | 91 | /* Iterate over core file register note sections. */ |
8b910bab | 92 | |
f73d3ce7 AA |
93 | static void |
94 | vax_iterate_over_regset_sections (struct gdbarch *gdbarch, | |
95 | iterate_over_regset_sections_cb *cb, | |
96 | void *cb_data, | |
97 | const struct regcache *regcache) | |
8b910bab | 98 | { |
f73d3ce7 | 99 | cb (".reg", VAX_NUM_REGS * 4, &vax_gregset, NULL, cb_data); |
8b910bab MK |
100 | } |
101 | \f | |
4cd80476 | 102 | /* The VAX UNIX calling convention uses R1 to pass a structure return |
67b441e1 MK |
103 | value address instead of passing it as a first (hidden) argument as |
104 | the VMS calling convention suggests. */ | |
105 | ||
7346c184 MK |
106 | static CORE_ADDR |
107 | vax_store_arguments (struct regcache *regcache, int nargs, | |
67b441e1 | 108 | struct value **args, CORE_ADDR sp) |
52efde73 | 109 | { |
e17a4113 UW |
110 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
111 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | |
8cc49c48 | 112 | gdb_byte buf[4]; |
7346c184 MK |
113 | int count = 0; |
114 | int i; | |
52efde73 | 115 | |
7346c184 MK |
116 | /* We create an argument list on the stack, and make the argument |
117 | pointer to it. */ | |
52efde73 | 118 | |
7346c184 MK |
119 | /* Push arguments in reverse order. */ |
120 | for (i = nargs - 1; i >= 0; i--) | |
52efde73 | 121 | { |
4754a64e | 122 | int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
7346c184 MK |
123 | |
124 | sp -= (len + 3) & ~3; | |
125 | count += (len + 3) / 4; | |
46615f07 | 126 | write_memory (sp, value_contents_all (args[i]), len); |
52efde73 | 127 | } |
a33f7558 | 128 | |
7346c184 MK |
129 | /* Push argument count. */ |
130 | sp -= 4; | |
e17a4113 | 131 | store_unsigned_integer (buf, 4, byte_order, count); |
7346c184 | 132 | write_memory (sp, buf, 4); |
a33f7558 | 133 | |
7346c184 | 134 | /* Update the argument pointer. */ |
e17a4113 | 135 | store_unsigned_integer (buf, 4, byte_order, sp); |
7346c184 | 136 | regcache_cooked_write (regcache, VAX_AP_REGNUM, buf); |
a33f7558 | 137 | |
7346c184 MK |
138 | return sp; |
139 | } | |
140 | ||
141 | static CORE_ADDR | |
7d9b040b | 142 | vax_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
7346c184 MK |
143 | struct regcache *regcache, CORE_ADDR bp_addr, int nargs, |
144 | struct value **args, CORE_ADDR sp, int struct_return, | |
145 | CORE_ADDR struct_addr) | |
146 | { | |
e17a4113 | 147 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
7346c184 | 148 | CORE_ADDR fp = sp; |
8cc49c48 | 149 | gdb_byte buf[4]; |
7346c184 MK |
150 | |
151 | /* Set up the function arguments. */ | |
67b441e1 MK |
152 | sp = vax_store_arguments (regcache, nargs, args, sp); |
153 | ||
154 | /* Store return value address. */ | |
155 | if (struct_return) | |
156 | regcache_cooked_write_unsigned (regcache, VAX_R1_REGNUM, struct_addr); | |
7346c184 MK |
157 | |
158 | /* Store return address in the PC slot. */ | |
159 | sp -= 4; | |
e17a4113 | 160 | store_unsigned_integer (buf, 4, byte_order, bp_addr); |
7346c184 MK |
161 | write_memory (sp, buf, 4); |
162 | ||
163 | /* Store the (fake) frame pointer in the FP slot. */ | |
164 | sp -= 4; | |
e17a4113 | 165 | store_unsigned_integer (buf, 4, byte_order, fp); |
7346c184 MK |
166 | write_memory (sp, buf, 4); |
167 | ||
168 | /* Skip the AP slot. */ | |
169 | sp -= 4; | |
170 | ||
171 | /* Store register save mask and control bits. */ | |
172 | sp -= 4; | |
e17a4113 | 173 | store_unsigned_integer (buf, 4, byte_order, 0); |
7346c184 MK |
174 | write_memory (sp, buf, 4); |
175 | ||
176 | /* Store condition handler. */ | |
177 | sp -= 4; | |
e17a4113 | 178 | store_unsigned_integer (buf, 4, byte_order, 0); |
7346c184 MK |
179 | write_memory (sp, buf, 4); |
180 | ||
181 | /* Update the stack pointer and frame pointer. */ | |
e17a4113 | 182 | store_unsigned_integer (buf, 4, byte_order, sp); |
7346c184 MK |
183 | regcache_cooked_write (regcache, VAX_SP_REGNUM, buf); |
184 | regcache_cooked_write (regcache, VAX_FP_REGNUM, buf); | |
185 | ||
186 | /* Return the saved (fake) frame pointer. */ | |
187 | return fp; | |
188 | } | |
189 | ||
190 | static struct frame_id | |
94afd7a6 | 191 | vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) |
a33f7558 | 192 | { |
7346c184 MK |
193 | CORE_ADDR fp; |
194 | ||
94afd7a6 UW |
195 | fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); |
196 | return frame_id_build (fp, get_frame_pc (this_frame)); | |
a33f7558 | 197 | } |
ab62c900 | 198 | \f |
7346c184 | 199 | |
67b441e1 | 200 | static enum return_value_convention |
6a3a010b | 201 | vax_return_value (struct gdbarch *gdbarch, struct value *function, |
c055b101 CV |
202 | struct type *type, struct regcache *regcache, |
203 | gdb_byte *readbuf, const gdb_byte *writebuf) | |
ea74468c | 204 | { |
bad43aa5 | 205 | int len = TYPE_LENGTH (type); |
8cc49c48 | 206 | gdb_byte buf[8]; |
ea74468c | 207 | |
67b441e1 | 208 | if (TYPE_CODE (type) == TYPE_CODE_STRUCT |
caed1a45 | 209 | || TYPE_CODE (type) == TYPE_CODE_UNION |
67b441e1 | 210 | || TYPE_CODE (type) == TYPE_CODE_ARRAY) |
e5483145 MK |
211 | { |
212 | /* The default on VAX is to return structures in static memory. | |
213 | Consequently a function must return the address where we can | |
214 | find the return value. */ | |
215 | ||
216 | if (readbuf) | |
217 | { | |
218 | ULONGEST addr; | |
219 | ||
220 | regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); | |
bad43aa5 | 221 | read_memory (addr, readbuf, len); |
e5483145 MK |
222 | } |
223 | ||
224 | return RETURN_VALUE_ABI_RETURNS_ADDRESS; | |
225 | } | |
ea74468c | 226 | |
67b441e1 MK |
227 | if (readbuf) |
228 | { | |
229 | /* Read the contents of R0 and (if necessary) R1. */ | |
230 | regcache_cooked_read (regcache, VAX_R0_REGNUM, buf); | |
bad43aa5 | 231 | if (len > 4) |
67b441e1 | 232 | regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4); |
bad43aa5 | 233 | memcpy (readbuf, buf, len); |
67b441e1 MK |
234 | } |
235 | if (writebuf) | |
236 | { | |
237 | /* Read the contents to R0 and (if necessary) R1. */ | |
bad43aa5 | 238 | memcpy (buf, writebuf, len); |
67b441e1 | 239 | regcache_cooked_write (regcache, VAX_R0_REGNUM, buf); |
bad43aa5 | 240 | if (len > 4) |
67b441e1 MK |
241 | regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4); |
242 | } | |
243 | ||
244 | return RETURN_VALUE_REGISTER_CONVENTION; | |
ea74468c | 245 | } |
ea74468c | 246 | \f |
5e6b39ff MK |
247 | |
248 | /* Use the program counter to determine the contents and size of a | |
249 | breakpoint instruction. Return a pointer to a string of bytes that | |
250 | encode a breakpoint instruction, store the length of the string in | |
251 | *LEN and optionally adjust *PC to point to the correct memory | |
252 | location for inserting the breakpoint. */ | |
1d049c5e | 253 | |
04180708 | 254 | constexpr gdb_byte vax_break_insn[] = { 3 }; |
598cc9dc | 255 | |
04180708 | 256 | typedef BP_MANIPULATION (vax_break_insn) vax_breakpoint; |
1d049c5e | 257 | \f |
b83266a0 SS |
258 | /* Advance PC across any function entry prologue instructions |
259 | to reach some "real" code. */ | |
260 | ||
f267bd6a | 261 | static CORE_ADDR |
6093d2eb | 262 | vax_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) |
b83266a0 | 263 | { |
e17a4113 UW |
264 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
265 | gdb_byte op = read_memory_unsigned_integer (pc, 1, byte_order); | |
0543f387 | 266 | |
b83266a0 | 267 | if (op == 0x11) |
c5aa993b | 268 | pc += 2; /* skip brb */ |
b83266a0 | 269 | if (op == 0x31) |
c5aa993b | 270 | pc += 3; /* skip brw */ |
b83266a0 | 271 | if (op == 0xC2 |
e17a4113 | 272 | && read_memory_unsigned_integer (pc + 2, 1, byte_order) == 0x5E) |
c5aa993b | 273 | pc += 3; /* skip subl2 */ |
b83266a0 | 274 | if (op == 0x9E |
e17a4113 UW |
275 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xAE |
276 | && read_memory_unsigned_integer (pc + 3, 1, byte_order) == 0x5E) | |
c5aa993b | 277 | pc += 4; /* skip movab */ |
b83266a0 | 278 | if (op == 0x9E |
e17a4113 UW |
279 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xCE |
280 | && read_memory_unsigned_integer (pc + 4, 1, byte_order) == 0x5E) | |
c5aa993b | 281 | pc += 5; /* skip movab */ |
b83266a0 | 282 | if (op == 0x9E |
e17a4113 UW |
283 | && read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xEE |
284 | && read_memory_unsigned_integer (pc + 6, 1, byte_order) == 0x5E) | |
c5aa993b | 285 | pc += 7; /* skip movab */ |
0543f387 | 286 | |
b83266a0 SS |
287 | return pc; |
288 | } | |
7def7fef MK |
289 | \f |
290 | ||
291 | /* Unwinding the stack is relatively easy since the VAX has a | |
292 | dedicated frame pointer, and frames are set up automatically as the | |
293 | result of a function call. Most of the relevant information can be | |
294 | inferred from the documentation of the Procedure Call Instructions | |
295 | in the VAX MACRO and Instruction Set Reference Manual. */ | |
296 | ||
297 | struct vax_frame_cache | |
298 | { | |
299 | /* Base address. */ | |
300 | CORE_ADDR base; | |
301 | ||
302 | /* Table of saved registers. */ | |
303 | struct trad_frame_saved_reg *saved_regs; | |
304 | }; | |
305 | ||
63807e1d | 306 | static struct vax_frame_cache * |
94afd7a6 | 307 | vax_frame_cache (struct frame_info *this_frame, void **this_cache) |
7def7fef MK |
308 | { |
309 | struct vax_frame_cache *cache; | |
310 | CORE_ADDR addr; | |
311 | ULONGEST mask; | |
312 | int regnum; | |
313 | ||
314 | if (*this_cache) | |
19ba03f4 | 315 | return (struct vax_frame_cache *) *this_cache; |
7def7fef MK |
316 | |
317 | /* Allocate a new cache. */ | |
318 | cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache); | |
94afd7a6 | 319 | cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); |
7def7fef MK |
320 | |
321 | /* The frame pointer is used as the base for the frame. */ | |
94afd7a6 | 322 | cache->base = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); |
7def7fef MK |
323 | if (cache->base == 0) |
324 | return cache; | |
325 | ||
326 | /* The register save mask and control bits determine the layout of | |
327 | the stack frame. */ | |
94afd7a6 | 328 | mask = get_frame_memory_unsigned (this_frame, cache->base + 4, 4) >> 16; |
7def7fef MK |
329 | |
330 | /* These are always saved. */ | |
331 | cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16; | |
332 | cache->saved_regs[VAX_FP_REGNUM].addr = cache->base + 12; | |
333 | cache->saved_regs[VAX_AP_REGNUM].addr = cache->base + 8; | |
334 | cache->saved_regs[VAX_PS_REGNUM].addr = cache->base + 4; | |
335 | ||
336 | /* Scan the register save mask and record the location of the saved | |
337 | registers. */ | |
338 | addr = cache->base + 20; | |
339 | for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++) | |
340 | { | |
341 | if (mask & (1 << regnum)) | |
342 | { | |
343 | cache->saved_regs[regnum].addr = addr; | |
344 | addr += 4; | |
345 | } | |
346 | } | |
347 | ||
348 | /* The CALLS/CALLG flag determines whether this frame has a General | |
349 | Argument List or a Stack Argument List. */ | |
350 | if (mask & (1 << 13)) | |
351 | { | |
352 | ULONGEST numarg; | |
353 | ||
354 | /* This is a procedure with Stack Argument List. Adjust the | |
e36ad527 | 355 | stack address for the arguments that were pushed onto the |
7def7fef MK |
356 | stack. The return instruction will automatically pop the |
357 | arguments from the stack. */ | |
94afd7a6 | 358 | numarg = get_frame_memory_unsigned (this_frame, addr, 1); |
7def7fef MK |
359 | addr += 4 + numarg * 4; |
360 | } | |
361 | ||
362 | /* Bits 1:0 of the stack pointer were saved in the control bits. */ | |
363 | trad_frame_set_value (cache->saved_regs, VAX_SP_REGNUM, addr + (mask >> 14)); | |
364 | ||
365 | return cache; | |
366 | } | |
367 | ||
368 | static void | |
94afd7a6 | 369 | vax_frame_this_id (struct frame_info *this_frame, void **this_cache, |
7def7fef MK |
370 | struct frame_id *this_id) |
371 | { | |
94afd7a6 | 372 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef MK |
373 | |
374 | /* This marks the outermost frame. */ | |
375 | if (cache->base == 0) | |
376 | return; | |
377 | ||
94afd7a6 | 378 | (*this_id) = frame_id_build (cache->base, get_frame_func (this_frame)); |
7def7fef MK |
379 | } |
380 | ||
94afd7a6 UW |
381 | static struct value * |
382 | vax_frame_prev_register (struct frame_info *this_frame, | |
383 | void **this_cache, int regnum) | |
7def7fef | 384 | { |
94afd7a6 | 385 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef | 386 | |
94afd7a6 | 387 | return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); |
7def7fef MK |
388 | } |
389 | ||
390 | static const struct frame_unwind vax_frame_unwind = | |
391 | { | |
392 | NORMAL_FRAME, | |
8fbca658 | 393 | default_frame_unwind_stop_reason, |
7def7fef | 394 | vax_frame_this_id, |
94afd7a6 UW |
395 | vax_frame_prev_register, |
396 | NULL, | |
397 | default_frame_sniffer | |
7def7fef | 398 | }; |
7def7fef MK |
399 | \f |
400 | ||
401 | static CORE_ADDR | |
94afd7a6 | 402 | vax_frame_base_address (struct frame_info *this_frame, void **this_cache) |
7def7fef | 403 | { |
94afd7a6 | 404 | struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); |
7def7fef MK |
405 | |
406 | return cache->base; | |
407 | } | |
b83266a0 | 408 | |
f267bd6a | 409 | static CORE_ADDR |
94afd7a6 | 410 | vax_frame_args_address (struct frame_info *this_frame, void **this_cache) |
7def7fef | 411 | { |
94afd7a6 | 412 | return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM); |
7def7fef MK |
413 | } |
414 | ||
415 | static const struct frame_base vax_frame_base = | |
a33f7558 | 416 | { |
7def7fef MK |
417 | &vax_frame_unwind, |
418 | vax_frame_base_address, | |
419 | vax_frame_base_address, | |
420 | vax_frame_args_address | |
421 | }; | |
422 | ||
423 | /* Return number of arguments for FRAME. */ | |
424 | ||
425 | static int | |
426 | vax_frame_num_args (struct frame_info *frame) | |
427 | { | |
428 | CORE_ADDR args; | |
429 | ||
430 | /* Assume that the argument pointer for the outermost frame is | |
431 | hosed, as is the case on NetBSD/vax ELF. */ | |
a54f9a00 | 432 | if (get_frame_base_address (frame) == 0) |
7def7fef MK |
433 | return 0; |
434 | ||
435 | args = get_frame_register_unsigned (frame, VAX_AP_REGNUM); | |
436 | return get_frame_memory_unsigned (frame, args, 1); | |
437 | } | |
438 | ||
439 | static CORE_ADDR | |
440 | vax_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) | |
441 | { | |
442 | return frame_unwind_register_unsigned (next_frame, VAX_PC_REGNUM); | |
a33f7558 JT |
443 | } |
444 | \f | |
7def7fef | 445 | |
f267bd6a JT |
446 | /* Initialize the current architecture based on INFO. If possible, re-use an |
447 | architecture from ARCHES, which is a list of architectures already created | |
448 | during this debugging session. | |
449 | ||
450 | Called e.g. at program startup, when reading a core file, and when reading | |
451 | a binary file. */ | |
452 | ||
453 | static struct gdbarch * | |
454 | vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | |
455 | { | |
456 | struct gdbarch *gdbarch; | |
457 | ||
4be87837 DJ |
458 | /* If there is already a candidate, use it. */ |
459 | arches = gdbarch_list_lookup_by_info (arches, &info); | |
460 | if (arches != NULL) | |
461 | return arches->gdbarch; | |
f267bd6a | 462 | |
4be87837 | 463 | gdbarch = gdbarch_alloc (&info, NULL); |
4791e091 | 464 | |
8da61cc4 DJ |
465 | set_gdbarch_float_format (gdbarch, floatformats_vax_f); |
466 | set_gdbarch_double_format (gdbarch, floatformats_vax_d); | |
467 | set_gdbarch_long_double_format (gdbarch, floatformats_vax_d); | |
468 | set_gdbarch_long_double_bit (gdbarch, 64); | |
0a3e99f6 | 469 | |
f267bd6a JT |
470 | /* Register info */ |
471 | set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); | |
5e6b39ff MK |
472 | set_gdbarch_register_name (gdbarch, vax_register_name); |
473 | set_gdbarch_register_type (gdbarch, vax_register_type); | |
f267bd6a | 474 | set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM); |
f267bd6a JT |
475 | set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM); |
476 | set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM); | |
477 | ||
f73d3ce7 AA |
478 | set_gdbarch_iterate_over_regset_sections |
479 | (gdbarch, vax_iterate_over_regset_sections); | |
8b910bab | 480 | |
f267bd6a JT |
481 | /* Frame and stack info */ |
482 | set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue); | |
f267bd6a | 483 | set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args); |
f267bd6a JT |
484 | set_gdbarch_frame_args_skip (gdbarch, 4); |
485 | ||
5e6b39ff | 486 | /* Stack grows downward. */ |
f267bd6a JT |
487 | set_gdbarch_inner_than (gdbarch, core_addr_lessthan); |
488 | ||
489 | /* Return value info */ | |
67b441e1 | 490 | set_gdbarch_return_value (gdbarch, vax_return_value); |
f267bd6a | 491 | |
7346c184 MK |
492 | /* Call dummy code. */ |
493 | set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call); | |
94afd7a6 | 494 | set_gdbarch_dummy_id (gdbarch, vax_dummy_id); |
f267bd6a JT |
495 | |
496 | /* Breakpoint info */ | |
04180708 YQ |
497 | set_gdbarch_breakpoint_kind_from_pc (gdbarch, vax_breakpoint::kind_from_pc); |
498 | set_gdbarch_sw_breakpoint_from_kind (gdbarch, vax_breakpoint::bp_from_kind); | |
f267bd6a JT |
499 | |
500 | /* Misc info */ | |
782263ab | 501 | set_gdbarch_deprecated_function_start_offset (gdbarch, 2); |
1d049c5e | 502 | set_gdbarch_believe_pcc_promotion (gdbarch, 1); |
f267bd6a | 503 | |
7def7fef MK |
504 | set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc); |
505 | ||
506 | frame_base_set_default (gdbarch, &vax_frame_base); | |
507 | ||
4791e091 | 508 | /* Hook in ABI-specific overrides, if they have been registered. */ |
4be87837 | 509 | gdbarch_init_osabi (info, gdbarch); |
4791e091 | 510 | |
94afd7a6 | 511 | frame_unwind_append_unwinder (gdbarch, &vax_frame_unwind); |
7def7fef | 512 | |
f267bd6a JT |
513 | return (gdbarch); |
514 | } | |
c906108c SS |
515 | |
516 | void | |
fba45db2 | 517 | _initialize_vax_tdep (void) |
c906108c | 518 | { |
4be87837 | 519 | gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL); |
c906108c | 520 | } |