1 |
106 |
markom |
/* OBSOLETE /* Definitions to make GDB target for a tahoe running 4.3-Reno. */
|
2 |
|
|
/* OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. */
|
3 |
|
|
/* OBSOLETE */
|
4 |
|
|
/* OBSOLETE This file is part of GDB. */
|
5 |
|
|
/* OBSOLETE */
|
6 |
|
|
/* OBSOLETE This program is free software; you can redistribute it and/or modify */
|
7 |
|
|
/* OBSOLETE it under the terms of the GNU General Public License as published by */
|
8 |
|
|
/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
|
9 |
|
|
/* OBSOLETE (at your option) any later version. */
|
10 |
|
|
/* OBSOLETE */
|
11 |
|
|
/* OBSOLETE This program is distributed in the hope that it will be useful, */
|
12 |
|
|
/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
13 |
|
|
/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
14 |
|
|
/* OBSOLETE GNU General Public License for more details. */
|
15 |
|
|
/* OBSOLETE */
|
16 |
|
|
/* OBSOLETE You should have received a copy of the GNU General Public License */
|
17 |
|
|
/* OBSOLETE along with this program; if not, write to the Free Software */
|
18 |
|
|
/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
|
19 |
|
|
/* OBSOLETE Boston, MA 02111-1307, USA. *x/ */
|
20 |
|
|
/* OBSOLETE */
|
21 |
|
|
/* OBSOLETE /* */
|
22 |
|
|
/* OBSOLETE * Ported by the State University of New York at Buffalo by the Distributed */
|
23 |
|
|
/* OBSOLETE * Computer Systems Lab, Department of Computer Science, 1991. */
|
24 |
|
|
/* OBSOLETE *x/ */
|
25 |
|
|
/* OBSOLETE */
|
26 |
|
|
/* OBSOLETE #define TARGET_BYTE_ORDER BIG_ENDIAN */
|
27 |
|
|
/* OBSOLETE #define BITS_BIG_ENDIAN 0 */
|
28 |
|
|
/* OBSOLETE */
|
29 |
|
|
/* OBSOLETE /* Offset from address of function to start of its code. */
|
30 |
|
|
/* OBSOLETE Zero on most machines. *x/ */
|
31 |
|
|
/* OBSOLETE */
|
32 |
|
|
/* OBSOLETE #define FUNCTION_START_OFFSET 2 */
|
33 |
|
|
/* OBSOLETE */
|
34 |
|
|
/* OBSOLETE /* Advance PC across any function entry prologue instructions */
|
35 |
|
|
/* OBSOLETE to reach some "real" code. *x/ */
|
36 |
|
|
/* OBSOLETE */
|
37 |
|
|
/* OBSOLETE extern CORE_ADDR tahoe_skip_prologue PARAMS ((CORE_ADDR)); */
|
38 |
|
|
/* OBSOLETE #define SKIP_PROLOGUE(pc) (tahoe_skip_prologue (pc)) */
|
39 |
|
|
/* OBSOLETE */
|
40 |
|
|
/* OBSOLETE /* Immediately after a function call, return the saved pc. */
|
41 |
|
|
/* OBSOLETE Can't always go through the frames for this because on some machines */
|
42 |
|
|
/* OBSOLETE the new frame is not set up until the new function executes */
|
43 |
|
|
/* OBSOLETE some instructions. *x/ */
|
44 |
|
|
/* OBSOLETE */
|
45 |
|
|
/* OBSOLETE #define SAVED_PC_AFTER_CALL(frame) FRAME_SAVED_PC(frame) */
|
46 |
|
|
/* OBSOLETE */
|
47 |
|
|
/* OBSOLETE /* Wrong for cross-debugging. I don't know the real values. *x/ */
|
48 |
|
|
/* OBSOLETE #include <machine/param.h> */
|
49 |
|
|
/* OBSOLETE #define TARGET_UPAGES UPAGES */
|
50 |
|
|
/* OBSOLETE #define TARGET_NBPG NBPG */
|
51 |
|
|
/* OBSOLETE */
|
52 |
|
|
/* OBSOLETE /* Address of end of stack space. *x/ */
|
53 |
|
|
/* OBSOLETE */
|
54 |
|
|
/* OBSOLETE #define STACK_END_ADDR (0xc0000000 - (TARGET_UPAGES * TARGET_NBPG)) */
|
55 |
|
|
/* OBSOLETE */
|
56 |
|
|
/* OBSOLETE /* On BSD, sigtramp is in the u area. Can't check the exact */
|
57 |
|
|
/* OBSOLETE addresses because for cross-debugging we don't have target include */
|
58 |
|
|
/* OBSOLETE files around. This should be close enough. *x/ */
|
59 |
|
|
/* OBSOLETE #define IN_SIGTRAMP(pc, name) ((pc) >= STACK_END_ADDR && (pc < 0xc0000000)) */
|
60 |
|
|
/* OBSOLETE */
|
61 |
|
|
/* OBSOLETE /* Stack grows downward. *x/ */
|
62 |
|
|
/* OBSOLETE */
|
63 |
|
|
/* OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) */
|
64 |
|
|
/* OBSOLETE */
|
65 |
|
|
/* OBSOLETE /* Sequence of bytes for breakpoint instruction. *x/ */
|
66 |
|
|
/* OBSOLETE */
|
67 |
|
|
/* OBSOLETE #define BREAKPOINT {0x30} */
|
68 |
|
|
/* OBSOLETE */
|
69 |
|
|
/* OBSOLETE /* Amount PC must be decremented by after a breakpoint. */
|
70 |
|
|
/* OBSOLETE This is often the number of bytes in BREAKPOINT */
|
71 |
|
|
/* OBSOLETE but not always. *x/ */
|
72 |
|
|
/* OBSOLETE */
|
73 |
|
|
/* OBSOLETE #define DECR_PC_AFTER_BREAK 0 */
|
74 |
|
|
/* OBSOLETE */
|
75 |
|
|
/* OBSOLETE /* Return 1 if P points to an invalid floating point value. */
|
76 |
|
|
/* OBSOLETE LEN is the length in bytes -- not relevant on the Tahoe. *x/ */
|
77 |
|
|
/* OBSOLETE */
|
78 |
|
|
/* OBSOLETE #define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000) */
|
79 |
|
|
/* OBSOLETE */
|
80 |
|
|
/* OBSOLETE /* Say how long (ordinary) registers are. This is a piece of bogosity */
|
81 |
|
|
/* OBSOLETE used in push_word and a few other places; REGISTER_RAW_SIZE is the */
|
82 |
|
|
/* OBSOLETE real way to know how big a register is. *x/ */
|
83 |
|
|
/* OBSOLETE */
|
84 |
|
|
/* OBSOLETE #define REGISTER_SIZE 4 */
|
85 |
|
|
/* OBSOLETE */
|
86 |
|
|
/* OBSOLETE /* Number of machine registers *x/ */
|
87 |
|
|
/* OBSOLETE */
|
88 |
|
|
/* OBSOLETE #define NUM_REGS 19 */
|
89 |
|
|
/* OBSOLETE */
|
90 |
|
|
/* OBSOLETE /* Initializer for an array of names of registers. */
|
91 |
|
|
/* OBSOLETE There should be NUM_REGS strings in this initializer. *x/ */
|
92 |
|
|
/* OBSOLETE */
|
93 |
|
|
/* OBSOLETE #define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "fp", "sp", "pc", "ps", "al", "ah"} */
|
94 |
|
|
/* OBSOLETE */
|
95 |
|
|
/* OBSOLETE #define FP_REGNUM 13 /* Contains address of executing stack frame *x/ */
|
96 |
|
|
/* OBSOLETE #define SP_REGNUM 14 /* Contains address of top of stack *x/ */
|
97 |
|
|
/* OBSOLETE #define PC_REGNUM 15 /* Contains program counter *x/ */
|
98 |
|
|
/* OBSOLETE #define PS_REGNUM 16 /* Contains processor status *x/ */
|
99 |
|
|
/* OBSOLETE */
|
100 |
|
|
/* OBSOLETE #define AL_REGNUM 17 /* Contains accumulator *x/ */
|
101 |
|
|
/* OBSOLETE #define AH_REGNUM 18 */
|
102 |
|
|
/* OBSOLETE */
|
103 |
|
|
/* OBSOLETE /* Total amount of space needed to store our copies of the machine's */
|
104 |
|
|
/* OBSOLETE register state, the array `registers'. *x/ */
|
105 |
|
|
/* OBSOLETE */
|
106 |
|
|
/* OBSOLETE #define REGISTER_BYTES (19*4) */
|
107 |
|
|
/* OBSOLETE */
|
108 |
|
|
/* OBSOLETE /* Index within `registers' of the first byte of the space for */
|
109 |
|
|
/* OBSOLETE register N. *x/ */
|
110 |
|
|
/* OBSOLETE */
|
111 |
|
|
/* OBSOLETE #define REGISTER_BYTE(N) ((N) * 4) */
|
112 |
|
|
/* OBSOLETE */
|
113 |
|
|
/* OBSOLETE /* Number of bytes of storage in the actual machine representation */
|
114 |
|
|
/* OBSOLETE for register N. On the tahoe, all regs are 4 bytes. *x/ */
|
115 |
|
|
/* OBSOLETE */
|
116 |
|
|
/* OBSOLETE #define REGISTER_RAW_SIZE(N) 4 */
|
117 |
|
|
/* OBSOLETE */
|
118 |
|
|
/* OBSOLETE /* Number of bytes of storage in the program's representation */
|
119 |
|
|
/* OBSOLETE for register N. On the tahoe, all regs are 4 bytes. *x/ */
|
120 |
|
|
/* OBSOLETE */
|
121 |
|
|
/* OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) 4 */
|
122 |
|
|
/* OBSOLETE */
|
123 |
|
|
/* OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. *x/ */
|
124 |
|
|
/* OBSOLETE */
|
125 |
|
|
/* OBSOLETE #define MAX_REGISTER_RAW_SIZE 4 */
|
126 |
|
|
/* OBSOLETE */
|
127 |
|
|
/* OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. *x/ */
|
128 |
|
|
/* OBSOLETE */
|
129 |
|
|
/* OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4 */
|
130 |
|
|
/* OBSOLETE */
|
131 |
|
|
/* OBSOLETE /* Return the GDB type object for the "standard" data type */
|
132 |
|
|
/* OBSOLETE of data in register N. *x/ */
|
133 |
|
|
/* OBSOLETE */
|
134 |
|
|
/* OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int */
|
135 |
|
|
/* OBSOLETE */
|
136 |
|
|
/* OBSOLETE /* Store the address of the place in which to copy the structure the */
|
137 |
|
|
/* OBSOLETE subroutine will return. This is called from call_function. *x/ */
|
138 |
|
|
/* OBSOLETE */
|
139 |
|
|
/* OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) \ */
|
140 |
|
|
/* OBSOLETE { write_register (1, (ADDR)); } */
|
141 |
|
|
/* OBSOLETE */
|
142 |
|
|
/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */
|
143 |
|
|
/* OBSOLETE a function return value of type TYPE, and copy that, in virtual format, */
|
144 |
|
|
/* OBSOLETE into VALBUF. *x/ */
|
145 |
|
|
/* OBSOLETE */
|
146 |
|
|
/* OBSOLETE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ */
|
147 |
|
|
/* OBSOLETE memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)) */
|
148 |
|
|
/* OBSOLETE */
|
149 |
|
|
/* OBSOLETE /* Write into appropriate registers a function return value */
|
150 |
|
|
/* OBSOLETE of type TYPE, given in virtual format. *x/ */
|
151 |
|
|
/* OBSOLETE */
|
152 |
|
|
/* OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ */
|
153 |
|
|
/* OBSOLETE write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) */
|
154 |
|
|
/* OBSOLETE */
|
155 |
|
|
/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */
|
156 |
|
|
/* OBSOLETE the address in which a function should return its structure value, */
|
157 |
|
|
/* OBSOLETE as a CORE_ADDR (or an expression that can be used as one). *x/ */
|
158 |
|
|
/* OBSOLETE */
|
159 |
|
|
/* OBSOLETE #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) */
|
160 |
|
|
/* OBSOLETE */
|
161 |
|
|
/* OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame */
|
162 |
|
|
/* OBSOLETE (its caller). */
|
163 |
|
|
/* OBSOLETE */
|
164 |
|
|
/* OBSOLETE FRAME_CHAIN takes a frame's nominal address */
|
165 |
|
|
/* OBSOLETE and produces the frame's chain-pointer. *x/ */
|
166 |
|
|
/* OBSOLETE */
|
167 |
|
|
/* OBSOLETE /* In the case of the Tahoe, the frame's nominal address is the FP value, */
|
168 |
|
|
/* OBSOLETE and it points to the old FP *x/ */
|
169 |
|
|
/* OBSOLETE */
|
170 |
|
|
/* OBSOLETE #define FRAME_CHAIN(thisframe) \ */
|
171 |
|
|
/* OBSOLETE (!inside_entry_file ((thisframe)->pc) ? \ */
|
172 |
|
|
/* OBSOLETE read_memory_integer ((thisframe)->frame, 4) :\ */
|
173 |
|
|
/* OBSOLETE 0) */
|
174 |
|
|
/* OBSOLETE */
|
175 |
|
|
/* OBSOLETE /* Define other aspects of the stack frame. *x/ */
|
176 |
|
|
/* OBSOLETE */
|
177 |
|
|
/* OBSOLETE /* Saved PC *x/ */
|
178 |
|
|
/* OBSOLETE */
|
179 |
|
|
/* OBSOLETE #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame - 8, 4)) */
|
180 |
|
|
/* OBSOLETE */
|
181 |
|
|
/* OBSOLETE /* In most of GDB, getting the args address is too important to */
|
182 |
|
|
/* OBSOLETE just say "I don't know". *x/ */
|
183 |
|
|
/* OBSOLETE */
|
184 |
|
|
/* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) */
|
185 |
|
|
/* OBSOLETE */
|
186 |
|
|
/* OBSOLETE /* Address to use as an anchor for finding local variables *x/ */
|
187 |
|
|
/* OBSOLETE */
|
188 |
|
|
/* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) */
|
189 |
|
|
/* OBSOLETE */
|
190 |
|
|
/* OBSOLETE /* Return number of args passed to a frame. */
|
191 |
|
|
/* OBSOLETE Can return -1, meaning no way to tell. *x/ */
|
192 |
|
|
/* OBSOLETE */
|
193 |
|
|
/* OBSOLETE extern int tahoe_frame_num_args PARAMS ((struct frame_info * fi)); */
|
194 |
|
|
/* OBSOLETE #define FRAME_NUM_ARGS(fi) (tahoe_frame_num_args ((fi))) */
|
195 |
|
|
/* OBSOLETE */
|
196 |
|
|
/* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
|
197 |
|
|
/* OBSOLETE */
|
198 |
|
|
/* OBSOLETE #define FRAME_ARGS_SKIP 0 */
|
199 |
|
|
/* OBSOLETE */
|
200 |
|
|
/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */
|
201 |
|
|
/* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */
|
202 |
|
|
/* OBSOLETE This includes special registers such as pc and fp saved in special */
|
203 |
|
|
/* OBSOLETE ways in the stack frame. sp is even more special: */
|
204 |
|
|
/* OBSOLETE the address we return for it IS the sp for the next frame. *x/ */
|
205 |
|
|
/* OBSOLETE */
|
206 |
|
|
/* OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ */
|
207 |
|
|
/* OBSOLETE { register int regnum; \ */
|
208 |
|
|
/* OBSOLETE register int rmask = read_memory_integer ((frame_info)->frame-4, 4) >> 16;\ */
|
209 |
|
|
/* OBSOLETE register CORE_ADDR next_addr; \ */
|
210 |
|
|
/* OBSOLETE memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \ */
|
211 |
|
|
/* OBSOLETE next_addr = (frame_info)->frame - 8; \ */
|
212 |
|
|
/* OBSOLETE for (regnum = 12; regnum >= 0; regnum--, rmask <<= 1) \ */
|
213 |
|
|
/* OBSOLETE (frame_saved_regs).regs[regnum] = (rmask & 0x1000) ? (next_addr -= 4) : 0;\ */
|
214 |
|
|
/* OBSOLETE (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 4; \ */
|
215 |
|
|
/* OBSOLETE (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame - 8; \ */
|
216 |
|
|
/* OBSOLETE (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \ */
|
217 |
|
|
/* OBSOLETE } */
|
218 |
|
|
/* OBSOLETE */
|
219 |
|
|
/* OBSOLETE /* Things needed for making the inferior call functions. *x/ */
|
220 |
|
|
/* OBSOLETE */
|
221 |
|
|
/* OBSOLETE /* Push an empty stack frame, to record the current PC, etc. *x/ */
|
222 |
|
|
/* OBSOLETE */
|
223 |
|
|
/* OBSOLETE #define PUSH_DUMMY_FRAME \ */
|
224 |
|
|
/* OBSOLETE { register CORE_ADDR sp = read_register (SP_REGNUM); \ */
|
225 |
|
|
/* OBSOLETE register int regnum; \ */
|
226 |
|
|
/* OBSOLETE printf("PUSH_DUMMY_FRAME\n"); \ */
|
227 |
|
|
/* OBSOLETE sp = push_word (sp, read_register (FP_REGNUM)); \ */
|
228 |
|
|
/* OBSOLETE write_register (FP_REGNUM, sp); \ */
|
229 |
|
|
/* OBSOLETE sp = push_word (sp, 0x1fff0004); /*SAVE MASK*x/ \ */
|
230 |
|
|
/* OBSOLETE sp = push_word (sp, read_register (PC_REGNUM)); \ */
|
231 |
|
|
/* OBSOLETE for (regnum = 12; regnum >= 0; regnum--) \ */
|
232 |
|
|
/* OBSOLETE sp = push_word (sp, read_register (regnum)); \ */
|
233 |
|
|
/* OBSOLETE write_register (SP_REGNUM, sp); \ */
|
234 |
|
|
/* OBSOLETE } */
|
235 |
|
|
/* OBSOLETE */
|
236 |
|
|
/* OBSOLETE /* Discard from the stack the innermost frame, restoring all registers. *x/ */
|
237 |
|
|
/* OBSOLETE */
|
238 |
|
|
/* OBSOLETE #define POP_FRAME \ */
|
239 |
|
|
/* OBSOLETE { register CORE_ADDR fp = read_register (FP_REGNUM); \ */
|
240 |
|
|
/* OBSOLETE register int regnum; \ */
|
241 |
|
|
/* OBSOLETE register int regmask = read_memory_integer (fp-4, 4); \ */
|
242 |
|
|
/* OBSOLETE printf("POP_FRAME\n"); \ */
|
243 |
|
|
/* OBSOLETE regmask >>= 16; \ */
|
244 |
|
|
/* OBSOLETE write_register (SP_REGNUM, fp+4); \ */
|
245 |
|
|
/* OBSOLETE write_register (PC_REGNUM, read_memory_integer(fp-8, 4)); \ */
|
246 |
|
|
/* OBSOLETE write_register (FP_REGNUM, read_memory_integer(fp, 4)); \ */
|
247 |
|
|
/* OBSOLETE fp -= 8; \ */
|
248 |
|
|
/* OBSOLETE for (regnum = 12; regnum >= 0; regnum--, regmask <<= 1) \ */
|
249 |
|
|
/* OBSOLETE if (regmask & 0x1000) \ */
|
250 |
|
|
/* OBSOLETE write_register (regnum, read_memory_integer (fp-=4, 4)); \ */
|
251 |
|
|
/* OBSOLETE flush_cached_frames (); \ */
|
252 |
|
|
/* OBSOLETE } */
|
253 |
|
|
/* OBSOLETE */
|
254 |
|
|
/* OBSOLETE /* This sequence of words is the instructions */
|
255 |
|
|
/* OBSOLETE calls #69, @#32323232 */
|
256 |
|
|
/* OBSOLETE bpt */
|
257 |
|
|
/* OBSOLETE Note this is 8 bytes. *x/ */
|
258 |
|
|
/* OBSOLETE */
|
259 |
|
|
/* OBSOLETE #define CALL_DUMMY {0xbf699f32, 0x32323230} */
|
260 |
|
|
/* OBSOLETE */
|
261 |
|
|
/* OBSOLETE /* Start execution at beginning of dummy *x/ */
|
262 |
|
|
/* OBSOLETE */
|
263 |
|
|
/* OBSOLETE #define CALL_DUMMY_START_OFFSET 0 */
|
264 |
|
|
/* OBSOLETE */
|
265 |
|
|
/* OBSOLETE /* Insert the specified number of args and function address */
|
266 |
|
|
/* OBSOLETE into a call sequence of the above form stored at DUMMYNAME. *x/ */
|
267 |
|
|
/* OBSOLETE */
|
268 |
|
|
/* OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, valtype, using_gcc) \ */
|
269 |
|
|
/* OBSOLETE { int temp = (int) fun; \ */
|
270 |
|
|
/* OBSOLETE *((char *) dummyname + 1) = nargs; \ */
|
271 |
|
|
/* OBSOLETE memcpy((char *)dummyname+3,&temp,4); } */
|