* config/m68k/xm-hp300hpux.h: Define MMAP_BASE_ADDRESS and MMAP_INCREMENT.
[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, Boston, MA 02111-1307, USA. */
19
20 #define HOST_BYTE_ORDER BIG_ENDIAN
21
22 /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
23 with five arguments, so programs written for normal ptrace lose.
24
25 Idiots.
26
27 (They should have just made it varadic). */
28 #define FIVE_ARG_PTRACE
29
30 /* Define this to indicate problems with traps after continuing. */
31 #define HP_OS_BUG
32
33 /* Set flag to indicate whether HP's assembler is in use. */
34 #ifdef __GNUC__
35 #ifdef __HPUX_ASM__
36 #define HPUX_ASM
37 #endif
38 #else /* not GNU C. */
39 #define HPUX_ASM
40 #endif /* not GNU C. */
41
42 /* Define this for versions of hp-ux older than 6.0 */
43 /* #define HPUX_VERSION_5 */
44
45 /* define USG if you are using sys5 /usr/include's */
46 #undef USG /* In case it was defined in the Makefile for cplus-dem.c */
47 #define USG
48
49 #define HAVE_TERMIOS
50
51 #define REGISTER_ADDR(u_ar0, regno) \
52 (unsigned int) \
53 (((regno) < PS_REGNUM) \
54 ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \
55 : (((regno) == PS_REGNUM) \
56 ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \
57 : (&((struct exception_stack *) (u_ar0))->e_PC)))
58
59 #define FP_REGISTER_ADDR(u, regno) \
60 (((char *) \
61 (((regno) < FPC_REGNUM) \
62 ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \
63 : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \
64 - ((char *) (& u)))
65 \f
66 /* Interface definitions for kernel debugger KDB. */
67
68 /* Map machine fault codes into signal numbers.
69 First subtract 0, divide by 4, then index in a table.
70 Faults for which the entry in this table is 0
71 are not handled by KDB; the program's own trap handler
72 gets to handle then. */
73
74 #define FAULT_CODE_ORIGIN 0
75 #define FAULT_CODE_UNITS 4
76 #define FAULT_TABLE \
77 { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
78 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
79 0, 0, 0, 0, 0, 0, 0, 0, \
80 SIGILL }
81
82 /* If you expect to use the mmalloc package to obtain mapped symbol files,
83 for now you have to specify some parameters that determine how gdb places
84 the mappings in it's address space. See the comments in map_to_address()
85 for details. This is expected to only be a short term solution. Yes it
86 is a kludge.
87 FIXME: Make this more automatic. */
88
89 #define MMAP_BASE_ADDRESS 0xA0000000 /* First mapping here */
90 #define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */
91
92 /* On hpux, autoconf 2.4 (and possibly others) does not properly detect that
93 mmap is available. Until this is fixed, we have to explicitly force
94 HAVE_MMAP. -fnf */
95
96 #define HAVE_MMAP 1
97
98 #ifndef HPUX_ASM
99
100 /* Start running with a stack stretching from BEG to END.
101 BEG and END should be symbols meaningful to the assembler.
102 This is used only for kdb. */
103
104 #define INIT_STACK(beg, end) \
105 { asm (".globl end"); \
106 asm ("movel $ end, sp"); \
107 asm ("clrl fp"); }
108
109 /* Push the frame pointer register on the stack. */
110 #define PUSH_FRAME_PTR \
111 asm ("movel fp, -(sp)");
112
113 /* Copy the top-of-stack to the frame pointer register. */
114 #define POP_FRAME_PTR \
115 asm ("movl (sp), fp");
116
117 /* After KDB is entered by a fault, push all registers
118 that GDB thinks about (all NUM_REGS of them),
119 so that they appear in order of ascending GDB register number.
120 The fault code will be on the stack beyond the last register. */
121
122 #define PUSH_REGISTERS \
123 { asm ("clrw -(sp)"); \
124 asm ("pea 10(sp)"); \
125 asm ("movem $ 0xfffe,-(sp)"); }
126
127 /* Assuming the registers (including processor status) have been
128 pushed on the stack in order of ascending GDB register number,
129 restore them and return to the address in the saved PC register. */
130
131 #define POP_REGISTERS \
132 { asm ("subil $8,28(sp)"); \
133 asm ("movem (sp),$ 0xffff"); \
134 asm ("rte"); }
135
136 #else /* HPUX_ASM */
137
138 /* Start running with a stack stretching from BEG to END.
139 BEG and END should be symbols meaningful to the assembler.
140 This is used only for kdb. */
141
142 #define INIT_STACK(beg, end) \
143 { asm ("global end"); \
144 asm ("mov.l &end,%sp"); \
145 asm ("clr.l %a6"); }
146
147 /* Push the frame pointer register on the stack. */
148 #define PUSH_FRAME_PTR \
149 asm ("mov.l %fp,-(%sp)");
150
151 /* Copy the top-of-stack to the frame pointer register. */
152 #define POP_FRAME_PTR \
153 asm ("mov.l (%sp),%fp");
154
155 /* After KDB is entered by a fault, push all registers
156 that GDB thinks about (all NUM_REGS of them),
157 so that they appear in order of ascending GDB register number.
158 The fault code will be on the stack beyond the last register. */
159
160 #define PUSH_REGISTERS \
161 { asm ("clr.w -(%sp)"); \
162 asm ("pea 10(%sp)"); \
163 asm ("movm.l &0xfffe,-(%sp)"); }
164
165 /* Assuming the registers (including processor status) have been
166 pushed on the stack in order of ascending GDB register number,
167 restore them and return to the address in the saved PC register. */
168
169 #define POP_REGISTERS \
170 { asm ("subi.l &8,28(%sp)"); \
171 asm ("mov.m (%sp),&0xffff"); \
172 asm ("rte"); }
173
174 #endif /* HPUX_ASM */