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