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