]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/m68k/xm-news.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / config / m68k / xm-news.h
1 /* Parameters for execution on a Sony/NEWS, for GDB, the GNU debugger.
2 Copyright 1987, 1989, 1992 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #define HOST_BYTE_ORDER BIG_ENDIAN
21
22 #include <sys/param.h> /* For INT_MIN */
23
24 #define HAVE_WAIT_STRUCT
25
26 /* We can't use "isatty" or "fileno" on this machine. This isn't good,
27 but it will have to do. */
28 #define ISATTY(FP) ((FP) == stdin || (FP) == stdout)
29
30 /* THis is the amount to subtract from u.u_ar0
31 to get the offset in the core file of the register values. */
32
33 #define KERNEL_U_ADDR UADDR
34
35 /* The offsets in this macro are from /usr/include/machine/reg.h */
36
37 #define REGISTER_U_ADDR(addr, blockend, regno) \
38 { static char offsets[] = { \
39 /*d0-d7:*/1,2,3,4,5,6,7,8, \
40 /*a0-a6:*/9,10,11,12,13,14,15, /*sp:*/-4, /*ps:*/0, /*pc:*/-1, \
41 /*fp0-fp7:*/19,22,25,28,31,34,37,40, /*fpc:*/16,17,18 }; \
42 addr = blockend + 4 * offsets[regno]; \
43 }
44
45 /* NewsOS 3.3 does not define errno in <errno.h>. */
46 extern int errno;
47 \f
48 /* Interface definitions for kernel debugger KDB. */
49
50 /* Use GNU assembler instead of standard assembler */
51 #define USE_GAS
52
53 /* Motorola assembly format */
54 #ifndef USE_GAS
55 #define MOTOROLA
56 #endif
57
58 /* Map machine fault codes into signal numbers.
59 First subtract 0, divide by 4, then index in a table.
60 Faults for which the entry in this table is 0
61 are not handled by KDB; the program's own trap handler
62 gets to handle then. */
63
64 #define FAULT_CODE_ORIGIN 0
65 #define FAULT_CODE_UNITS 4
66 #define FAULT_TABLE \
67 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
68 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
69 0, 0, 0, 0, 0, 0, 0, 0, \
70 SIGILL }
71
72 /* Start running with a stack stretching from BEG to END.
73 BEG and END should be symbols meaningful to the assembler.
74 This is used only for kdb. */
75
76 #ifdef MOTOROLA
77 #define INIT_STACK(beg, end) \
78 { asm (".globl end"); \
79 asm ("move.l $ end, sp"); \
80 asm ("clr.l fp"); }
81 #else
82 #define INIT_STACK(beg, end) \
83 { asm (".globl end"); \
84 asm ("movel $ end, sp"); \
85 asm ("clrl fp"); }
86 #endif
87
88 /* Push the frame pointer register on the stack. */
89 #ifdef MOTOROLA
90 #define PUSH_FRAME_PTR \
91 asm ("move.l fp, -(sp)");
92 #else
93 #define PUSH_FRAME_PTR \
94 asm ("movel fp, -(sp)");
95 #endif
96
97 /* Copy the top-of-stack to the frame pointer register. */
98 #ifdef MOTOROLA
99 #define POP_FRAME_PTR \
100 asm ("move.l (sp), fp");
101 #else
102 #define POP_FRAME_PTR \
103 asm ("movl (sp), fp");
104 #endif
105
106 /* After KDB is entered by a fault, push all registers
107 that GDB thinks about (all NUM_REGS of them),
108 so that they appear in order of ascending GDB register number.
109 The fault code will be on the stack beyond the last register. */
110
111 #ifdef MOTOROLA
112 #define PUSH_REGISTERS \
113 { asm ("clr.w -(sp)"); \
114 asm ("pea (10,sp)"); \
115 asm ("movem $ 0xfffe,-(sp)"); }
116 #else
117 #define PUSH_REGISTERS \
118 { asm ("clrw -(sp)"); \
119 asm ("pea 10(sp)"); \
120 asm ("movem $ 0xfffe,-(sp)"); }
121 #endif
122
123 /* Assuming the registers (including processor status) have been
124 pushed on the stack in order of ascending GDB register number,
125 restore them and return to the address in the saved PC register. */
126
127 #ifdef MOTOROLA
128 #define POP_REGISTERS \
129 { asm ("subi.l $8,28(sp)"); \
130 asm ("movem (sp),$ 0xffff"); \
131 asm ("rte"); }
132 #else
133 #define POP_REGISTERS \
134 { asm ("subil $8,28(sp)"); \
135 asm ("movem (sp),$ 0xffff"); \
136 asm ("rte"); }
137 #endif