1 /* Definitions to make GDB run on an Altos 3068 (m68k running SVR2)
2 Copyright (C) 1987,1989 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
20 #define HOST_BYTE_ORDER BIG_ENDIAN
22 /* The altos support would make a good base for a port to other USGR2 systems
23 (like the 3b1 and the Convergent miniframe). */
25 /* This is only needed in one file, but it's cleaner to put it here than
26 putting in more #ifdef's. */
34 #define CBREAK XTABS /* It takes all kinds... */
44 #define MAXPATHLEN (1024)
47 /* Get sys/wait.h ie. from a Sun and edit it a little (mc68000 to m68k) */
50 #define HAVE_WAIT_STRUCT
55 /* This is the amount to subtract from u.u_ar0
56 to get the offset in the core file of the register values. */
58 #define KERNEL_U_ADDR 0x1fbf000
60 #define REGISTER_U_ADDR(addr, blockend, regno) \
61 { if (regno <= SP_REGNUM) \
62 addr = blockend + regno * 4; \
63 else if (regno == PS_REGNUM) \
64 addr = blockend + regno * 4 + 4; \
65 else if (regno == PC_REGNUM) \
66 addr = blockend + regno * 4 + 2; \
69 #define REGISTER_ADDR(u_ar0, regno) \
70 (((regno) < PS_REGNUM) \
71 ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
72 : (((regno) == PS_REGNUM) \
73 ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
74 : (&((struct exception_stack *) (u_ar0))->e_PC)))
76 #define FP_REGISTER_ADDR(u, regno) \
78 (((regno) < FPC_REGNUM) \
79 ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
80 : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
91 /* Motorola assembly format */
92 #if !defined(USE_GAS) && !defined(ALTOS)
96 /* Interface definitions for kernel debugger KDB. */
98 /* Map machine fault codes into signal numbers.
99 First subtract 0, divide by 4, then index in a table.
100 Faults for which the entry in this table is 0
101 are not handled by KDB; the program's own trap handler
102 gets to handle then. */
104 #define FAULT_CODE_ORIGIN 0
105 #define FAULT_CODE_UNITS 4
106 #define FAULT_TABLE \
107 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
108 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
109 0, 0, 0, 0, 0, 0, 0, 0, \
112 /* Start running with a stack stretching from BEG to END.
113 BEG and END should be symbols meaningful to the assembler.
114 This is used only for kdb. */
117 #define INIT_STACK(beg, end) \
118 { asm (".globl end"); \
119 asm ("move.l $ end, sp"); \
123 #define INIT_STACK(beg, end) \
124 { asm ("global end"); \
125 asm ("mov.l &end,%sp"); \
128 #define INIT_STACK(beg, end) \
129 { asm (".globl end"); \
130 asm ("movel $ end, sp"); \
135 /* Push the frame pointer register on the stack. */
137 #define PUSH_FRAME_PTR \
138 asm ("move.l fp, -(sp)");
141 #define PUSH_FRAME_PTR \
142 asm ("mov.l %fp, -(%sp)");
144 #define PUSH_FRAME_PTR \
145 asm ("movel fp, -(sp)");
149 /* Copy the top-of-stack to the frame pointer register. */
151 #define POP_FRAME_PTR \
152 asm ("move.l (sp), fp");
155 #define POP_FRAME_PTR \
156 asm ("mov.l (%sp), %fp");
158 #define POP_FRAME_PTR \
159 asm ("movl (sp), fp");
163 /* After KDB is entered by a fault, push all registers
164 that GDB thinks about (all NUM_REGS of them),
165 so that they appear in order of ascending GDB register number.
166 The fault code will be on the stack beyond the last register. */
169 #define PUSH_REGISTERS \
170 { asm ("clr.w -(sp)"); \
171 asm ("pea (10,sp)"); \
172 asm ("movem $ 0xfffe,-(sp)"); }
175 #define PUSH_REGISTERS \
176 { asm ("clr.w -(%sp)"); \
177 asm ("pea (10,%sp)"); \
178 asm ("movm.l &0xfffe,-(%sp)"); }
180 #define PUSH_REGISTERS \
181 { asm ("clrw -(sp)"); \
182 asm ("pea 10(sp)"); \
183 asm ("movem $ 0xfffe,-(sp)"); }
187 /* Assuming the registers (including processor status) have been
188 pushed on the stack in order of ascending GDB register number,
189 restore them and return to the address in the saved PC register. */
192 #define POP_REGISTERS \
193 { asm ("subi.l $8,28(sp)"); \
194 asm ("movem (sp),$ 0xffff"); \
198 #define POP_REGISTERS \
199 { asm ("sub.l &8,28(%sp)"); \
200 asm ("movem (%sp),&0xffff"); \
203 #define POP_REGISTERS \
204 { asm ("subil $8,28(sp)"); \
205 asm ("movem (sp),$ 0xffff"); \