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