]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/tahoe/xm-tahoe.h
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / config / tahoe / xm-tahoe.h
1 /* Definitions to make GDB hosted on a tahoe running 4.3-Reno
2 Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
3 Contributed by the State University of New York at Buffalo, by the
4 Distributed Computer Systems Lab, Department of Computer Science, 1991.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 /* Make sure the system include files define BIG_ENDIAN, UINT_MAX, const,
24 etc, rather than GDB's files. */
25 #include <stdio.h>
26 #include <sys/param.h>
27
28 /* Host is big-endian */
29
30 #define HOST_BYTE_ORDER BIG_ENDIAN
31
32 /* This is the amount to subtract from u.u_ar0
33 to get the offset in the core file of the register values. */
34
35 #define KERNEL_U_ADDR (0xc0000000 - (TARGET_UPAGES * TARGET_NBPG))
36
37 #define REGISTER_U_ADDR(addr, blockend, regno) \
38 { addr = blockend - 100 + regno * 4; \
39 if (regno == PC_REGNUM) addr = blockend - 8; \
40 if (regno == PS_REGNUM) addr = blockend - 4; \
41 if (regno == FP_REGNUM) addr = blockend - 40; \
42 if (regno == SP_REGNUM) addr = blockend - 36; \
43 if (regno == AL_REGNUM) addr = blockend - 20; \
44 if (regno == AH_REGNUM) addr = blockend - 24;}
45
46 /* Interface definitions for kernel debugger KDB. */
47
48 /* Map machine fault codes into signal numbers.
49 First subtract 0, divide by 4, then index in a table.
50 Faults for which the entry in this table is 0
51 are not handled by KDB; the program's own trap handler
52 gets to handle then. */
53
54 #define FAULT_CODE_ORIGIN 0
55 #define FAULT_CODE_UNITS 4
56 #define FAULT_TABLE \
57 { 0, SIGKILL, SIGSEGV, 0, 0, 0, 0, 0, \
58 0, 0, SIGTRAP, SIGTRAP, 0, 0, 0, 0, \
59 0, 0, 0, 0, 0, 0, 0, 0}
60
61 /* Start running with a stack stretching from BEG to END.
62 BEG and END should be symbols meaningful to the assembler.
63 This is used only for kdb. */
64
65 #define INIT_STACK(beg, end) \
66 { asm (".globl end"); \
67 asm ("movl $ end, sp"); \
68 asm ("clrl fp"); }
69
70 /* Push the frame pointer register on the stack. */
71
72 #define PUSH_FRAME_PTR \
73 asm ("pushl fp");
74
75 /* Copy the top-of-stack to the frame pointer register. */
76
77 #define POP_FRAME_PTR \
78 asm ("movl (sp), fp");
79
80 /* After KDB is entered by a fault, push all registers
81 that GDB thinks about (all NUM_REGS of them),
82 so that they appear in order of ascending GDB register number.
83 The fault code will be on the stack beyond the last register. */
84
85 #define PUSH_REGISTERS \
86 { asm ("pushl 8(sp)"); \
87 asm ("pushl 8(sp)"); \
88 asm ("pushal 0x41(sp)"); \
89 asm ("pushl r0" ); \
90 asm ("pushl r1" ); \
91 asm ("pushl r2" ); \
92 asm ("pushl r3" ); \
93 asm ("pushl r4" ); \
94 asm ("pushl r5" ); \
95 asm ("pushl r6" ); \
96 asm ("pushl r7" ); \
97 asm ("pushl r8" ); \
98 asm ("pushl r9" ); \
99 asm ("pushl r10" ); \
100 asm ("pushl r11" ); \
101 asm ("pushl r12" ); \
102 asm ("pushl fp" ); \
103 asm ("pushl sp" ); \
104 asm ("pushl pc" ); \
105 asm ("pushl ps" ); \
106 asm ("pushl aclo" ); \
107 asm ("pushl achi" ); \
108 }
109
110 /* Assuming the registers (including processor status) have been
111 pushed on the stack in order of ascending GDB register number,
112 restore them and return to the address in the saved PC register. */
113
114 #define POP_REGISTERS \
115 { \
116 asm ("movl (sp)+, achi"); \
117 asm ("movl (sp)+, aclo"); \
118 asm ("movl (sp)+, ps"); \
119 asm ("movl (sp)+, pc"); \
120 asm ("movl (sp)+, sp"); \
121 asm ("movl (sp)+, fp"); \
122 asm ("movl (sp)+, r12"); \
123 asm ("movl (sp)+, r11"); \
124 asm ("movl (sp)+, r10"); \
125 asm ("movl (sp)+, r9"); \
126 asm ("movl (sp)+, r8"); \
127 asm ("movl (sp)+, r7"); \
128 asm ("movl (sp)+, r6"); \
129 asm ("movl (sp)+, r5"); \
130 asm ("movl (sp)+, r4"); \
131 asm ("movl (sp)+, r3"); \
132 asm ("movl (sp)+, r2"); \
133 asm ("movl (sp)+, r1"); \
134 asm ("movl (sp)+, r0"); \
135 asm ("subl2 $8,(sp)"); \
136 asm ("movl (sp),sp"); \
137 asm ("rei"); }