Tue Sep 29 10:19:00 1992 Ian Lance Taylor (ian@cygnus.com)
[deliverable/binutils-gdb.git] / gdb / xm-hp300hpux.h
1 /* Parameters for execution on an HP 9000 model 320, for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987, 1989 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 /* HP/UX is USG, but it does have <ptrace.h> */
21 #include <sys/ptrace.h>
22
23 #define HOST_BYTE_ORDER BIG_ENDIAN
24
25 /* Define this to indicate problems with traps after continuing. */
26 #define HP_OS_BUG
27
28 /* fetch_inferior_registers is in hp300hpux-dep.c. */
29 #define FETCH_INFERIOR_REGISTERS
30
31 /* Set flag to indicate whether HP's assembler is in use. */
32 #ifdef __GNUC__
33 #ifdef __HPUX_ASM__
34 #define HPUX_ASM
35 #endif
36 #else /* not GNU C. */
37 #define HPUX_ASM
38 #endif /* not GNU C. */
39
40 /* Define this for versions of hp-ux older than 6.0 */
41 /* #define HPUX_VERSION_5 */
42
43 /* define USG if you are using sys5 /usr/include's */
44 #undef USG /* In case it was defined in the Makefile for cplus-dem.c */
45 #define USG
46
47 /* The mem functions are in <string.h>. */
48 #undef MEM_FNS_DECLARED
49 #define MEM_FNS_DECLARED 1
50
51 #define HAVE_TERMIO
52
53 /* Get rid of any system-imposed stack limit if possible. */
54 /* The hp9k320.h doesn't seem to have this feature. */
55 /* #define SET_STACK_LIMIT_HUGE */
56 /* So we'll just have to avoid big alloca's. */
57 #define BROKEN_LARGE_ALLOCA
58
59 /* This is the amount to subtract from u.u_ar0
60 to get the offset in the core file of the register values. */
61
62 #ifdef HPUX_VERSION_5
63 #define KERNEL_U_ADDR 0x00979000
64 #else /* Not HPUX version 5. */
65 /* Use HPUX-style nlist() to get kernel_u_addr. */
66 #define KERNEL_U_ADDR_HPUX
67 #endif /* Not HPUX version 5. */
68
69 #define REGISTER_ADDR(u_ar0, regno) \
70 (unsigned int) \
71 (((regno) < PS_REGNUM) \
72 ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
73 : (((regno) == PS_REGNUM) \
74 ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
75 : (&((struct exception_stack *) (u_ar0))->e_PC)))
76
77 #define FP_REGISTER_ADDR(u, regno) \
78 (((char *) \
79 (((regno) < FPC_REGNUM) \
80 ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
81 : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
82 - ((char *) (& u)))
83 \f
84 /* Do implement the attach and detach commands. */
85
86 #define ATTACH_DETACH
87 \f
88 /* Interface definitions for kernel debugger KDB. */
89
90 /* Map machine fault codes into signal numbers.
91 First subtract 0, divide by 4, then index in a table.
92 Faults for which the entry in this table is 0
93 are not handled by KDB; the program's own trap handler
94 gets to handle then. */
95
96 #define FAULT_CODE_ORIGIN 0
97 #define FAULT_CODE_UNITS 4
98 #define FAULT_TABLE \
99 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
100 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
101 0, 0, 0, 0, 0, 0, 0, 0, \
102 SIGILL }
103
104 #ifndef HPUX_ASM
105
106 /* Start running with a stack stretching from BEG to END.
107 BEG and END should be symbols meaningful to the assembler.
108 This is used only for kdb. */
109
110 #define INIT_STACK(beg, end) \
111 { asm (".globl end"); \
112 asm ("movel $ end, sp"); \
113 asm ("clrl fp"); }
114
115 /* Push the frame pointer register on the stack. */
116 #define PUSH_FRAME_PTR \
117 asm ("movel fp, -(sp)");
118
119 /* Copy the top-of-stack to the frame pointer register. */
120 #define POP_FRAME_PTR \
121 asm ("movl (sp), fp");
122
123 /* After KDB is entered by a fault, push all registers
124 that GDB thinks about (all NUM_REGS of them),
125 so that they appear in order of ascending GDB register number.
126 The fault code will be on the stack beyond the last register. */
127
128 #define PUSH_REGISTERS \
129 { asm ("clrw -(sp)"); \
130 asm ("pea 10(sp)"); \
131 asm ("movem $ 0xfffe,-(sp)"); }
132
133 /* Assuming the registers (including processor status) have been
134 pushed on the stack in order of ascending GDB register number,
135 restore them and return to the address in the saved PC register. */
136
137 #define POP_REGISTERS \
138 { asm ("subil $8,28(sp)"); \
139 asm ("movem (sp),$ 0xffff"); \
140 asm ("rte"); }
141
142 #else /* HPUX_ASM */
143
144 /* Start running with a stack stretching from BEG to END.
145 BEG and END should be symbols meaningful to the assembler.
146 This is used only for kdb. */
147
148 #define INIT_STACK(beg, end) \
149 { asm ("global end"); \
150 asm ("mov.l &end,%sp"); \
151 asm ("clr.l %a6"); }
152
153 /* Push the frame pointer register on the stack. */
154 #define PUSH_FRAME_PTR \
155 asm ("mov.l %fp,-(%sp)");
156
157 /* Copy the top-of-stack to the frame pointer register. */
158 #define POP_FRAME_PTR \
159 asm ("mov.l (%sp),%fp");
160
161 /* After KDB is entered by a fault, push all registers
162 that GDB thinks about (all NUM_REGS of them),
163 so that they appear in order of ascending GDB register number.
164 The fault code will be on the stack beyond the last register. */
165
166 #define PUSH_REGISTERS \
167 { asm ("clr.w -(%sp)"); \
168 asm ("pea 10(%sp)"); \
169 asm ("movm.l &0xfffe,-(%sp)"); }
170
171 /* Assuming the registers (including processor status) have been
172 pushed on the stack in order of ascending GDB register number,
173 restore them and return to the address in the saved PC register. */
174
175 #define POP_REGISTERS \
176 { asm ("subi.l &8,28(%sp)"); \
177 asm ("mov.m (%sp),&0xffff"); \
178 asm ("rte"); }
179
180 #endif /* HPUX_ASM */
This page took 0.033761 seconds and 5 git commands to generate.