]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Definitions to make GDB run on a merlin under utek 2.1 |
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 | /* This machine doesn't have the siginterrupt call. */ | |
21 | #define NO_SIGINTERRUPT | |
22 | ||
23 | /* Under Utek, a ptrace'd process can be the only active process for | |
24 | an executable. Therefore instead of /bin/sh use gdb-sh (which should | |
25 | just be a copy of /bin/sh which is world readable and writeable). */ | |
26 | #define SHELL_FILE "/usr/gnu/lib/gdb-sh" | |
27 | ||
28 | #define HOST_BYTE_ORDER LITTLE_ENDIAN | |
29 | ||
30 | /* This is the amount to subtract from u.u_ar0 | |
31 | to get the offset in the core file of the register values. */ | |
32 | ||
33 | #define KERNEL_U_ADDR (0xfef000) | |
34 | ||
35 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
36 | { \ | |
37 | switch (regno) { \ | |
38 | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: \ | |
39 | addr = blockend + (R0 - regno) * sizeof (int); break; \ | |
40 | case PC_REGNUM: \ | |
41 | addr = blockend + PC * sizeof (int); break; \ | |
42 | case SP_REGNUM: \ | |
43 | addr = blockend + SP * sizeof (int); break; \ | |
44 | case FP_REGNUM: \ | |
45 | addr = blockend + FP * sizeof (int); break; \ | |
46 | case PS_REGNUM: \ | |
47 | addr = blockend + 12 * sizeof (int); break; \ | |
48 | case FPS_REGNUM: \ | |
49 | addr = 108; break; \ | |
50 | case FP0_REGNUM + 0: case FP0_REGNUM + 1: \ | |
51 | case FP0_REGNUM + 2: case FP0_REGNUM + 3: \ | |
52 | case FP0_REGNUM + 4: case FP0_REGNUM + 5: \ | |
53 | case FP0_REGNUM + 6: case FP0_REGNUM + 7: \ | |
54 | addr = 76 + (regno - FP0_REGNUM) * sizeof (float); break; \ | |
55 | case LP0_REGNUM + 0: case LP0_REGNUM + 1: \ | |
56 | case LP0_REGNUM + 2: case LP0_REGNUM + 3: \ | |
57 | addr = 76 + (regno - LP0_REGNUM) * sizeof (double); break; \ | |
58 | default: \ | |
59 | printf ("bad argument to REGISTER_U_ADDR %d\n", regno); \ | |
60 | abort (); \ | |
61 | } \ | |
62 | } | |
63 | ||
64 | /* Compensate for lack of `vprintf' function. */ | |
65 | #define MISSING_VPRINTF | |
66 | \f | |
67 | #if 0 | |
68 | /* Interface definitions for kernel debugger KDB. */ | |
69 | ||
70 | /* Map machine fault codes into signal numbers. | |
71 | First subtract 0, divide by 4, then index in a table. | |
72 | Faults for which the entry in this table is 0 | |
73 | are not handled by KDB; the program's own trap handler | |
74 | gets to handle then. */ | |
75 | ||
76 | #define FAULT_CODE_ORIGIN 0 | |
77 | #define FAULT_CODE_UNITS 4 | |
78 | #define FAULT_TABLE \ | |
79 | { 0, SIGKILL, SIGSEGV, 0, 0, 0, 0, 0, \ | |
80 | 0, 0, SIGTRAP, SIGTRAP, 0, 0, 0, 0, \ | |
81 | 0, 0, 0, 0, 0, 0, 0, 0} | |
82 | ||
83 | /* Start running with a stack stretching from BEG to END. | |
84 | BEG and END should be symbols meaningful to the assembler. | |
85 | This is used only for kdb. */ | |
86 | ||
87 | #define INIT_STACK(beg, end) \ | |
88 | { asm (".globl end"); \ | |
89 | asm ("movl $ end, sp"); \ | |
90 | asm ("clrl fp"); } | |
91 | ||
92 | /* Push the frame pointer register on the stack. */ | |
93 | #define PUSH_FRAME_PTR \ | |
94 | asm ("pushl fp"); | |
95 | ||
96 | /* Copy the top-of-stack to the frame pointer register. */ | |
97 | #define POP_FRAME_PTR \ | |
98 | asm ("movl (sp), fp"); | |
99 | ||
100 | /* After KDB is entered by a fault, push all registers | |
101 | that GDB thinks about (all NUM_REGS of them), | |
102 | so that they appear in order of ascending GDB register number. | |
103 | The fault code will be on the stack beyond the last register. */ | |
104 | ||
105 | #define PUSH_REGISTERS \ | |
106 | { asm ("pushl 8(sp)"); \ | |
107 | asm ("pushl 8(sp)"); \ | |
108 | asm ("pushal 0x14(sp)"); \ | |
109 | asm ("pushr $037777"); } | |
110 | ||
111 | /* Assuming the registers (including processor status) have been | |
112 | pushed on the stack in order of ascending GDB register number, | |
113 | restore them and return to the address in the saved PC register. */ | |
114 | ||
115 | #define POP_REGISTERS \ | |
116 | { asm ("popr $037777"); \ | |
117 | asm ("subl2 $8,(sp)"); \ | |
118 | asm ("movl (sp),sp"); \ | |
119 | asm ("rei"); } | |
120 | #endif /* 0 */ |