1 /* Definitions to make GDB hosted on a tahoe running 4.3-Reno
2 Copyright (C) 1986, 1987, 1989, 1991 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.
6 This file is part of GDB.
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* Make sure the system include files define BIG_ENDIAN, UINT_MAX, const,
23 etc, rather than GDB's files. */
25 #include <sys/param.h>
27 /* Host is big-endian */
29 #define HOST_BYTE_ORDER BIG_ENDIAN
31 /* Get rid of any system-imposed stack limit if possible. */
33 #define SET_STACK_LIMIT_HUGE
35 #define REGISTER_U_ADDR(addr, blockend, regno) \
36 { addr = blockend - 100 + regno * 4; \
37 if (regno == PC_REGNUM) addr = blockend - 8; \
38 if (regno == PS_REGNUM) addr = blockend - 4; \
39 if (regno == FP_REGNUM) addr = blockend - 40; \
40 if (regno == SP_REGNUM) addr = blockend - 36; \
41 if (regno == AL_REGNUM) addr = blockend - 20; \
42 if (regno == AH_REGNUM) addr = blockend - 24;}
44 /* Interface definitions for kernel debugger KDB. */
46 /* Map machine fault codes into signal numbers.
47 First subtract 0, divide by 4, then index in a table.
48 Faults for which the entry in this table is 0
49 are not handled by KDB; the program's own trap handler
50 gets to handle then. */
52 #define FAULT_CODE_ORIGIN 0
53 #define FAULT_CODE_UNITS 4
55 { 0, SIGKILL, SIGSEGV, 0, 0, 0, 0, 0, \
56 0, 0, SIGTRAP, SIGTRAP, 0, 0, 0, 0, \
57 0, 0, 0, 0, 0, 0, 0, 0}
59 /* Start running with a stack stretching from BEG to END.
60 BEG and END should be symbols meaningful to the assembler.
61 This is used only for kdb. */
63 #define INIT_STACK(beg, end) \
64 { asm (".globl end"); \
65 asm ("movl $ end, sp"); \
68 /* Push the frame pointer register on the stack. */
70 #define PUSH_FRAME_PTR \
73 /* Copy the top-of-stack to the frame pointer register. */
75 #define POP_FRAME_PTR \
76 asm ("movl (sp), fp");
78 /* After KDB is entered by a fault, push all registers
79 that GDB thinks about (all NUM_REGS of them),
80 so that they appear in order of ascending GDB register number.
81 The fault code will be on the stack beyond the last register. */
83 #define PUSH_REGISTERS \
84 { asm ("pushl 8(sp)"); \
85 asm ("pushl 8(sp)"); \
86 asm ("pushal 0x41(sp)"); \
104 asm ("pushl aclo" ); \
105 asm ("pushl achi" ); \
108 /* Assuming the registers (including processor status) have been
109 pushed on the stack in order of ascending GDB register number,
110 restore them and return to the address in the saved PC register. */
112 #define POP_REGISTERS \
114 asm ("movl (sp)+, achi"); \
115 asm ("movl (sp)+, aclo"); \
116 asm ("movl (sp)+, ps"); \
117 asm ("movl (sp)+, pc"); \
118 asm ("movl (sp)+, sp"); \
119 asm ("movl (sp)+, fp"); \
120 asm ("movl (sp)+, r12"); \
121 asm ("movl (sp)+, r11"); \
122 asm ("movl (sp)+, r10"); \
123 asm ("movl (sp)+, r9"); \
124 asm ("movl (sp)+, r8"); \
125 asm ("movl (sp)+, r7"); \
126 asm ("movl (sp)+, r6"); \
127 asm ("movl (sp)+, r5"); \
128 asm ("movl (sp)+, r4"); \
129 asm ("movl (sp)+, r3"); \
130 asm ("movl (sp)+, r2"); \
131 asm ("movl (sp)+, r1"); \
132 asm ("movl (sp)+, r0"); \
133 asm ("subl2 $8,(sp)"); \
134 asm ("movl (sp),sp"); \