1 |
1181 |
sfurman |
/* Parameters for HP 9000 model 320 hosting, for GDB, the GNU debugger.
|
2 |
|
|
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GDB.
|
6 |
|
|
|
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.
|
11 |
|
|
|
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.
|
16 |
|
|
|
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. */
|
21 |
|
|
|
22 |
|
|
/* Define this to indicate problems with traps after continuing. */
|
23 |
|
|
#define HP_OS_BUG
|
24 |
|
|
|
25 |
|
|
/* Set flag to indicate whether HP's assembler is in use. */
|
26 |
|
|
#ifdef __GNUC__
|
27 |
|
|
#ifdef __HPUX_ASM__
|
28 |
|
|
#define HPUX_ASM
|
29 |
|
|
#endif
|
30 |
|
|
#else /* not GNU C. */
|
31 |
|
|
#define HPUX_ASM
|
32 |
|
|
#endif /* not GNU C. */
|
33 |
|
|
|
34 |
|
|
/* Define this for versions of hp-ux older than 6.0 */
|
35 |
|
|
/* #define HPUX_VERSION_5 */
|
36 |
|
|
|
37 |
|
|
/* define USG if you are using sys5 /usr/include's */
|
38 |
|
|
#undef USG /* In case it was defined in the Makefile for cplus-dem.c */
|
39 |
|
|
#define USG
|
40 |
|
|
|
41 |
|
|
#define HAVE_TERMIOS
|
42 |
|
|
|
43 |
|
|
#define REGISTER_ADDR(u_ar0, regno) \
|
44 |
|
|
(unsigned int) \
|
45 |
|
|
(((regno) < PS_REGNUM) \
|
46 |
|
|
? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
|
47 |
|
|
: (((regno) == PS_REGNUM) \
|
48 |
|
|
? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
|
49 |
|
|
: (&((struct exception_stack *) (u_ar0))->e_PC)))
|
50 |
|
|
|
51 |
|
|
#define FP_REGISTER_ADDR(u, regno) \
|
52 |
|
|
(((char *) \
|
53 |
|
|
(((regno) < FPC_REGNUM) \
|
54 |
|
|
? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
|
55 |
|
|
: (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
|
56 |
|
|
- ((char *) (& u)))
|
57 |
|
|
|
58 |
|
|
/* Interface definitions for kernel debugger KDB. */
|
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 |
|
|
#ifndef HPUX_ASM
|
75 |
|
|
|
76 |
|
|
/* Start running with a stack stretching from BEG to END.
|
77 |
|
|
BEG and END should be symbols meaningful to the assembler.
|
78 |
|
|
This is used only for kdb. */
|
79 |
|
|
|
80 |
|
|
#define INIT_STACK(beg, end) \
|
81 |
|
|
{ asm (".globl end"); \
|
82 |
|
|
asm ("movel $ end, sp"); \
|
83 |
|
|
asm ("clrl fp"); }
|
84 |
|
|
|
85 |
|
|
/* Push the frame pointer register on the stack. */
|
86 |
|
|
#define PUSH_FRAME_PTR \
|
87 |
|
|
asm ("movel fp, -(sp)");
|
88 |
|
|
|
89 |
|
|
/* Copy the top-of-stack to the frame pointer register. */
|
90 |
|
|
#define POP_FRAME_PTR \
|
91 |
|
|
asm ("movl (sp), fp");
|
92 |
|
|
|
93 |
|
|
/* After KDB is entered by a fault, push all registers
|
94 |
|
|
that GDB thinks about (all NUM_REGS of them),
|
95 |
|
|
so that they appear in order of ascending GDB register number.
|
96 |
|
|
The fault code will be on the stack beyond the last register. */
|
97 |
|
|
|
98 |
|
|
#define PUSH_REGISTERS \
|
99 |
|
|
{ asm ("clrw -(sp)"); \
|
100 |
|
|
asm ("pea 10(sp)"); \
|
101 |
|
|
asm ("movem $ 0xfffe,-(sp)"); }
|
102 |
|
|
|
103 |
|
|
/* Assuming the registers (including processor status) have been
|
104 |
|
|
pushed on the stack in order of ascending GDB register number,
|
105 |
|
|
restore them and return to the address in the saved PC register. */
|
106 |
|
|
|
107 |
|
|
#define POP_REGISTERS \
|
108 |
|
|
{ asm ("subil $8,28(sp)"); \
|
109 |
|
|
asm ("movem (sp),$ 0xffff"); \
|
110 |
|
|
asm ("rte"); }
|
111 |
|
|
|
112 |
|
|
#else /* HPUX_ASM */
|
113 |
|
|
|
114 |
|
|
/* Start running with a stack stretching from BEG to END.
|
115 |
|
|
BEG and END should be symbols meaningful to the assembler.
|
116 |
|
|
This is used only for kdb. */
|
117 |
|
|
|
118 |
|
|
#define INIT_STACK(beg, end) \
|
119 |
|
|
{ asm ("global end"); \
|
120 |
|
|
asm ("mov.l &end,%sp"); \
|
121 |
|
|
asm ("clr.l %a6"); }
|
122 |
|
|
|
123 |
|
|
/* Push the frame pointer register on the stack. */
|
124 |
|
|
#define PUSH_FRAME_PTR \
|
125 |
|
|
asm ("mov.l %fp,-(%sp)");
|
126 |
|
|
|
127 |
|
|
/* Copy the top-of-stack to the frame pointer register. */
|
128 |
|
|
#define POP_FRAME_PTR \
|
129 |
|
|
asm ("mov.l (%sp),%fp");
|
130 |
|
|
|
131 |
|
|
/* After KDB is entered by a fault, push all registers
|
132 |
|
|
that GDB thinks about (all NUM_REGS of them),
|
133 |
|
|
so that they appear in order of ascending GDB register number.
|
134 |
|
|
The fault code will be on the stack beyond the last register. */
|
135 |
|
|
|
136 |
|
|
#define PUSH_REGISTERS \
|
137 |
|
|
{ asm ("clr.w -(%sp)"); \
|
138 |
|
|
asm ("pea 10(%sp)"); \
|
139 |
|
|
asm ("movm.l &0xfffe,-(%sp)"); }
|
140 |
|
|
|
141 |
|
|
/* Assuming the registers (including processor status) have been
|
142 |
|
|
pushed on the stack in order of ascending GDB register number,
|
143 |
|
|
restore them and return to the address in the saved PC register. */
|
144 |
|
|
|
145 |
|
|
#define POP_REGISTERS \
|
146 |
|
|
{ asm ("subi.l &8,28(%sp)"); \
|
147 |
|
|
asm ("mov.m (%sp),&0xffff"); \
|
148 |
|
|
asm ("rte"); }
|
149 |
|
|
|
150 |
|
|
#endif /* HPUX_ASM */
|