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