]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Definitions to make GDB run on a vax under 4.2bsd. |
2 | Copyright (C) 1986, 1987, 1989 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 |
dd3b648e | 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. | |
dd3b648e | 10 | |
99a7de40 | 11 | This program is distributed in the hope that it will be useful, |
dd3b648e RP |
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. */ | |
dd3b648e RP |
19 | |
20 | #define HOST_BYTE_ORDER LITTLE_ENDIAN | |
21 | ||
22 | /* Get rid of any system-imposed stack limit if possible. */ | |
23 | ||
24 | #define SET_STACK_LIMIT_HUGE | |
25 | ||
26 | /* This is the amount to subtract from u.u_ar0 | |
27 | to get the offset in the core file of the register values. */ | |
28 | ||
29 | #define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) | |
30 | ||
31 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
32 | { addr = blockend - 0110 + regno * 4; \ | |
33 | if (regno == PC_REGNUM) addr = blockend - 8; \ | |
34 | if (regno == PS_REGNUM) addr = blockend - 4; \ | |
35 | if (regno == FP_REGNUM) addr = blockend - 0120; \ | |
36 | if (regno == AP_REGNUM) addr = blockend - 0124; \ | |
37 | if (regno == SP_REGNUM) addr = blockend - 20; } | |
38 | ||
62853f80 JG |
39 | /* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ |
40 | #define ONE_PROCESS_WRITETEXT | |
41 | ||
dd3b648e RP |
42 | /* Interface definitions for kernel debugger KDB. */ |
43 | ||
44 | /* Map machine fault codes into signal numbers. | |
45 | First subtract 0, divide by 4, then index in a table. | |
46 | Faults for which the entry in this table is 0 | |
47 | are not handled by KDB; the program's own trap handler | |
48 | gets to handle then. */ | |
49 | ||
50 | #define FAULT_CODE_ORIGIN 0 | |
51 | #define FAULT_CODE_UNITS 4 | |
52 | #define FAULT_TABLE \ | |
53 | { 0, SIGKILL, SIGSEGV, 0, 0, 0, 0, 0, \ | |
54 | 0, 0, SIGTRAP, SIGTRAP, 0, 0, 0, 0, \ | |
55 | 0, 0, 0, 0, 0, 0, 0, 0} | |
56 | ||
57 | /* Start running with a stack stretching from BEG to END. | |
58 | BEG and END should be symbols meaningful to the assembler. | |
59 | This is used only for kdb. */ | |
60 | ||
61 | #define INIT_STACK(beg, end) \ | |
62 | { asm (".globl end"); \ | |
63 | asm ("movl $ end, sp"); \ | |
64 | asm ("clrl fp"); } | |
65 | ||
66 | /* Push the frame pointer register on the stack. */ | |
67 | #define PUSH_FRAME_PTR \ | |
68 | asm ("pushl fp"); | |
69 | ||
70 | /* Copy the top-of-stack to the frame pointer register. */ | |
71 | #define POP_FRAME_PTR \ | |
72 | asm ("movl (sp), fp"); | |
73 | ||
74 | /* After KDB is entered by a fault, push all registers | |
75 | that GDB thinks about (all NUM_REGS of them), | |
76 | so that they appear in order of ascending GDB register number. | |
77 | The fault code will be on the stack beyond the last register. */ | |
78 | ||
79 | #define PUSH_REGISTERS \ | |
80 | { asm ("pushl 8(sp)"); \ | |
81 | asm ("pushl 8(sp)"); \ | |
82 | asm ("pushal 0x14(sp)"); \ | |
83 | asm ("pushr $037777"); } | |
84 | ||
85 | /* Assuming the registers (including processor status) have been | |
86 | pushed on the stack in order of ascending GDB register number, | |
87 | restore them and return to the address in the saved PC register. */ | |
88 | ||
89 | #define POP_REGISTERS \ | |
90 | { asm ("popr $037777"); \ | |
91 | asm ("subl2 $8,(sp)"); \ | |
92 | asm ("movl (sp),sp"); \ | |
93 | asm ("rei"); } |