]>
Commit | Line | Data |
---|---|---|
9846de1b JM |
1 | /* OBSOLETE /* Definitions to make GDB run on a Pyramid under OSx 4.0 (4.2bsd). */ |
2 | /* OBSOLETE Copyright 1988, 1989, 1991, 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, Boston, MA 02111-1307, USA. *x/ */ | |
19 | /* OBSOLETE */ | |
20 | /* OBSOLETE #define TARGET_BYTE_ORDER BIG_ENDIAN */ | |
21 | /* OBSOLETE */ | |
22 | /* OBSOLETE /* Traditional Unix virtual address spaces have thre regions: text, */ | |
23 | /* OBSOLETE data and stack. The text, initialised data, and uninitialised data */ | |
24 | /* OBSOLETE are represented in separate segments of the a.out file. */ | |
25 | /* OBSOLETE When a process dumps core, the data and stack regions are written */ | |
26 | /* OBSOLETE to a core file. This gives a debugger enough information to */ | |
27 | /* OBSOLETE reconstruct (and debug) the virtual address space at the time of */ | |
28 | /* OBSOLETE the coredump. */ | |
29 | /* OBSOLETE Pyramids have an distinct fourth region of the virtual address */ | |
30 | /* OBSOLETE space, in which the contents of the windowed registers are stacked */ | |
31 | /* OBSOLETE in fixed-size frames. Pyramid refer to this region as the control */ | |
32 | /* OBSOLETE stack. Each call (or trap) automatically allocates a new register */ | |
33 | /* OBSOLETE frame; each return deallocates the current frame and restores the */ | |
34 | /* OBSOLETE windowed registers to their values before the call. */ | |
35 | /* OBSOLETE */ | |
36 | /* OBSOLETE When dumping core, the control stack is written to a core files as */ | |
37 | /* OBSOLETE a third segment. The core-handling functions need to know to deal */ | |
38 | /* OBSOLETE with it. *x/ */ | |
39 | /* OBSOLETE */ | |
40 | /* OBSOLETE /* Tell corefile.c there is an extra segment. *x/ */ | |
41 | /* OBSOLETE #define REG_STACK_SEGMENT */ | |
42 | /* OBSOLETE */ | |
43 | /* OBSOLETE /* Floating point is IEEE compatible on most Pyramid hardware */ | |
44 | /* OBSOLETE (Older processors do not have IEEE NaNs). *x/ */ | |
45 | /* OBSOLETE #define IEEE_FLOAT */ | |
46 | /* OBSOLETE */ | |
47 | /* OBSOLETE /* Offset from address of function to start of its code. */ | |
48 | /* OBSOLETE Zero on most machines. *x/ */ | |
49 | /* OBSOLETE */ | |
50 | /* OBSOLETE #define FUNCTION_START_OFFSET 0 */ | |
51 | /* OBSOLETE */ | |
52 | /* OBSOLETE /* Advance PC across any function entry prologue instructions */ | |
53 | /* OBSOLETE to reach some "real" code. *x/ */ | |
54 | /* OBSOLETE */ | |
55 | /* OBSOLETE /* FIXME -- do we want to skip insns to allocate the local frame? */ | |
56 | /* OBSOLETE If so, what do they look like? */ | |
57 | /* OBSOLETE This is becoming harder, since tege@sics.SE wants to change */ | |
58 | /* OBSOLETE gcc to not output a prologue when no frame is needed. *x/ */ | |
59 | /* OBSOLETE #define SKIP_PROLOGUE(pc) (pc) */ | |
60 | /* OBSOLETE */ | |
61 | /* OBSOLETE */ | |
62 | /* OBSOLETE /* Immediately after a function call, return the saved pc. */ | |
63 | /* OBSOLETE Can't always go through the frames for this because on some machines */ | |
64 | /* OBSOLETE the new frame is not set up until the new function executes */ | |
65 | /* OBSOLETE some instructions. *x/ */ | |
66 | /* OBSOLETE */ | |
67 | /* OBSOLETE #define SAVED_PC_AFTER_CALL(frame) FRAME_SAVED_PC(frame) */ | |
68 | /* OBSOLETE */ | |
69 | /* OBSOLETE /* Address of end of stack space. *x/ */ | |
70 | /* OBSOLETE /* This seems to be right for the 90x comp.vuw.ac.nz. */ | |
71 | /* OBSOLETE The correct value at any site may be a function of the configured */ | |
72 | /* OBSOLETE maximum control stack depth. If so, I don't know where the */ | |
73 | /* OBSOLETE control-stack depth is configured, so I can't #include it here. *x/ */ | |
74 | /* OBSOLETE #define STACK_END_ADDR (0xc00cc000) */ | |
75 | /* OBSOLETE */ | |
76 | /* OBSOLETE /* Register window stack (Control stack) stack definitions */ | |
77 | /* OBSOLETE - Address of beginning of control stack. */ | |
78 | /* OBSOLETE - size of control stack frame */ | |
79 | /* OBSOLETE (Note that since crts0 is usually the first function called, */ | |
80 | /* OBSOLETE main()'s control stack is one frame (0x80 bytes) beyond this value. *x/ */ | |
81 | /* OBSOLETE */ | |
82 | /* OBSOLETE #define CONTROL_STACK_ADDR (0xc00cd000) */ | |
83 | /* OBSOLETE */ | |
84 | /* OBSOLETE /* Bytes in a register window -- 16 parameter regs, 16 local regs */ | |
85 | /* OBSOLETE for each call, is 32 regs * 4 bytes *x/ */ | |
86 | /* OBSOLETE */ | |
87 | /* OBSOLETE #define CONTROL_STACK_FRAME_SIZE (32*4) */ | |
88 | /* OBSOLETE */ | |
89 | /* OBSOLETE /* FIXME. On a pyr, Data Stack grows downward; control stack goes upwards. */ | |
90 | /* OBSOLETE Which direction should we use for INNER_THAN, PC_INNER_THAN ?? *x/ */ | |
91 | /* OBSOLETE */ | |
92 | /* OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) */ | |
93 | /* OBSOLETE */ | |
94 | /* OBSOLETE /* Stack must be aligned on 32-bit boundaries when synthesizing */ | |
95 | /* OBSOLETE function calls. *x/ */ | |
96 | /* OBSOLETE */ | |
97 | /* OBSOLETE #define STACK_ALIGN(ADDR) (((ADDR) + 3) & -4) */ | |
98 | /* OBSOLETE */ | |
99 | /* OBSOLETE /* Sequence of bytes for breakpoint instruction. *x/ */ | |
100 | /* OBSOLETE */ | |
101 | /* OBSOLETE #define BREAKPOINT {0xf0, 00, 00, 00} */ | |
102 | /* OBSOLETE */ | |
103 | /* OBSOLETE /* Amount PC must be decremented by after a breakpoint. */ | |
104 | /* OBSOLETE This is often the number of bytes in BREAKPOINT */ | |
105 | /* OBSOLETE but not always. *x/ */ | |
106 | /* OBSOLETE */ | |
107 | /* OBSOLETE #define DECR_PC_AFTER_BREAK 0 */ | |
108 | /* OBSOLETE */ | |
109 | /* OBSOLETE /* Say how long (ordinary) registers are. This is a piece of bogosity */ | |
110 | /* OBSOLETE used in push_word and a few other places; REGISTER_RAW_SIZE is the */ | |
111 | /* OBSOLETE real way to know how big a register is. *x/ */ | |
112 | /* OBSOLETE */ | |
113 | /* OBSOLETE #define REGISTER_SIZE 4 */ | |
114 | /* OBSOLETE */ | |
115 | /* OBSOLETE /* Number of machine registers *x/ */ | |
116 | /* OBSOLETE /* pyramids have 64, plus one for the PSW; plus perhaps one more for the */ | |
117 | /* OBSOLETE kernel stack pointer (ksp) and control-stack pointer (CSP) *x/ */ | |
118 | /* OBSOLETE */ | |
119 | /* OBSOLETE #define NUM_REGS 67 */ | |
120 | /* OBSOLETE */ | |
121 | /* OBSOLETE /* Initializer for an array of names of registers. */ | |
122 | /* OBSOLETE There should be NUM_REGS strings in this initializer. *x/ */ | |
123 | /* OBSOLETE */ | |
124 | /* OBSOLETE #define REGISTER_NAMES \ */ | |
125 | /* OBSOLETE {"gr0", "gr1", "gr2", "gr3", "gr4", "gr5", "gr6", "gr7", \ */ | |
126 | /* OBSOLETE "gr8", "gr9", "gr10", "gr11", "logpsw", "cfp", "sp", "pc", \ */ | |
127 | /* OBSOLETE "pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7", \ */ | |
128 | /* OBSOLETE "pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15", \ */ | |
129 | /* OBSOLETE "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", \ */ | |
130 | /* OBSOLETE "lr8", "lr9", "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", \ */ | |
131 | /* OBSOLETE "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", \ */ | |
132 | /* OBSOLETE "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15", \ */ | |
133 | /* OBSOLETE "psw", "ksp", "csp"} */ | |
134 | /* OBSOLETE */ | |
135 | /* OBSOLETE /* Register numbers of various important registers. */ | |
136 | /* OBSOLETE Note that some of these values are "real" register numbers, */ | |
137 | /* OBSOLETE and correspond to the general registers of the machine, */ | |
138 | /* OBSOLETE and some are "phony" register numbers which are too large */ | |
139 | /* OBSOLETE to be actual register numbers as far as the user is concerned */ | |
140 | /* OBSOLETE but do serve to get the desired values when passed to read_register. *x/ */ | |
141 | /* OBSOLETE */ | |
142 | /* OBSOLETE /* pseudo-registers: *x/ */ | |
c5aa993b JM |
143 | /* OBSOLETE #define PS_REGNUM 64 /* Contains processor status *x/ */ |
144 | /* OBSOLETE #define PSW_REGNUM 64 /* Contains current psw, whatever it is.*x/ */ | |
145 | /* OBSOLETE #define CSP_REGNUM 65 /* address of this control stack frame*x/ */ | |
146 | /* OBSOLETE #define KSP_REGNUM 66 /* Contains process's Kernel Stack Pointer *x/ */ | |
9846de1b | 147 | /* OBSOLETE */ |
c5aa993b JM |
148 | /* OBSOLETE #define CFP_REGNUM 13 /* Current data-stack frame ptr *x/ */ |
149 | /* OBSOLETE #define TR0_REGNUM 48 /* After function call, contains */ | |
150 | /* OBSOLETE function result *x/ */ | |
9846de1b JM |
151 | /* OBSOLETE */ |
152 | /* OBSOLETE /* Registers interesting to the machine-independent part of gdb*x/ */ | |
153 | /* OBSOLETE */ | |
c5aa993b JM |
154 | /* OBSOLETE #define FP_REGNUM CSP_REGNUM /* Contains address of executing (control) */ |
155 | /* OBSOLETE stack frame *x/ */ | |
156 | /* OBSOLETE #define SP_REGNUM 14 /* Contains address of top of stack -??*x/ */ | |
157 | /* OBSOLETE #define PC_REGNUM 15 /* Contains program counter *x/ */ | |
9846de1b JM |
158 | /* OBSOLETE */ |
159 | /* OBSOLETE /* Define DO_REGISTERS_INFO() to do machine-specific formatting */ | |
160 | /* OBSOLETE of register dumps. *x/ */ | |
161 | /* OBSOLETE */ | |
162 | /* OBSOLETE #define DO_REGISTERS_INFO(_regnum, fp) pyr_do_registers_info(_regnum, fp) */ | |
163 | /* OBSOLETE */ | |
164 | /* OBSOLETE /* need this so we can find the global registers: they never get saved. *x/ */ | |
165 | /* OBSOLETE extern unsigned int global_reg_offset; */ | |
166 | /* OBSOLETE extern unsigned int last_frame_offset; */ | |
167 | /* OBSOLETE */ | |
168 | /* OBSOLETE /* Total amount of space needed to store our copies of the machine's */ | |
169 | /* OBSOLETE register state, the array `registers'. *x/ */ | |
170 | /* OBSOLETE #define REGISTER_BYTES (NUM_REGS*4) */ | |
171 | /* OBSOLETE */ | |
172 | /* OBSOLETE /* the Pyramid has register windows. *x/ */ | |
173 | /* OBSOLETE */ | |
174 | /* OBSOLETE #define HAVE_REGISTER_WINDOWS */ | |
175 | /* OBSOLETE */ | |
176 | /* OBSOLETE /* Is this register part of the register window system? A yes answer */ | |
177 | /* OBSOLETE implies that 1) The name of this register will not be the same in */ | |
178 | /* OBSOLETE other frames, and 2) This register is automatically "saved" (out */ | |
179 | /* OBSOLETE registers shifting into ins counts) upon subroutine calls and thus */ | |
180 | /* OBSOLETE there is no need to search more than one stack frame for it. *x/ */ | |
181 | /* OBSOLETE */ | |
c5aa993b | 182 | /* OBSOLETE #define REGISTER_IN_WINDOW_P(regnum) \ */ |
9846de1b JM |
183 | /* OBSOLETE ((regnum) >= 16 && (regnum) < 64) */ |
184 | /* OBSOLETE */ | |
185 | /* OBSOLETE /* Index within `registers' of the first byte of the space for */ | |
186 | /* OBSOLETE register N. *x/ */ | |
187 | /* OBSOLETE */ | |
188 | /* OBSOLETE #define REGISTER_BYTE(N) ((N) * 4) */ | |
189 | /* OBSOLETE */ | |
190 | /* OBSOLETE /* Number of bytes of storage in the actual machine representation */ | |
191 | /* OBSOLETE for register N. On the Pyramid, all regs are 4 bytes. *x/ */ | |
192 | /* OBSOLETE */ | |
193 | /* OBSOLETE #define REGISTER_RAW_SIZE(N) 4 */ | |
194 | /* OBSOLETE */ | |
195 | /* OBSOLETE /* Number of bytes of storage in the program's representation */ | |
196 | /* OBSOLETE for register N. On the Pyramid, all regs are 4 bytes. *x/ */ | |
197 | /* OBSOLETE */ | |
198 | /* OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) 4 */ | |
199 | /* OBSOLETE */ | |
200 | /* OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. *x/ */ | |
201 | /* OBSOLETE */ | |
202 | /* OBSOLETE #define MAX_REGISTER_RAW_SIZE 4 */ | |
203 | /* OBSOLETE */ | |
204 | /* OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. *x/ */ | |
205 | /* OBSOLETE */ | |
206 | /* OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4 */ | |
207 | /* OBSOLETE */ | |
208 | /* OBSOLETE /* Return the GDB type object for the "standard" data type */ | |
209 | /* OBSOLETE of data in register N. *x/ */ | |
210 | /* OBSOLETE */ | |
211 | /* OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int */ | |
212 | /* OBSOLETE */ | |
213 | /* OBSOLETE /* FIXME: It seems impossible for both EXTRACT_RETURN_VALUE and */ | |
214 | /* OBSOLETE STORE_RETURN_VALUE to be correct. *x/ */ | |
215 | /* OBSOLETE */ | |
216 | /* OBSOLETE /* Store the address of the place in which to copy the structure the */ | |
217 | /* OBSOLETE subroutine will return. This is called from call_function. *x/ */ | |
218 | /* OBSOLETE */ | |
219 | /* OBSOLETE /****FIXME****x/ */ | |
220 | /* OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) \ */ | |
221 | /* OBSOLETE { write_register (TR0_REGNUM, (ADDR)); } */ | |
222 | /* OBSOLETE */ | |
223 | /* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ | |
224 | /* OBSOLETE a function return value of type TYPE, and copy that, in virtual format, */ | |
225 | /* OBSOLETE into VALBUF. *x/ */ | |
226 | /* OBSOLETE */ | |
227 | /* OBSOLETE /* Note that on a register-windowing machine (eg, Pyr, SPARC), this is */ | |
228 | /* OBSOLETE where the value is found after the function call -- ie, it should */ | |
229 | /* OBSOLETE correspond to GNU CC's FUNCTION_VALUE rather than FUNCTION_OUTGOING_VALUE.*x/ */ | |
230 | /* OBSOLETE */ | |
231 | /* OBSOLETE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ */ | |
232 | /* OBSOLETE memcpy (VALBUF, ((int *)(REGBUF))+TR0_REGNUM, TYPE_LENGTH (TYPE)) */ | |
233 | /* OBSOLETE */ | |
234 | /* OBSOLETE /* Write into appropriate registers a function return value */ | |
235 | /* OBSOLETE of type TYPE, given in virtual format. *x/ */ | |
236 | /* OBSOLETE /* on pyrs, values are returned in *x/ */ | |
237 | /* OBSOLETE */ | |
238 | /* OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ */ | |
239 | /* OBSOLETE write_register_bytes (REGISTER_BYTE(TR0_REGNUM), VALBUF, TYPE_LENGTH (TYPE)) */ | |
240 | /* OBSOLETE */ | |
241 | /* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ | |
242 | /* OBSOLETE the address in which a function should return its structure value, */ | |
243 | /* OBSOLETE as a CORE_ADDR (or an expression that can be used as one). *x/ */ | |
244 | /* OBSOLETE /* FIXME *x/ */ | |
245 | /* OBSOLETE #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ */ | |
246 | /* OBSOLETE ( ((int *)(REGBUF)) [TR0_REGNUM]) */ | |
247 | /* OBSOLETE */ | |
248 | /* OBSOLETE \f */ | |
249 | /* OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame */ | |
250 | /* OBSOLETE (its caller). *x/ */ | |
251 | /* OBSOLETE */ | |
252 | /* OBSOLETE #define EXTRA_FRAME_INFO \ */ | |
c5aa993b JM |
253 | /* OBSOLETE CORE_ADDR bottom; \ */ |
254 | /* OBSOLETE CORE_ADDR frame_cfp; \ */ | |
255 | /* OBSOLETE CORE_ADDR frame_window_addr; */ | |
9846de1b JM |
256 | /* OBSOLETE */ |
257 | /* OBSOLETE /* The bottom field is misnamed, since it might imply that memory from */ | |
258 | /* OBSOLETE bottom to frame contains this frame. That need not be true if */ | |
259 | /* OBSOLETE stack frames are allocated in different segments (e.g. some on a */ | |
260 | /* OBSOLETE stack, some on a heap in the data segment). *x/ */ | |
261 | /* OBSOLETE */ | |
262 | /* OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ */ | |
c5aa993b JM |
263 | /* OBSOLETE do { \ */ |
264 | /* OBSOLETE (fci)->frame_window_addr = (fci)->frame; \ */ | |
265 | /* OBSOLETE (fci)->bottom = \ */ | |
266 | /* OBSOLETE ((fci)->next ? \ */ | |
267 | /* OBSOLETE ((fci)->frame == (fci)->next->frame ? \ */ | |
268 | /* OBSOLETE (fci)->next->bottom : (fci)->next->frame) : \ */ | |
269 | /* OBSOLETE read_register (SP_REGNUM)); \ */ | |
270 | /* OBSOLETE (fci)->frame_cfp = \ */ | |
271 | /* OBSOLETE read_register (CFP_REGNUM); \ */ | |
272 | /* OBSOLETE /***fprintf (stderr, \ */ | |
273 | /* OBSOLETE "[[creating new frame for %0x,pc=%0x,csp=%0x]]\n", \ */ | |
274 | /* OBSOLETE (fci)->frame, (fci)->pc,(fci)->frame_cfp);*x/ \ */ | |
9846de1b JM |
275 | /* OBSOLETE } while (0); */ |
276 | /* OBSOLETE */ | |
277 | /* OBSOLETE /* FRAME_CHAIN takes a frame's nominal address */ | |
278 | /* OBSOLETE and produces the frame's chain-pointer. *x/ */ | |
279 | /* OBSOLETE */ | |
280 | /* OBSOLETE /* In the case of the pyr, the frame's nominal address is the address */ | |
281 | /* OBSOLETE of parameter register 0. The previous frame is found 32 words up. *x/ */ | |
282 | /* OBSOLETE */ | |
c5aa993b | 283 | /* OBSOLETE #define FRAME_CHAIN(thisframe) \ */ |
9846de1b JM |
284 | /* OBSOLETE ( (thisframe) -> frame - CONTROL_STACK_FRAME_SIZE) */ |
285 | /* OBSOLETE */ | |
286 | /* OBSOLETE /*((thisframe) >= CONTROL_STACK_ADDR))*x/ */ | |
287 | /* OBSOLETE */ | |
288 | /* OBSOLETE /* Define other aspects of the stack frame. *x/ */ | |
289 | /* OBSOLETE */ | |
290 | /* OBSOLETE /* A macro that tells us whether the function invocation represented */ | |
291 | /* OBSOLETE by FI does not have a frame on the stack associated with it. If it */ | |
292 | /* OBSOLETE does not, FRAMELESS is set to 1, else 0. */ | |
293 | /* OBSOLETE */ | |
294 | /* OBSOLETE I do not understand what this means on a Pyramid, where functions */ | |
295 | /* OBSOLETE *always* have a control-stack frame, but may or may not have a */ | |
296 | /* OBSOLETE frame on the data stack. Since GBD uses the value of the */ | |
297 | /* OBSOLETE control stack pointer as its "address" of a frame, FRAMELESS */ | |
298 | /* OBSOLETE is always 1, so does not need to be defined. *x/ */ | |
299 | /* OBSOLETE */ | |
300 | /* OBSOLETE */ | |
301 | /* OBSOLETE /* Where is the PC for a specific frame *x/ */ | |
302 | /* OBSOLETE */ | |
303 | /* OBSOLETE #define FRAME_SAVED_PC(fi) \ */ | |
304 | /* OBSOLETE ((CORE_ADDR) (read_memory_integer ( (fi) -> frame + 60, 4))) */ | |
305 | /* OBSOLETE */ | |
306 | /* OBSOLETE /* There may be bugs in FRAME_ARGS_ADDRESS and FRAME_LOCALS_ADDRESS; */ | |
307 | /* OBSOLETE or there may be bugs in accessing the registers that break */ | |
308 | /* OBSOLETE their definitions. */ | |
309 | /* OBSOLETE Having the macros expand into functions makes them easier to debug. */ | |
310 | /* OBSOLETE When the bug is finally located, the inline macro defintions can */ | |
311 | /* OBSOLETE be un-#if 0ed, and frame_args_addr and frame_locals_address can */ | |
312 | /* OBSOLETE be deleted from pyr-dep.c *x/ */ | |
313 | /* OBSOLETE */ | |
314 | /* OBSOLETE /* If the argument is on the stack, it will be here. *x/ */ | |
315 | /* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) \ */ | |
316 | /* OBSOLETE frame_args_addr(fi) */ | |
317 | /* OBSOLETE */ | |
318 | /* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) \ */ | |
319 | /* OBSOLETE frame_locals_address(fi) */ | |
320 | /* OBSOLETE */ | |
321 | /* OBSOLETE /* The following definitions doesn't seem to work. */ | |
322 | /* OBSOLETE I don't understand why. *x/ */ | |
323 | /* OBSOLETE #if 0 */ | |
324 | /* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) \ */ | |
325 | /* OBSOLETE /*(FRAME_FP(fi) + (13*4))*x/ (read_register (CFP_REGNUM)) */ | |
326 | /* OBSOLETE */ | |
327 | /* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) \ */ | |
328 | /* OBSOLETE ((fi)->frame +(16*4)) */ | |
329 | /* OBSOLETE */ | |
330 | /* OBSOLETE #endif /* 0 *x/ */ | |
331 | /* OBSOLETE */ | |
332 | /* OBSOLETE /* Return number of args passed to a frame. */ | |
333 | /* OBSOLETE Can return -1, meaning no way to tell. *x/ */ | |
334 | /* OBSOLETE */ | |
335 | /* OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) */ | |
336 | /* OBSOLETE */ | |
337 | /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */ | |
338 | /* OBSOLETE */ | |
339 | /* OBSOLETE #define FRAME_ARGS_SKIP 0 */ | |
340 | /* OBSOLETE */ | |
341 | /* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */ | |
342 | /* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */ | |
343 | /* OBSOLETE This includes special registers such as pc and fp saved in special */ | |
344 | /* OBSOLETE ways in the stack frame. sp is even more special: */ | |
345 | /* OBSOLETE the address we return for it IS the sp for the next frame. */ | |
346 | /* OBSOLETE */ | |
347 | /* OBSOLETE Note that on register window machines, we are currently making the */ | |
348 | /* OBSOLETE assumption that window registers are being saved somewhere in the */ | |
349 | /* OBSOLETE frame in which they are being used. If they are stored in an */ | |
350 | /* OBSOLETE inferior frame, find_saved_register will break. */ | |
351 | /* OBSOLETE */ | |
352 | /* OBSOLETE On pyrs, frames of window registers are stored contiguously on a */ | |
353 | /* OBSOLETE separate stack. All window registers are always stored. */ | |
354 | /* OBSOLETE The pc and psw (gr15 and gr14) are also always saved: the call */ | |
355 | /* OBSOLETE insn saves them in pr15 and pr14 of the new frame (tr15,tr14 of the */ | |
356 | /* OBSOLETE old frame). */ | |
357 | /* OBSOLETE The data-stack frame pointer (CFP) is only saved in functions which */ | |
358 | /* OBSOLETE allocate a (data)stack frame (with "adsf"). We detect them by */ | |
359 | /* OBSOLETE looking at the first insn of the procedure. */ | |
360 | /* OBSOLETE */ | |
361 | /* OBSOLETE Other non-window registers (gr0-gr11) are never saved. Pyramid's C */ | |
362 | /* OBSOLETE compiler and gcc currently ignore them, so it's not an issue. *x/ */ | |
363 | /* OBSOLETE */ | |
364 | /* OBSOLETE #define FRAME_FIND_SAVED_REGS(fi_p, frame_saved_regs) \ */ | |
c5aa993b JM |
365 | /* OBSOLETE { register int regnum; \ */ |
366 | /* OBSOLETE register CORE_ADDR pc; \ */ | |
367 | /* OBSOLETE register CORE_ADDR fn_start_pc; \ */ | |
368 | /* OBSOLETE register int first_insn; \ */ | |
369 | /* OBSOLETE register CORE_ADDR prev_cf_addr; \ */ | |
370 | /* OBSOLETE register int window_ptr; \ */ | |
371 | /* OBSOLETE if (!fi_p) fatal ("Bad frame info struct in FRAME_FIND_SAVED_REGS"); \ */ | |
372 | /* OBSOLETE memset (&(frame_saved_regs), '\0', sizeof (frame_saved_regs)); \ */ | |
373 | /* OBSOLETE \ */ | |
374 | /* OBSOLETE window_ptr = prev_cf_addr = FRAME_FP(fi_p); \ */ | |
375 | /* OBSOLETE \ */ | |
376 | /* OBSOLETE for (regnum = 16 ; regnum < 64; regnum++,window_ptr+=4) \ */ | |
377 | /* OBSOLETE { \ */ | |
378 | /* OBSOLETE (frame_saved_regs).regs[regnum] = window_ptr; \ */ | |
379 | /* OBSOLETE } \ */ | |
380 | /* OBSOLETE \ */ | |
381 | /* OBSOLETE /* In each window, psw, and pc are "saved" in tr14,tr15. *x/ \ */ | |
382 | /* OBSOLETE /*** psw is sometimes saved in gr12 (so sez <sys/pcb.h>) *x/ \ */ | |
383 | /* OBSOLETE (frame_saved_regs).regs[PS_REGNUM] = FRAME_FP(fi_p) + (14*4); \ */ | |
384 | /* OBSOLETE \ */ | |
385 | /* OBSOLETE /*(frame_saved_regs).regs[PC_REGNUM] = (frame_saved_regs).regs[31];*x/ \ */ | |
386 | /* OBSOLETE (frame_saved_regs).regs[PC_REGNUM] = FRAME_FP(fi_p) + ((15+32)*4); \ */ | |
387 | /* OBSOLETE \ */ | |
388 | /* OBSOLETE /* Functions that allocate a frame save sp *where*? *x/ \ */ | |
9846de1b | 389 | /* OBSOLETE /*first_insn = read_memory_integer (get_pc_function_start ((fi_p)->pc),4); *x/ \ */ |
c5aa993b JM |
390 | /* OBSOLETE \ */ |
391 | /* OBSOLETE fn_start_pc = (get_pc_function_start ((fi_p)->pc)); \ */ | |
392 | /* OBSOLETE first_insn = read_memory_integer(fn_start_pc, 4); \ */ | |
393 | /* OBSOLETE \ */ | |
394 | /* OBSOLETE if (0x08 == ((first_insn >> 20) &0x0ff)) { \ */ | |
395 | /* OBSOLETE /* NB: because WINDOW_REGISTER_P(cfp) is false, a saved cfp \ */ | |
396 | /* OBSOLETE in this frame is only visible in this frame's callers. \ */ | |
397 | /* OBSOLETE That means the cfp we mark saved is my caller's cfp, ie pr13. \ */ | |
398 | /* OBSOLETE I don't understand why we don't have to do that for pc, too. *x/ \ */ | |
399 | /* OBSOLETE \ */ | |
400 | /* OBSOLETE (frame_saved_regs).regs[CFP_REGNUM] = FRAME_FP(fi_p)+(13*4); \ */ | |
401 | /* OBSOLETE \ */ | |
402 | /* OBSOLETE (frame_saved_regs).regs[SP_REGNUM] = \ */ | |
403 | /* OBSOLETE read_memory_integer (FRAME_FP(fi_p)+((13+32)*4),4); \ */ | |
404 | /* OBSOLETE } \ */ | |
405 | /* OBSOLETE \ */ | |
406 | /* OBSOLETE /* \ */ | |
407 | /* OBSOLETE *(frame_saved_regs).regs[CFP_REGNUM] = (frame_saved_regs).regs[61]; \ */ | |
408 | /* OBSOLETE * (frame_saved_regs).regs[SP_REGNUM] = \ */ | |
409 | /* OBSOLETE * read_memory_integer (FRAME_FP(fi_p)+((13+32)*4),4); \ */ | |
410 | /* OBSOLETE *x/ \ */ | |
411 | /* OBSOLETE \ */ | |
412 | /* OBSOLETE (frame_saved_regs).regs[CSP_REGNUM] = prev_cf_addr; \ */ | |
9846de1b JM |
413 | /* OBSOLETE } */ |
414 | /* OBSOLETE \f */ | |
415 | /* OBSOLETE /* Things needed for making the inferior call functions. *x/ */ | |
416 | /* OBSOLETE #if 0 */ | |
417 | /* OBSOLETE /* These are all lies. These macro definitions are appropriate for a */ | |
418 | /* OBSOLETE SPARC. On a pyramid, pushing a dummy frame will */ | |
419 | /* OBSOLETE surely involve writing the control stack pointer, */ | |
420 | /* OBSOLETE then saving the pc. This requires a privileged instruction. */ | |
421 | /* OBSOLETE Maybe one day Pyramid can be persuaded to add a syscall to do this. */ | |
422 | /* OBSOLETE Until then, we are out of luck. *x/ */ | |
423 | /* OBSOLETE */ | |
424 | /* OBSOLETE /* Push an empty stack frame, to record the current PC, etc. *x/ */ | |
425 | /* OBSOLETE */ | |
426 | /* OBSOLETE #define PUSH_DUMMY_FRAME \ */ | |
427 | /* OBSOLETE { register CORE_ADDR sp = read_register (SP_REGNUM);\ */ | |
c5aa993b JM |
428 | /* OBSOLETE register int regnum; \ */ |
429 | /* OBSOLETE sp = push_word (sp, 0); /* arglist *x/ \ */ | |
430 | /* OBSOLETE for (regnum = 11; regnum >= 0; regnum--) \ */ | |
9846de1b JM |
431 | /* OBSOLETE sp = push_word (sp, read_register (regnum)); \ */ |
432 | /* OBSOLETE sp = push_word (sp, read_register (PC_REGNUM)); \ */ | |
433 | /* OBSOLETE sp = push_word (sp, read_register (FP_REGNUM)); \ */ | |
434 | /* OBSOLETE /* sp = push_word (sp, read_register (AP_REGNUM));*x/ \ */ | |
435 | /* OBSOLETE sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) \ */ | |
c5aa993b JM |
436 | /* OBSOLETE + 0x2fff0000); \ */ |
437 | /* OBSOLETE sp = push_word (sp, 0); \ */ | |
438 | /* OBSOLETE write_register (SP_REGNUM, sp); \ */ | |
439 | /* OBSOLETE write_register (FP_REGNUM, sp); \ */ | |
9846de1b JM |
440 | /* OBSOLETE /* write_register (AP_REGNUM, sp + 17 * sizeof (int));*x/ } */ |
441 | /* OBSOLETE */ | |
442 | /* OBSOLETE /* Discard from the stack the innermost frame, restoring all registers. *x/ */ | |
443 | /* OBSOLETE */ | |
444 | /* OBSOLETE #define POP_FRAME \ */ | |
c5aa993b JM |
445 | /* OBSOLETE { register CORE_ADDR fp = read_register (FP_REGNUM); \ */ |
446 | /* OBSOLETE register int regnum; \ */ | |
447 | /* OBSOLETE register int regmask = read_memory_integer (fp + 4, 4); \ */ | |
448 | /* OBSOLETE write_register (PS_REGNUM, \ */ | |
449 | /* OBSOLETE (regmask & 0xffff) \ */ | |
450 | /* OBSOLETE | (read_register (PS_REGNUM) & 0xffff0000)); \ */ | |
9846de1b JM |
451 | /* OBSOLETE write_register (PC_REGNUM, read_memory_integer (fp + 16, 4)); \ */ |
452 | /* OBSOLETE write_register (FP_REGNUM, read_memory_integer (fp + 12, 4)); \ */ | |
453 | /* OBSOLETE /* write_register (AP_REGNUM, read_memory_integer (fp + 8, 4));*x/ \ */ | |
c5aa993b JM |
454 | /* OBSOLETE fp += 16; \ */ |
455 | /* OBSOLETE for (regnum = 0; regnum < 12; regnum++) \ */ | |
456 | /* OBSOLETE if (regmask & (0x10000 << regnum)) \ */ | |
9846de1b | 457 | /* OBSOLETE write_register (regnum, read_memory_integer (fp += 4, 4)); \ */ |
c5aa993b JM |
458 | /* OBSOLETE fp = fp + 4 + ((regmask >> 30) & 3); \ */ |
459 | /* OBSOLETE if (regmask & 0x20000000) \ */ | |
460 | /* OBSOLETE { regnum = read_memory_integer (fp, 4); \ */ | |
461 | /* OBSOLETE fp += (regnum + 1) * 4; } \ */ | |
462 | /* OBSOLETE write_register (SP_REGNUM, fp); \ */ | |
9846de1b JM |
463 | /* OBSOLETE set_current_frame (read_register (FP_REGNUM)); } */ |
464 | /* OBSOLETE */ | |
465 | /* OBSOLETE /* This sequence of words is the instructions */ | |
466 | /* OBSOLETE calls #69, @#32323232 */ | |
467 | /* OBSOLETE bpt */ | |
468 | /* OBSOLETE Note this is 8 bytes. *x/ */ | |
469 | /* OBSOLETE */ | |
470 | /* OBSOLETE #define CALL_DUMMY {0x329f69fb, 0x03323232} */ | |
471 | /* OBSOLETE */ | |
472 | /* OBSOLETE #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy *x/ */ | |
473 | /* OBSOLETE */ | |
474 | /* OBSOLETE /* Insert the specified number of args and function address */ | |
475 | /* OBSOLETE into a call sequence of the above form stored at DUMMYNAME. *x/ */ | |
476 | /* OBSOLETE */ | |
477 | /* OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ */ | |
c5aa993b | 478 | /* OBSOLETE { *((char *) dummyname + 1) = nargs; \ */ |
9846de1b JM |
479 | /* OBSOLETE *(int *)((char *) dummyname + 3) = fun; } */ |
480 | /* OBSOLETE #endif /* 0 *x/ */ | |
481 | /* OBSOLETE */ | |
482 | /* OBSOLETE #define POP_FRAME \ */ | |
483 | /* OBSOLETE { error ("The return command is not supported on this machine."); } */ |