]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Parameters for execution on a Sony/NEWS, for GDB, the GNU debugger. |
b6ba6518 KB |
2 | Copyright 1987, 1989, 1992, 1993, 1994, 1996 |
3 | Free Software Foundation, Inc. | |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
c906108c | 11 | |
c5aa993b JM |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
c906108c | 16 | |
c5aa993b JM |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
21 | |
22 | #define HOST_BYTE_ORDER BIG_ENDIAN | |
23 | ||
c5aa993b | 24 | #include <sys/param.h> /* For INT_MIN */ |
c906108c SS |
25 | |
26 | #define HAVE_WAIT_STRUCT | |
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.3 does not define errno in <errno.h>. */ | |
48 | extern int errno; | |
49 | \f | |
50 | /* Interface definitions for kernel debugger KDB. */ | |
51 | ||
52 | /* Use GNU assembler instead of standard assembler */ | |
53 | #define USE_GAS | |
54 | ||
55 | /* Motorola assembly format */ | |
56 | #ifndef USE_GAS | |
57 | #define MOTOROLA | |
58 | #endif | |
59 | ||
60 | /* Map machine fault codes into signal numbers. | |
61 | First subtract 0, divide by 4, then index in a table. | |
62 | Faults for which the entry in this table is 0 | |
63 | are not handled by KDB; the program's own trap handler | |
64 | gets to handle then. */ | |
65 | ||
66 | #define FAULT_CODE_ORIGIN 0 | |
67 | #define FAULT_CODE_UNITS 4 | |
68 | #define FAULT_TABLE \ | |
69 | { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ | |
70 | 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ | |
71 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
72 | SIGILL } | |
73 | ||
74 | /* Start running with a stack stretching from BEG to END. | |
75 | BEG and END should be symbols meaningful to the assembler. | |
76 | This is used only for kdb. */ | |
77 | ||
78 | #ifdef MOTOROLA | |
79 | #define INIT_STACK(beg, end) \ | |
80 | { asm (".globl end"); \ | |
81 | asm ("move.l $ end, sp"); \ | |
82 | asm ("clr.l fp"); } | |
83 | #else | |
84 | #define INIT_STACK(beg, end) \ | |
85 | { asm (".globl end"); \ | |
86 | asm ("movel $ end, sp"); \ | |
87 | asm ("clrl fp"); } | |
88 | #endif | |
89 | ||
90 | /* Push the frame pointer register on the stack. */ | |
91 | #ifdef MOTOROLA | |
92 | #define PUSH_FRAME_PTR \ | |
93 | asm ("move.l fp, -(sp)"); | |
94 | #else | |
95 | #define PUSH_FRAME_PTR \ | |
96 | asm ("movel fp, -(sp)"); | |
97 | #endif | |
98 | ||
99 | /* Copy the top-of-stack to the frame pointer register. */ | |
100 | #ifdef MOTOROLA | |
101 | #define POP_FRAME_PTR \ | |
102 | asm ("move.l (sp), fp"); | |
103 | #else | |
104 | #define POP_FRAME_PTR \ | |
105 | asm ("movl (sp), fp"); | |
106 | #endif | |
107 | ||
108 | /* After KDB is entered by a fault, push all registers | |
109 | that GDB thinks about (all NUM_REGS of them), | |
110 | so that they appear in order of ascending GDB register number. | |
111 | The fault code will be on the stack beyond the last register. */ | |
112 | ||
113 | #ifdef MOTOROLA | |
114 | #define PUSH_REGISTERS \ | |
115 | { asm ("clr.w -(sp)"); \ | |
116 | asm ("pea (10,sp)"); \ | |
117 | asm ("movem $ 0xfffe,-(sp)"); } | |
118 | #else | |
119 | #define PUSH_REGISTERS \ | |
120 | { asm ("clrw -(sp)"); \ | |
121 | asm ("pea 10(sp)"); \ | |
122 | asm ("movem $ 0xfffe,-(sp)"); } | |
123 | #endif | |
124 | ||
125 | /* Assuming the registers (including processor status) have been | |
126 | pushed on the stack in order of ascending GDB register number, | |
127 | restore them and return to the address in the saved PC register. */ | |
128 | ||
129 | #ifdef MOTOROLA | |
130 | #define POP_REGISTERS \ | |
131 | { asm ("subi.l $8,28(sp)"); \ | |
132 | asm ("movem (sp),$ 0xffff"); \ | |
133 | asm ("rte"); } | |
134 | #else | |
135 | #define POP_REGISTERS \ | |
136 | { asm ("subil $8,28(sp)"); \ | |
137 | asm ("movem (sp),$ 0xffff"); \ | |
138 | asm ("rte"); } | |
139 | #endif |