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