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