]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/tm-sun2.h
Change GDB over to GNU General Public License version 2.
[thirdparty/binutils-gdb.git] / gdb / tm-sun2.h
1 /* Parameters for execution on a Sun, for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #include "m-68k.h"
21
22 /* Define this if the C compiler puts an underscore at the front
23 of external names before giving them to the linker. */
24
25 #define NAMES_HAVE_UNDERSCORE
26
27 /* Debugger information will be in DBX format. */
28
29 #define READ_DBX_FORMAT
30
31 /* Address of the end of stack space. We get this from the system
32 include files. */
33 #include <sys/types.h>
34 #include <machine/vmparam.h>
35 #define STACK_END_ADDR USRSTACK
36 \f
37 /* Things needed for making the inferior call functions. */
38
39 /* Push an empty stack frame, to record the current PC, etc. */
40
41 #define PUSH_DUMMY_FRAME \
42 { register CORE_ADDR sp = read_register (SP_REGNUM);\
43 register int regnum; \
44 sp = push_word (sp, read_register (PC_REGNUM)); \
45 sp = push_word (sp, read_register (FP_REGNUM)); \
46 write_register (FP_REGNUM, sp); \
47 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
48 sp = push_word (sp, read_register (regnum)); \
49 sp = push_word (sp, read_register (PS_REGNUM)); \
50 write_register (SP_REGNUM, sp); }
51
52 /* Discard from the stack the innermost frame, restoring all registers. */
53
54 #define POP_FRAME \
55 { register FRAME frame = get_current_frame (); \
56 register CORE_ADDR fp; \
57 register int regnum; \
58 struct frame_saved_regs fsr; \
59 struct frame_info *fi; \
60 fi = get_frame_info (frame); \
61 fp = fi->frame; \
62 get_frame_saved_regs (fi, &fsr); \
63 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
64 if (fsr.regs[regnum]) \
65 write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
66 if (fsr.regs[PS_REGNUM]) \
67 write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
68 write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
69 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
70 write_register (SP_REGNUM, fp + 8); \
71 flush_cached_frames (); \
72 set_current_frame ( create_new_frame (read_register (FP_REGNUM),\
73 read_pc ())); }
74
75 /* This sequence of words is the instructions
76 moveml 0xfffc,-(sp)
77 clrw -(sp)
78 movew ccr,-(sp)
79 /..* The arguments are pushed at this point by GDB;
80 no code is needed in the dummy for this.
81 The CALL_DUMMY_START_OFFSET gives the position of
82 the following jsr instruction. *../
83 jsr @#32323232
84 addl #69696969,sp
85 bpt
86 nop
87 Note this is 24 bytes.
88 We actually start executing at the jsr, since the pushing of the
89 registers is done by PUSH_DUMMY_FRAME. If this were real code,
90 the arguments for the function called by the jsr would be pushed
91 between the moveml and the jsr, and we could allow it to execute through.
92 But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
93 and we cannot allow the moveml to push the registers again lest they be
94 taken for the arguments. */
95
96 #define CALL_DUMMY {0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4f4e71}
97
98 #define CALL_DUMMY_LENGTH 24
99
100 #define CALL_DUMMY_START_OFFSET 8
101
102 /* Insert the specified number of args and function address
103 into a call sequence of the above form stored at DUMMYNAME. */
104
105 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
106 { *(int *)((char *) dummyname + 16) = nargs * 4; \
107 *(int *)((char *) dummyname + 10) = fun; }