*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / ns32k-tdep.c
CommitLineData
93d5585d 1/* Target dependent code for the NS32000, for GDB.
af137673
JT
2 Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001,
3 2002 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
9 the Free Software Foundation; either version 2 of the License, or
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
JM
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. */
c906108c
SS
21
22#include "defs.h"
f6427ade 23#include "frame.h"
93d5585d 24#include "gdbtypes.h"
381bab78 25#include "gdbcore.h"
93d5585d
JT
26#include "inferior.h"
27#include "regcache.h"
28#include "target.h"
29
30#include "arch-utils.h"
31
32#include "ns32k-tdep.h"
381bab78
AC
33
34static int sign_extend (int value, int bits);
78f9d765
JT
35static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR);
36static int ns32k_localcount (CORE_ADDR enter_pc);
7bcc927b 37static void flip_bytes (void *, int);
c906108c 38
93d5585d 39static char *
af137673 40ns32k_register_name_32082 (int regno)
c906108c 41{
af137673
JT
42 static char *register_names[] =
43 {
44 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
45 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
46 "sp", "fp", "pc", "ps",
47 "l0", "l1", "l2", "l3", "xx",
48 };
49
50 if (regno < 0)
51 return NULL;
52 if (regno >= sizeof (register_names) / sizeof (*register_names))
53 return NULL;
54
55 return (register_names[regno]);
56}
57
93d5585d 58static char *
af137673
JT
59ns32k_register_name_32382 (int regno)
60{
61 static char *register_names[] =
62 {
63 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
64 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
65 "sp", "fp", "pc", "ps",
66 "fsr",
67 "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx",
68 };
69
70 if (regno < 0)
71 return NULL;
72 if (regno >= sizeof (register_names) / sizeof (*register_names))
73 return NULL;
74
75 return (register_names[regno]);
c906108c 76}
b83266a0 77
93d5585d 78static int
f2c762e0
JT
79ns32k_register_byte_32082 (int regno)
80{
93d5585d
JT
81 if (regno >= NS32K_LP0_REGNUM)
82 return (NS32K_LP0_REGNUM * 4) + ((regno - NS32K_LP0_REGNUM) * 8);
f2c762e0
JT
83
84 return (regno * 4);
85}
86
93d5585d 87static int
f2c762e0
JT
88ns32k_register_byte_32382 (int regno)
89{
90 /* This is a bit yuk. The even numbered double precision floating
91 point long registers occupy the same space as the even:odd numbered
92 single precision floating point registers, but the extra 32381 FPU
93 registers are at the end. Doing it this way is compatible for both
94 32081 and 32381 equipped machines. */
95
93d5585d
JT
96 return ((regno < NS32K_LP0_REGNUM ? regno
97 : (regno - NS32K_LP0_REGNUM) & 1 ? regno - 1
98 : (regno - NS32K_LP0_REGNUM + FP0_REGNUM)) * 4);
f2c762e0
JT
99}
100
93d5585d 101static int
f2c762e0
JT
102ns32k_register_raw_size (int regno)
103{
104 /* All registers are 4 bytes, except for the doubled floating
105 registers. */
106
93d5585d 107 return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
f2c762e0
JT
108}
109
93d5585d 110static int
f2c762e0
JT
111ns32k_register_virtual_size (int regno)
112{
93d5585d 113 return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
f2c762e0
JT
114}
115
93d5585d 116static struct type *
f2c762e0
JT
117ns32k_register_virtual_type (int regno)
118{
119 if (regno < FP0_REGNUM)
120 return (builtin_type_int);
121
122 if (regno < FP0_REGNUM + 8)
123 return (builtin_type_float);
124
93d5585d 125 if (regno < NS32K_LP0_REGNUM)
f2c762e0
JT
126 return (builtin_type_int);
127
128 return (builtin_type_double);
129}
130
efb2c70e
JT
131/* Immediately after a function call, return the saved PC. Can't
132 always go through the frames for this because on some systems,
133 the new frame is not set up until the new function executes some
134 instructions. */
135
93d5585d 136static CORE_ADDR
efb2c70e
JT
137ns32k_saved_pc_after_call (struct frame_info *frame)
138{
139 return (read_memory_integer (read_register (SP_REGNUM), 4));
140}
141
b83266a0
SS
142/* Advance PC across any function entry prologue instructions
143 to reach some "real" code. */
144
93d5585d 145static CORE_ADDR
fba45db2 146umax_skip_prologue (CORE_ADDR pc)
b83266a0
SS
147{
148 register unsigned char op = read_memory_integer (pc, 1);
149 if (op == 0x82)
150 {
c5aa993b 151 op = read_memory_integer (pc + 2, 1);
b83266a0
SS
152 if ((op & 0x80) == 0)
153 pc += 3;
154 else if ((op & 0xc0) == 0x80)
155 pc += 4;
156 else
157 pc += 6;
c5aa993b 158 }
b83266a0
SS
159 return pc;
160}
78f9d765 161\f
93d5585d 162static const unsigned char *
78f9d765
JT
163ns32k_breakpoint_from_pc (CORE_ADDR *pcp, int *lenp)
164{
165 static const unsigned char breakpoint_insn[] = { 0xf2 };
166
167 *lenp = sizeof (breakpoint_insn);
168 return breakpoint_insn;
169}
b83266a0 170
cce74817
JM
171/* Return number of args passed to a frame.
172 Can return -1, meaning no way to tell.
173 Encore's C compiler often reuses same area on stack for args,
174 so this will often not work properly. If the arg names
175 are known, it's likely most of them will be printed. */
bb19ff3b 176
93d5585d 177static int
fba45db2 178umax_frame_num_args (struct frame_info *fi)
392a587b
JM
179{
180 int numargs;
181 CORE_ADDR pc;
182 CORE_ADDR enter_addr;
183 unsigned int insn;
184 unsigned int addr_mode;
185 int width;
186
187 numargs = -1;
188 enter_addr = ns32k_get_enter_addr ((fi)->pc);
189 if (enter_addr > 0)
190 {
191 pc = ((enter_addr == 1)
192 ? SAVED_PC_AFTER_CALL (fi)
193 : FRAME_SAVED_PC (fi));
c5aa993b 194 insn = read_memory_integer (pc, 2);
392a587b
JM
195 addr_mode = (insn >> 11) & 0x1f;
196 insn = insn & 0x7ff;
197 if ((insn & 0x7fc) == 0x57c
c5aa993b 198 && addr_mode == 0x14) /* immediate */
392a587b 199 {
c5aa993b 200 if (insn == 0x57c) /* adjspb */
392a587b 201 width = 1;
c5aa993b 202 else if (insn == 0x57d) /* adjspw */
392a587b 203 width = 2;
c5aa993b 204 else if (insn == 0x57f) /* adjspd */
392a587b 205 width = 4;
381bab78
AC
206 else
207 internal_error (__FILE__, __LINE__, "bad else");
c5aa993b 208 numargs = read_memory_integer (pc + 2, width);
392a587b
JM
209 if (width > 1)
210 flip_bytes (&numargs, width);
c5aa993b 211 numargs = -sign_extend (numargs, width * 8) / 4;
392a587b
JM
212 }
213 }
214 return numargs;
215}
b83266a0 216
381bab78 217static int
fba45db2 218sign_extend (int value, int bits)
c906108c
SS
219{
220 value = value & ((1 << bits) - 1);
c5aa993b 221 return (value & (1 << (bits - 1))
c906108c
SS
222 ? value | (~((1 << bits) - 1))
223 : value);
224}
225
7bcc927b 226static void
381bab78 227flip_bytes (void *p, int count)
c906108c
SS
228{
229 char tmp;
381bab78 230 char *ptr = 0;
c906108c
SS
231
232 while (count > 0)
233 {
234 tmp = *ptr;
c5aa993b
JM
235 ptr[0] = ptr[count - 1];
236 ptr[count - 1] = tmp;
c906108c
SS
237 ptr++;
238 count -= 2;
239 }
240}
241
78f9d765
JT
242/* Return the number of locals in the current frame given a
243 pc pointing to the enter instruction. This is used by
244 ns32k_frame_init_saved_regs. */
c906108c 245
78f9d765 246static int
fba45db2 247ns32k_localcount (CORE_ADDR enter_pc)
c906108c
SS
248{
249 unsigned char localtype;
250 int localcount;
251
c5aa993b 252 localtype = read_memory_integer (enter_pc + 2, 1);
c906108c
SS
253 if ((localtype & 0x80) == 0)
254 localcount = localtype;
255 else if ((localtype & 0xc0) == 0x80)
256 localcount = (((localtype & 0x3f) << 8)
c5aa993b 257 | (read_memory_integer (enter_pc + 3, 1) & 0xff));
c906108c
SS
258 else
259 localcount = (((localtype & 0x3f) << 24)
c5aa993b
JM
260 | ((read_memory_integer (enter_pc + 3, 1) & 0xff) << 16)
261 | ((read_memory_integer (enter_pc + 4, 1) & 0xff) << 8)
262 | (read_memory_integer (enter_pc + 5, 1) & 0xff));
c906108c
SS
263 return localcount;
264}
265
266
267/* Nonzero if instruction at PC is a return instruction. */
268
269static int
fba45db2 270ns32k_about_to_return (CORE_ADDR pc)
c906108c
SS
271{
272 return (read_memory_integer (pc, 1) == 0x12);
273}
274
78f9d765
JT
275/* Get the address of the enter opcode for this function, if it is active.
276 Returns positive address > 1 if pc is between enter/exit,
277 1 if pc before enter or after exit, 0 otherwise. */
278static CORE_ADDR
fba45db2 279ns32k_get_enter_addr (CORE_ADDR pc)
c906108c
SS
280{
281 CORE_ADDR enter_addr;
282 unsigned char op;
283
284 if (pc == 0)
285 return 0;
286
287 if (ns32k_about_to_return (pc))
c5aa993b 288 return 1; /* after exit */
c906108c
SS
289
290 enter_addr = get_pc_function_start (pc);
291
c5aa993b
JM
292 if (pc == enter_addr)
293 return 1; /* before enter */
c906108c
SS
294
295 op = read_memory_integer (enter_addr, 1);
296
297 if (op != 0x82)
c5aa993b 298 return 0; /* function has no enter/exit */
c906108c 299
c5aa993b 300 return enter_addr; /* pc is between enter and exit */
c906108c 301}
af137673 302
93d5585d 303static CORE_ADDR
78f9d765
JT
304ns32k_frame_chain (struct frame_info *frame)
305{
306 /* In the case of the NS32000 series, the frame's nominal address is the
307 FP value, and that address is saved at the previous FP value as a
308 4-byte word. */
309
310 if (inside_entry_file (frame->pc))
311 return 0;
312
313 return (read_memory_integer (frame->frame, 4));
314}
315
93d5585d 316static CORE_ADDR
78f9d765
JT
317ns32k_frame_saved_pc (struct frame_info *frame)
318{
319 if (frame->signal_handler_caller)
320 return (sigtramp_saved_pc (frame)); /* XXXJRT */
321
322 return (read_memory_integer (frame->frame + 4, 4));
323}
324
93d5585d 325static CORE_ADDR
78f9d765
JT
326ns32k_frame_args_address (struct frame_info *frame)
327{
328 if (ns32k_get_enter_addr (frame->pc) > 1)
329 return (frame->frame);
330
331 return (read_register (SP_REGNUM) - 4);
332}
333
93d5585d 334static CORE_ADDR
78f9d765
JT
335ns32k_frame_locals_address (struct frame_info *frame)
336{
337 return (frame->frame);
338}
339
93d5585d
JT
340static void
341ns32k_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
342 struct frame_info *frame, int regnum,
343 enum lval_type *lval)
344{
345 CORE_ADDR addr;
346
347 if (!target_has_registers)
348 error ("No registers.");
349
350 /* Normal systems don't optimize out things with register numbers. */
351 if (optimized != NULL)
352 *optimized = 0;
353 addr = find_saved_register (frame, regnum);
354 if (addr != 0)
355 {
356 if (lval != NULL)
357 *lval = lval_memory;
358 if (regnum == SP_REGNUM)
359 {
360 if (raw_buffer != NULL)
361 {
362 /* Put it back in target format. */
363 store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
364 (LONGEST) addr);
365 }
366 if (addrp != NULL)
367 *addrp = 0;
368 return;
369 }
370 if (raw_buffer != NULL)
371 target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
372 }
373 else
374 {
375 if (lval != NULL)
376 *lval = lval_register;
377 addr = REGISTER_BYTE (regnum);
378 if (raw_buffer != NULL)
379 read_register_gen (regnum, raw_buffer);
380 }
381 if (addrp != NULL)
382 *addrp = addr;
383}
384
78f9d765
JT
385/* Code to initialize the addresses of the saved registers of frame described
386 by FRAME_INFO. This includes special registers such as pc and fp saved in
387 special ways in the stack frame. sp is even more special: the address we
388 return for it IS the sp for the next frame. */
389
93d5585d 390static void
78f9d765
JT
391ns32k_frame_init_saved_regs (struct frame_info *frame)
392{
393 int regmask, regnum;
394 int localcount;
395 CORE_ADDR enter_addr, next_addr;
396
397 if (frame->saved_regs)
398 return;
399
400 frame_saved_regs_zalloc (frame);
401
402 enter_addr = ns32k_get_enter_addr (frame->pc);
403 if (enter_addr > 1)
404 {
405 regmask = read_memory_integer (enter_addr + 1, 1) & 0xff;
406 localcount = ns32k_localcount (enter_addr);
407 next_addr = frame->frame + localcount;
408
409 for (regnum = 0; regnum < 8; regnum++)
410 {
411 if (regmask & (1 << regnum))
412 frame->saved_regs[regnum] = next_addr -= 4;
413 }
414
415 frame->saved_regs[SP_REGNUM] = frame->frame + 4;
416 frame->saved_regs[PC_REGNUM] = frame->frame + 4;
417 frame->saved_regs[FP_REGNUM] = read_memory_integer (frame->frame, 4);
418 }
419 else if (enter_addr == 1)
420 {
421 CORE_ADDR sp = read_register (SP_REGNUM);
422 frame->saved_regs[PC_REGNUM] = sp;
423 frame->saved_regs[SP_REGNUM] = sp + 4;
424 }
425}
426
93d5585d 427static void
78f9d765
JT
428ns32k_push_dummy_frame (void)
429{
430 CORE_ADDR sp = read_register (SP_REGNUM);
431 int regnum;
432
433 sp = push_word (sp, read_register (PC_REGNUM));
434 sp = push_word (sp, read_register (FP_REGNUM));
435 write_register (FP_REGNUM, sp);
436
437 for (regnum = 0; regnum < 8; regnum++)
438 sp = push_word (sp, read_register (regnum));
439
440 write_register (SP_REGNUM, sp);
441}
442
93d5585d 443static void
78f9d765
JT
444ns32k_pop_frame (void)
445{
446 struct frame_info *frame = get_current_frame ();
447 CORE_ADDR fp;
448 int regnum;
449
450 fp = frame->frame;
451 FRAME_INIT_SAVED_REGS (frame);
452
453 for (regnum = 0; regnum < 8; regnum++)
454 if (frame->saved_regs[regnum])
455 write_register (regnum,
456 read_memory_integer (frame->saved_regs[regnum], 4));
457
458 write_register (FP_REGNUM, read_memory_integer (fp, 4));
459 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
460 write_register (SP_REGNUM, fp + 8);
461 flush_cached_frames ();
462}
7bcc927b
JT
463\f
464/* The NS32000 call dummy sequence:
465
466 enter 0xff,0 82 ff 00
467 jsr @0x00010203 7f ae c0 01 02 03
468 adjspd 0x69696969 7f a5 01 02 03 04
469 bpt f2
470
471 It is 16 bytes long. */
472
93d5585d 473static LONGEST ns32k_call_dummy_words[] =
7bcc927b
JT
474{
475 0x7f00ff82,
476 0x0201c0ae,
477 0x01a57f03,
478 0xf2040302
479};
93d5585d 480static int sizeof_ns32k_call_dummy_words = sizeof (ns32k_call_dummy_words);
7bcc927b
JT
481
482#define NS32K_CALL_DUMMY_ADDR 5
483#define NS32K_CALL_DUMMY_NARGS 11
78f9d765 484
93d5585d 485static void
7bcc927b
JT
486ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
487 struct value **args, struct type *type, int gcc_p)
488{
489 int flipped;
490
491 flipped = fun | 0xc0000000;
492 flip_bytes (&flipped, 4);
493 store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped);
494
495 flipped = - nargs * 4;
496 flip_bytes (&flipped, 4);
497 store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped);
498}
499\f
93d5585d 500static void
efb2c70e
JT
501ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
502{
503 /* On this machine, this is a no-op (Encore Umax didn't use GCC). */
504}
505
93d5585d 506static void
efb2c70e
JT
507ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
508{
509 memcpy (valbuf,
510 regbuf + REGISTER_BYTE (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
511 FP0_REGNUM : 0), TYPE_LENGTH (valtype));
512}
513
93d5585d 514static void
efb2c70e
JT
515ns32k_store_return_value (struct type *valtype, char *valbuf)
516{
517 write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
518 FP0_REGNUM : 0, valbuf, TYPE_LENGTH (valtype));
519}
520
93d5585d 521static CORE_ADDR
efb2c70e
JT
522ns32k_extract_struct_value_address (char *regbuf)
523{
524 return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
525}
526\f
93d5585d
JT
527void
528ns32k_gdbarch_init_32082 (struct gdbarch *gdbarch)
529{
530 set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32082);
531
532 set_gdbarch_register_name (gdbarch, ns32k_register_name_32082);
533 set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32082);
534 set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32082);
535}
536
537void
538ns32k_gdbarch_init_32382 (struct gdbarch *gdbarch)
539{
540 set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32382);
541
542 set_gdbarch_register_name (gdbarch, ns32k_register_name_32382);
543 set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32382);
544 set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32382);
545}
546
547/* Initialize the current architecture based on INFO. If possible, re-use an
548 architecture from ARCHES, which is a list of architectures already created
549 during this debugging session.
550
551 Called e.g. at program startup, when reading a core file, and when reading
552 a binary file. */
553
554static struct gdbarch *
555ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
556{
557 struct gdbarch_tdep *tdep;
558 struct gdbarch *gdbarch;
559 enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
560
561 /* Try to determine the OS ABI of the object we are loading. */
562 if (info.abfd != NULL)
563 {
564 osabi = gdbarch_lookup_osabi (info.abfd);
565 }
566
567 /* Find a candidate among extant architectures. */
568 for (arches = gdbarch_list_lookup_by_info (arches, &info);
569 arches != NULL;
570 arches = gdbarch_list_lookup_by_info (arches->next, &info))
571 {
572 /* Make sure the OS ABI selection matches. */
573 tdep = gdbarch_tdep (arches->gdbarch);
574 if (tdep && tdep->osabi == osabi)
575 return arches->gdbarch;
576 }
577
578 tdep = xmalloc (sizeof (struct gdbarch_tdep));
579 gdbarch = gdbarch_alloc (&info, tdep);
580
581 tdep->osabi = osabi;
582
583 /* Register info */
584 ns32k_gdbarch_init_32082 (gdbarch);
585 set_gdbarch_num_regs (gdbarch, NS32K_SP_REGNUM);
586 set_gdbarch_num_regs (gdbarch, NS32K_FP_REGNUM);
587 set_gdbarch_num_regs (gdbarch, NS32K_PC_REGNUM);
588 set_gdbarch_num_regs (gdbarch, NS32K_PS_REGNUM);
589
590 set_gdbarch_register_size (gdbarch, NS32K_REGISTER_SIZE);
591 set_gdbarch_register_raw_size (gdbarch, ns32k_register_raw_size);
592 set_gdbarch_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE);
593 set_gdbarch_register_virtual_size (gdbarch, ns32k_register_virtual_size);
594 set_gdbarch_max_register_virtual_size (gdbarch,
595 NS32K_MAX_REGISTER_VIRTUAL_SIZE);
596 set_gdbarch_register_virtual_type (gdbarch, ns32k_register_virtual_type);
597
598 /* Frame and stack info */
599 set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue);
600 set_gdbarch_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call);
601
602 set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args);
603 set_gdbarch_frameless_function_invocation (gdbarch,
604 generic_frameless_function_invocation_not);
605
606 set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain);
607 set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
608 set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc);
609
610 set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address);
611 set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address);
612
613 set_gdbarch_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs);
614
615 set_gdbarch_frame_args_skip (gdbarch, 8);
616
617 set_gdbarch_get_saved_register (gdbarch, ns32k_get_saved_register);
618
619 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
620
621 /* Return value info */
622 set_gdbarch_store_struct_return (gdbarch, ns32k_store_struct_return);
26e9b323 623 set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value);
93d5585d 624 set_gdbarch_store_return_value (gdbarch, ns32k_store_return_value);
26e9b323 625 set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
93d5585d
JT
626 ns32k_extract_struct_value_address);
627
628 /* Call dummy info */
629 set_gdbarch_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
630 set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame);
631 set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
632 set_gdbarch_call_dummy_p (gdbarch, 1);
633 set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words);
634 set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words);
635 set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy);
636 set_gdbarch_call_dummy_start_offset (gdbarch, 3);
637 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
638 set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
639 set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
640 set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
641
642 /* Breakpoint info */
643 set_gdbarch_decr_pc_after_break (gdbarch, 0);
644 set_gdbarch_breakpoint_from_pc (gdbarch, ns32k_breakpoint_from_pc);
645
646 /* Misc info */
647 set_gdbarch_function_start_offset (gdbarch, 0);
648
649 /* Hook in OS ABI-specific overrides, if they have been registered. */
650 gdbarch_init_osabi (info, gdbarch, osabi);
651
652 return (gdbarch);
653}
654
655static void
656ns32k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
657{
658 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
659
660 if (tdep == NULL)
661 return;
662
663 fprintf_unfiltered (file, "ns32k_dump_tdep: OS ABI = %s\n",
664 gdbarch_osabi_name (tdep->osabi));
665}
666
efb2c70e 667void
af137673
JT
668_initialize_ns32k_tdep (void)
669{
93d5585d
JT
670 gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, ns32k_dump_tdep);
671
af137673
JT
672 tm_print_insn = print_insn_ns32k;
673}
This page took 0.225179 seconds and 4 git commands to generate.