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.
4 This file is part of GDB.
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.
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.
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. */
20 #define HOST_BYTE_ORDER BIG_ENDIAN
22 /* Define this to indicate problems with traps after continuing. */
25 /* fetch_inferior_registers is in hp300hpux-dep.c. */
26 #define FETCH_INFERIOR_REGISTERS
28 /* Set flag to indicate whether HP's assembler is in use. */
33 #else /* not GNU C. */
35 #endif /* not GNU C. */
37 /* Define this for versions of hp-ux older than 6.0 */
38 /* #define HPUX_VERSION_5 */
40 /* define USG if you are using sys5 /usr/include's */
41 #undef USG /* In case it was defined in the Makefile for cplus-dem.c */
46 /* Get rid of any system-imposed stack limit if possible. */
47 /* The hp9k320.h doesn't seem to have this feature. */
48 /* #define SET_STACK_LIMIT_HUGE */
49 /* So we'll just have to avoid big alloca's. */
50 #define BROKEN_LARGE_ALLOCA
52 /* This is the amount to subtract from u.u_ar0
53 to get the offset in the core file of the register values. */
56 #define KERNEL_U_ADDR 0x00979000
57 #else /* Not HPUX version 5. */
58 /* Use HPUX-style nlist() to get kernel_u_addr. */
59 #define KERNEL_U_ADDR_HPUX
60 #endif /* Not HPUX version 5. */
62 #define REGISTER_ADDR(u_ar0, regno) \
64 (((regno) < PS_REGNUM) \
65 ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
66 : (((regno) == PS_REGNUM) \
67 ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
68 : (&((struct exception_stack *) (u_ar0))->e_PC)))
70 #define FP_REGISTER_ADDR(u, regno) \
72 (((regno) < FPC_REGNUM) \
73 ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
74 : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
77 /* Do implement the attach and detach commands. */
81 /* Interface definitions for kernel debugger KDB. */
83 /* Map machine fault codes into signal numbers.
84 First subtract 0, divide by 4, then index in a table.
85 Faults for which the entry in this table is 0
86 are not handled by KDB; the program's own trap handler
87 gets to handle then. */
89 #define FAULT_CODE_ORIGIN 0
90 #define FAULT_CODE_UNITS 4
92 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
93 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
94 0, 0, 0, 0, 0, 0, 0, 0, \
99 /* Start running with a stack stretching from BEG to END.
100 BEG and END should be symbols meaningful to the assembler.
101 This is used only for kdb. */
103 #define INIT_STACK(beg, end) \
104 { asm (".globl end"); \
105 asm ("movel $ end, sp"); \
108 /* Push the frame pointer register on the stack. */
109 #define PUSH_FRAME_PTR \
110 asm ("movel fp, -(sp)");
112 /* Copy the top-of-stack to the frame pointer register. */
113 #define POP_FRAME_PTR \
114 asm ("movl (sp), fp");
116 /* After KDB is entered by a fault, push all registers
117 that GDB thinks about (all NUM_REGS of them),
118 so that they appear in order of ascending GDB register number.
119 The fault code will be on the stack beyond the last register. */
121 #define PUSH_REGISTERS \
122 { asm ("clrw -(sp)"); \
123 asm ("pea 10(sp)"); \
124 asm ("movem $ 0xfffe,-(sp)"); }
126 /* Assuming the registers (including processor status) have been
127 pushed on the stack in order of ascending GDB register number,
128 restore them and return to the address in the saved PC register. */
130 #define POP_REGISTERS \
131 { asm ("subil $8,28(sp)"); \
132 asm ("movem (sp),$ 0xffff"); \
137 /* Start running with a stack stretching from BEG to END.
138 BEG and END should be symbols meaningful to the assembler.
139 This is used only for kdb. */
141 #define INIT_STACK(beg, end) \
142 { asm ("global end"); \
143 asm ("mov.l &end,%sp"); \
146 /* Push the frame pointer register on the stack. */
147 #define PUSH_FRAME_PTR \
148 asm ("mov.l %fp,-(%sp)");
150 /* Copy the top-of-stack to the frame pointer register. */
151 #define POP_FRAME_PTR \
152 asm ("mov.l (%sp),%fp");
154 /* After KDB is entered by a fault, push all registers
155 that GDB thinks about (all NUM_REGS of them),
156 so that they appear in order of ascending GDB register number.
157 The fault code will be on the stack beyond the last register. */
159 #define PUSH_REGISTERS \
160 { asm ("clr.w -(%sp)"); \
161 asm ("pea 10(%sp)"); \
162 asm ("movm.l &0xfffe,-(%sp)"); }
164 /* Assuming the registers (including processor status) have been
165 pushed on the stack in order of ascending GDB register number,
166 restore them and return to the address in the saved PC register. */
168 #define POP_REGISTERS \
169 { asm ("subi.l &8,28(%sp)"); \
170 asm ("mov.m (%sp),&0xffff"); \
173 #endif /* HPUX_ASM */