]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/m68k/xm-hp300hpux.h
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / config / m68k / xm-hp300hpux.h
1 /* Parameters for HP 9000 model 320 hosting, for GDB, the GNU debugger.
2 Copyright (C) 1986, 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 /* Define this to indicate problems with traps after continuing. */
24 #define HP_OS_BUG
25
26 /* Set flag to indicate whether HP's assembler is in use. */
27 #ifdef __GNUC__
28 #ifdef __HPUX_ASM__
29 #define HPUX_ASM
30 #endif
31 #else /* not GNU C. */
32 #define HPUX_ASM
33 #endif /* not GNU C. */
34
35 /* Define this for versions of hp-ux older than 6.0 */
36 /* #define HPUX_VERSION_5 */
37
38 /* define USG if you are using sys5 /usr/include's */
39 #undef USG /* In case it was defined in the Makefile for cplus-dem.c */
40 #define USG
41
42 #define HAVE_TERMIOS
43
44 #define REGISTER_ADDR(u_ar0, regno) \
45 (unsigned int) \
46 (((regno) < PS_REGNUM) \
47 ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
48 : (((regno) == PS_REGNUM) \
49 ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
50 : (&((struct exception_stack *) (u_ar0))->e_PC)))
51
52 #define FP_REGISTER_ADDR(u, regno) \
53 (((char *) \
54 (((regno) < FPC_REGNUM) \
55 ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
56 : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
57 - ((char *) (& u)))
58 \f
59 /* Interface definitions for kernel debugger KDB. */
60
61 /* Map machine fault codes into signal numbers.
62 First subtract 0, divide by 4, then index in a table.
63 Faults for which the entry in this table is 0
64 are not handled by KDB; the program's own trap handler
65 gets to handle then. */
66
67 #define FAULT_CODE_ORIGIN 0
68 #define FAULT_CODE_UNITS 4
69 #define FAULT_TABLE \
70 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
71 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
72 0, 0, 0, 0, 0, 0, 0, 0, \
73 SIGILL }
74
75 #ifndef HPUX_ASM
76
77 /* Start running with a stack stretching from BEG to END.
78 BEG and END should be symbols meaningful to the assembler.
79 This is used only for kdb. */
80
81 #define INIT_STACK(beg, end) \
82 { asm (".globl end"); \
83 asm ("movel $ end, sp"); \
84 asm ("clrl fp"); }
85
86 /* Push the frame pointer register on the stack. */
87 #define PUSH_FRAME_PTR \
88 asm ("movel fp, -(sp)");
89
90 /* Copy the top-of-stack to the frame pointer register. */
91 #define POP_FRAME_PTR \
92 asm ("movl (sp), fp");
93
94 /* After KDB is entered by a fault, push all registers
95 that GDB thinks about (all NUM_REGS of them),
96 so that they appear in order of ascending GDB register number.
97 The fault code will be on the stack beyond the last register. */
98
99 #define PUSH_REGISTERS \
100 { asm ("clrw -(sp)"); \
101 asm ("pea 10(sp)"); \
102 asm ("movem $ 0xfffe,-(sp)"); }
103
104 /* Assuming the registers (including processor status) have been
105 pushed on the stack in order of ascending GDB register number,
106 restore them and return to the address in the saved PC register. */
107
108 #define POP_REGISTERS \
109 { asm ("subil $8,28(sp)"); \
110 asm ("movem (sp),$ 0xffff"); \
111 asm ("rte"); }
112
113 #else /* HPUX_ASM */
114
115 /* Start running with a stack stretching from BEG to END.
116 BEG and END should be symbols meaningful to the assembler.
117 This is used only for kdb. */
118
119 #define INIT_STACK(beg, end) \
120 { asm ("global end"); \
121 asm ("mov.l &end,%sp"); \
122 asm ("clr.l %a6"); }
123
124 /* Push the frame pointer register on the stack. */
125 #define PUSH_FRAME_PTR \
126 asm ("mov.l %fp,-(%sp)");
127
128 /* Copy the top-of-stack to the frame pointer register. */
129 #define POP_FRAME_PTR \
130 asm ("mov.l (%sp),%fp");
131
132 /* After KDB is entered by a fault, push all registers
133 that GDB thinks about (all NUM_REGS of them),
134 so that they appear in order of ascending GDB register number.
135 The fault code will be on the stack beyond the last register. */
136
137 #define PUSH_REGISTERS \
138 { asm ("clr.w -(%sp)"); \
139 asm ("pea 10(%sp)"); \
140 asm ("movm.l &0xfffe,-(%sp)"); }
141
142 /* Assuming the registers (including processor status) have been
143 pushed on the stack in order of ascending GDB register number,
144 restore them and return to the address in the saved PC register. */
145
146 #define POP_REGISTERS \
147 { asm ("subi.l &8,28(%sp)"); \
148 asm ("mov.m (%sp),&0xffff"); \
149 asm ("rte"); }
150
151 #endif /* HPUX_ASM */