* gdb.base/default.exp: Remove obsolete code.
[deliverable/binutils-gdb.git] / gdb / a29k-tdep.c
CommitLineData
9b4ff276
AC
1/* OBSOLETE /* Target-machine dependent code for the AMD 29000 */
2/* OBSOLETE Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, */
3/* OBSOLETE 2001 */
4/* OBSOLETE Free Software Foundation, Inc. */
5/* OBSOLETE Contributed by Cygnus Support. Written by Jim Kingdon. */
6/* OBSOLETE */
7/* OBSOLETE This file is part of GDB. */
8/* OBSOLETE */
9/* OBSOLETE This program is free software; you can redistribute it and/or modify */
10/* OBSOLETE it under the terms of the GNU General Public License as published by */
11/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
12/* OBSOLETE (at your option) any later version. */
13/* OBSOLETE */
14/* OBSOLETE This program is distributed in the hope that it will be useful, */
15/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
16/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
17/* OBSOLETE GNU General Public License for more details. */
18/* OBSOLETE */
19/* OBSOLETE You should have received a copy of the GNU General Public License */
20/* OBSOLETE along with this program; if not, write to the Free Software */
21/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
22/* OBSOLETE Boston, MA 02111-1307, USA. */ */
23/* OBSOLETE */
24/* OBSOLETE #include "defs.h" */
25/* OBSOLETE #include "gdbcore.h" */
26/* OBSOLETE #include "frame.h" */
27/* OBSOLETE #include "value.h" */
28/* OBSOLETE #include "symtab.h" */
29/* OBSOLETE #include "inferior.h" */
30/* OBSOLETE #include "gdbcmd.h" */
31/* OBSOLETE #include "regcache.h" */
32/* OBSOLETE */
33/* OBSOLETE /* If all these bits in an instruction word are zero, it is a "tag word" */
34/* OBSOLETE which precedes a function entry point and gives stack traceback info. */
35/* OBSOLETE This used to be defined as 0xff000000, but that treated 0x00000deb as */
36/* OBSOLETE a tag word, while it is really used as a breakpoint. */ */
37/* OBSOLETE #define TAGWORD_ZERO_MASK 0xff00f800 */
38/* OBSOLETE */
39/* OBSOLETE extern CORE_ADDR text_start; /* FIXME, kludge... */ */
40/* OBSOLETE */
41/* OBSOLETE /* The user-settable top of the register stack in virtual memory. We */
42/* OBSOLETE won't attempt to access any stored registers above this address, if set */
43/* OBSOLETE nonzero. */ */
44/* OBSOLETE */
45/* OBSOLETE static CORE_ADDR rstack_high_address = UINT_MAX; */
46/* OBSOLETE */
47/* OBSOLETE */
48/* OBSOLETE /* Should call_function allocate stack space for a struct return? */ */
49/* OBSOLETE /* On the a29k objects over 16 words require the caller to allocate space. */ */
50/* OBSOLETE int */
51/* OBSOLETE a29k_use_struct_convention (int gcc_p, struct type *type) */
52/* OBSOLETE { */
53/* OBSOLETE return (TYPE_LENGTH (type) > 16 * 4); */
54/* OBSOLETE } */
55/* OBSOLETE */
56/* OBSOLETE */
57/* OBSOLETE /* Structure to hold cached info about function prologues. */ */
58/* OBSOLETE */
59/* OBSOLETE struct prologue_info */
60/* OBSOLETE { */
61/* OBSOLETE CORE_ADDR pc; /* First addr after fn prologue */ */
62/* OBSOLETE unsigned rsize, msize; /* register stack frame size, mem stack ditto */ */
63/* OBSOLETE unsigned mfp_used:1; /* memory frame pointer used */ */
64/* OBSOLETE unsigned rsize_valid:1; /* Validity bits for the above */ */
65/* OBSOLETE unsigned msize_valid:1; */
66/* OBSOLETE unsigned mfp_valid:1; */
67/* OBSOLETE }; */
68/* OBSOLETE */
69/* OBSOLETE /* Examine the prologue of a function which starts at PC. Return */
70/* OBSOLETE the first addess past the prologue. If MSIZE is non-NULL, then */
71/* OBSOLETE set *MSIZE to the memory stack frame size. If RSIZE is non-NULL, */
72/* OBSOLETE then set *RSIZE to the register stack frame size (not including */
73/* OBSOLETE incoming arguments and the return address & frame pointer stored */
74/* OBSOLETE with them). If no prologue is found, *RSIZE is set to zero. */
75/* OBSOLETE If no prologue is found, or a prologue which doesn't involve */
76/* OBSOLETE allocating a memory stack frame, then set *MSIZE to zero. */
77/* OBSOLETE */
78/* OBSOLETE Note that both msize and rsize are in bytes. This is not consistent */
79/* OBSOLETE with the _User's Manual_ with respect to rsize, but it is much more */
80/* OBSOLETE convenient. */
81/* OBSOLETE */
82/* OBSOLETE If MFP_USED is non-NULL, *MFP_USED is set to nonzero if a memory */
83/* OBSOLETE frame pointer is being used. */ */
84/* OBSOLETE */
85/* OBSOLETE CORE_ADDR */
86/* OBSOLETE examine_prologue (CORE_ADDR pc, unsigned *rsize, unsigned *msize, int *mfp_used) */
87/* OBSOLETE { */
88/* OBSOLETE long insn; */
89/* OBSOLETE CORE_ADDR p = pc; */
90/* OBSOLETE struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc); */
91/* OBSOLETE struct prologue_info *mi = 0; */
92/* OBSOLETE */
93/* OBSOLETE if (msymbol != NULL) */
94/* OBSOLETE mi = (struct prologue_info *) msymbol->info; */
95/* OBSOLETE */
96/* OBSOLETE if (mi != 0) */
97/* OBSOLETE { */
98/* OBSOLETE int valid = 1; */
99/* OBSOLETE if (rsize != NULL) */
100/* OBSOLETE { */
101/* OBSOLETE *rsize = mi->rsize; */
102/* OBSOLETE valid &= mi->rsize_valid; */
103/* OBSOLETE } */
104/* OBSOLETE if (msize != NULL) */
105/* OBSOLETE { */
106/* OBSOLETE *msize = mi->msize; */
107/* OBSOLETE valid &= mi->msize_valid; */
108/* OBSOLETE } */
109/* OBSOLETE if (mfp_used != NULL) */
110/* OBSOLETE { */
111/* OBSOLETE *mfp_used = mi->mfp_used; */
112/* OBSOLETE valid &= mi->mfp_valid; */
113/* OBSOLETE } */
114/* OBSOLETE if (valid) */
115/* OBSOLETE return mi->pc; */
116/* OBSOLETE } */
117/* OBSOLETE */
118/* OBSOLETE if (rsize != NULL) */
119/* OBSOLETE *rsize = 0; */
120/* OBSOLETE if (msize != NULL) */
121/* OBSOLETE *msize = 0; */
122/* OBSOLETE if (mfp_used != NULL) */
123/* OBSOLETE *mfp_used = 0; */
124/* OBSOLETE */
125/* OBSOLETE /* Prologue must start with subtracting a constant from gr1. */
126/* OBSOLETE Normally this is sub gr1,gr1,<rsize * 4>. */ */
127/* OBSOLETE insn = read_memory_integer (p, 4); */
128/* OBSOLETE if ((insn & 0xffffff00) != 0x25010100) */
129/* OBSOLETE { */
130/* OBSOLETE /* If the frame is large, instead of a single instruction it */
131/* OBSOLETE might be a pair of instructions: */
132/* OBSOLETE const <reg>, <rsize * 4> */
133/* OBSOLETE sub gr1,gr1,<reg> */
134/* OBSOLETE */ */
135/* OBSOLETE int reg; */
136/* OBSOLETE /* Possible value for rsize. */ */
137/* OBSOLETE unsigned int rsize0; */
138/* OBSOLETE */
139/* OBSOLETE if ((insn & 0xff000000) != 0x03000000) */
140/* OBSOLETE { */
141/* OBSOLETE p = pc; */
142/* OBSOLETE goto done; */
143/* OBSOLETE } */
144/* OBSOLETE reg = (insn >> 8) & 0xff; */
145/* OBSOLETE rsize0 = (((insn >> 8) & 0xff00) | (insn & 0xff)); */
146/* OBSOLETE p += 4; */
147/* OBSOLETE insn = read_memory_integer (p, 4); */
148/* OBSOLETE if ((insn & 0xffffff00) != 0x24010100 */
149/* OBSOLETE || (insn & 0xff) != reg) */
150/* OBSOLETE { */
151/* OBSOLETE p = pc; */
152/* OBSOLETE goto done; */
153/* OBSOLETE } */
154/* OBSOLETE if (rsize != NULL) */
155/* OBSOLETE *rsize = rsize0; */
156/* OBSOLETE } */
157/* OBSOLETE else */
158/* OBSOLETE { */
159/* OBSOLETE if (rsize != NULL) */
160/* OBSOLETE *rsize = (insn & 0xff); */
161/* OBSOLETE } */
162/* OBSOLETE p += 4; */
163/* OBSOLETE */
164/* OBSOLETE /* Next instruction ought to be asgeu V_SPILL,gr1,rab. */
165/* OBSOLETE * We don't check the vector number to allow for kernel debugging. The */
166/* OBSOLETE * kernel will use a different trap number. */
167/* OBSOLETE * If this insn is missing, we just keep going; Metaware R2.3u compiler */
168/* OBSOLETE * generates prologue that intermixes initializations and puts the asgeu */
169/* OBSOLETE * way down. */
170/* OBSOLETE */ */
171/* OBSOLETE insn = read_memory_integer (p, 4); */
172/* OBSOLETE if ((insn & 0xff00ffff) == (0x5e000100 | RAB_HW_REGNUM)) */
173/* OBSOLETE { */
174/* OBSOLETE p += 4; */
175/* OBSOLETE } */
176/* OBSOLETE */
177/* OBSOLETE /* Next instruction usually sets the frame pointer (lr1) by adding */
178/* OBSOLETE <size * 4> from gr1. However, this can (and high C does) be */
179/* OBSOLETE deferred until anytime before the first function call. So it is */
180/* OBSOLETE OK if we don't see anything which sets lr1. */
181/* OBSOLETE To allow for alternate register sets (gcc -mkernel-registers) the msp */
182/* OBSOLETE register number is a compile time constant. */ */
183/* OBSOLETE */
184/* OBSOLETE /* Normally this is just add lr1,gr1,<size * 4>. */ */
185/* OBSOLETE insn = read_memory_integer (p, 4); */
186/* OBSOLETE if ((insn & 0xffffff00) == 0x15810100) */
187/* OBSOLETE p += 4; */
188/* OBSOLETE else */
189/* OBSOLETE { */
190/* OBSOLETE /* However, for large frames it can be */
191/* OBSOLETE const <reg>, <size *4> */
192/* OBSOLETE add lr1,gr1,<reg> */
193/* OBSOLETE */ */
194/* OBSOLETE int reg; */
195/* OBSOLETE CORE_ADDR q; */
196/* OBSOLETE */
197/* OBSOLETE if ((insn & 0xff000000) == 0x03000000) */
198/* OBSOLETE { */
199/* OBSOLETE reg = (insn >> 8) & 0xff; */
200/* OBSOLETE q = p + 4; */
201/* OBSOLETE insn = read_memory_integer (q, 4); */
202/* OBSOLETE if ((insn & 0xffffff00) == 0x14810100 */
203/* OBSOLETE && (insn & 0xff) == reg) */
204/* OBSOLETE p = q; */
205/* OBSOLETE } */
206/* OBSOLETE } */
207/* OBSOLETE */
208/* OBSOLETE /* Next comes "add lr{<rsize-1>},msp,0", but only if a memory */
209/* OBSOLETE frame pointer is in use. We just check for add lr<anything>,msp,0; */
210/* OBSOLETE we don't check this rsize against the first instruction, and */
211/* OBSOLETE we don't check that the trace-back tag indicates a memory frame pointer */
212/* OBSOLETE is in use. */
213/* OBSOLETE To allow for alternate register sets (gcc -mkernel-registers) the msp */
214/* OBSOLETE register number is a compile time constant. */
215/* OBSOLETE */
216/* OBSOLETE The recommended instruction is actually "sll lr<whatever>,msp,0". */
217/* OBSOLETE We check for that, too. Originally Jim Kingdon's code seemed */
218/* OBSOLETE to be looking for a "sub" instruction here, but the mask was set */
219/* OBSOLETE up to lose all the time. */ */
220/* OBSOLETE insn = read_memory_integer (p, 4); */
221/* OBSOLETE if (((insn & 0xff80ffff) == (0x15800000 | (MSP_HW_REGNUM << 8))) /* add */ */
222/* OBSOLETE || ((insn & 0xff80ffff) == (0x81800000 | (MSP_HW_REGNUM << 8)))) /* sll */ */
223/* OBSOLETE { */
224/* OBSOLETE p += 4; */
225/* OBSOLETE if (mfp_used != NULL) */
226/* OBSOLETE *mfp_used = 1; */
227/* OBSOLETE } */
228/* OBSOLETE */
229/* OBSOLETE /* Next comes a subtraction from msp to allocate a memory frame, */
230/* OBSOLETE but only if a memory frame is */
231/* OBSOLETE being used. We don't check msize against the trace-back tag. */
232/* OBSOLETE */
233/* OBSOLETE To allow for alternate register sets (gcc -mkernel-registers) the msp */
234/* OBSOLETE register number is a compile time constant. */
235/* OBSOLETE */
236/* OBSOLETE Normally this is just */
237/* OBSOLETE sub msp,msp,<msize> */
238/* OBSOLETE */ */
239/* OBSOLETE insn = read_memory_integer (p, 4); */
240/* OBSOLETE if ((insn & 0xffffff00) == */
241/* OBSOLETE (0x25000000 | (MSP_HW_REGNUM << 16) | (MSP_HW_REGNUM << 8))) */
242/* OBSOLETE { */
243/* OBSOLETE p += 4; */
244/* OBSOLETE if (msize != NULL) */
245/* OBSOLETE *msize = insn & 0xff; */
246/* OBSOLETE } */
247/* OBSOLETE else */
248/* OBSOLETE { */
249/* OBSOLETE /* For large frames, instead of a single instruction it might */
250/* OBSOLETE be */
251/* OBSOLETE */
252/* OBSOLETE const <reg>, <msize> */
253/* OBSOLETE consth <reg>, <msize> ; optional */
254/* OBSOLETE sub msp,msp,<reg> */
255/* OBSOLETE */ */
256/* OBSOLETE int reg; */
257/* OBSOLETE unsigned msize0; */
258/* OBSOLETE CORE_ADDR q = p; */
259/* OBSOLETE */
260/* OBSOLETE if ((insn & 0xff000000) == 0x03000000) */
261/* OBSOLETE { */
262/* OBSOLETE reg = (insn >> 8) & 0xff; */
263/* OBSOLETE msize0 = ((insn >> 8) & 0xff00) | (insn & 0xff); */
264/* OBSOLETE q += 4; */
265/* OBSOLETE insn = read_memory_integer (q, 4); */
266/* OBSOLETE /* Check for consth. */ */
267/* OBSOLETE if ((insn & 0xff000000) == 0x02000000 */
268/* OBSOLETE && (insn & 0x0000ff00) == reg) */
269/* OBSOLETE { */
270/* OBSOLETE msize0 |= (insn << 8) & 0xff000000; */
271/* OBSOLETE msize0 |= (insn << 16) & 0x00ff0000; */
272/* OBSOLETE q += 4; */
273/* OBSOLETE insn = read_memory_integer (q, 4); */
274/* OBSOLETE } */
275/* OBSOLETE /* Check for sub msp,msp,<reg>. */ */
276/* OBSOLETE if ((insn & 0xffffff00) == */
277/* OBSOLETE (0x24000000 | (MSP_HW_REGNUM << 16) | (MSP_HW_REGNUM << 8)) */
278/* OBSOLETE && (insn & 0xff) == reg) */
279/* OBSOLETE { */
280/* OBSOLETE p = q + 4; */
281/* OBSOLETE if (msize != NULL) */
282/* OBSOLETE *msize = msize0; */
283/* OBSOLETE } */
284/* OBSOLETE } */
285/* OBSOLETE } */
286/* OBSOLETE */
287/* OBSOLETE /* Next instruction might be asgeu V_SPILL,gr1,rab. */
288/* OBSOLETE * We don't check the vector number to allow for kernel debugging. The */
289/* OBSOLETE * kernel will use a different trap number. */
290/* OBSOLETE * Metaware R2.3u compiler */
291/* OBSOLETE * generates prologue that intermixes initializations and puts the asgeu */
292/* OBSOLETE * way down after everything else. */
293/* OBSOLETE */ */
294/* OBSOLETE insn = read_memory_integer (p, 4); */
295/* OBSOLETE if ((insn & 0xff00ffff) == (0x5e000100 | RAB_HW_REGNUM)) */
296/* OBSOLETE { */
297/* OBSOLETE p += 4; */
298/* OBSOLETE } */
299/* OBSOLETE */
300/* OBSOLETE done: */
301/* OBSOLETE if (msymbol != NULL) */
302/* OBSOLETE { */
303/* OBSOLETE if (mi == 0) */
304/* OBSOLETE { */
305/* OBSOLETE /* Add a new cache entry. */ */
306/* OBSOLETE mi = (struct prologue_info *) xmalloc (sizeof (struct prologue_info)); */
307/* OBSOLETE msymbol->info = (char *) mi; */
308/* OBSOLETE mi->rsize_valid = 0; */
309/* OBSOLETE mi->msize_valid = 0; */
310/* OBSOLETE mi->mfp_valid = 0; */
311/* OBSOLETE } */
312/* OBSOLETE /* else, cache entry exists, but info is incomplete. */ */
313/* OBSOLETE mi->pc = p; */
314/* OBSOLETE if (rsize != NULL) */
315/* OBSOLETE { */
316/* OBSOLETE mi->rsize = *rsize; */
317/* OBSOLETE mi->rsize_valid = 1; */
318/* OBSOLETE } */
319/* OBSOLETE if (msize != NULL) */
320/* OBSOLETE { */
321/* OBSOLETE mi->msize = *msize; */
322/* OBSOLETE mi->msize_valid = 1; */
323/* OBSOLETE } */
324/* OBSOLETE if (mfp_used != NULL) */
325/* OBSOLETE { */
326/* OBSOLETE mi->mfp_used = *mfp_used; */
327/* OBSOLETE mi->mfp_valid = 1; */
328/* OBSOLETE } */
329/* OBSOLETE } */
330/* OBSOLETE return p; */
331/* OBSOLETE } */
332/* OBSOLETE */
333/* OBSOLETE /* Advance PC across any function entry prologue instructions */
334/* OBSOLETE to reach some "real" code. */ */
335/* OBSOLETE */
336/* OBSOLETE CORE_ADDR */
337/* OBSOLETE a29k_skip_prologue (CORE_ADDR pc) */
338/* OBSOLETE { */
339/* OBSOLETE return examine_prologue (pc, NULL, NULL, NULL); */
340/* OBSOLETE } */
341/* OBSOLETE */
342/* OBSOLETE /* */
343/* OBSOLETE * Examine the one or two word tag at the beginning of a function. */
344/* OBSOLETE * The tag word is expect to be at 'p', if it is not there, we fail */
345/* OBSOLETE * by returning 0. The documentation for the tag word was taken from */
346/* OBSOLETE * page 7-15 of the 29050 User's Manual. We are assuming that the */
347/* OBSOLETE * m bit is in bit 22 of the tag word, which seems to be the agreed upon */
348/* OBSOLETE * convention today (1/15/92). */
349/* OBSOLETE * msize is return in bytes. */
350/* OBSOLETE */ */
351/* OBSOLETE */
352/* OBSOLETE static int /* 0/1 - failure/success of finding the tag word */ */
353/* OBSOLETE examine_tag (CORE_ADDR p, int *is_trans, int *argcount, unsigned *msize, */
354/* OBSOLETE int *mfp_used) */
355/* OBSOLETE { */
356/* OBSOLETE unsigned int tag1, tag2; */
357/* OBSOLETE */
358/* OBSOLETE tag1 = read_memory_integer (p, 4); */
359/* OBSOLETE if ((tag1 & TAGWORD_ZERO_MASK) != 0) /* Not a tag word */ */
360/* OBSOLETE return 0; */
361/* OBSOLETE if (tag1 & (1 << 23)) /* A two word tag */ */
362/* OBSOLETE { */
363/* OBSOLETE tag2 = read_memory_integer (p - 4, 4); */
364/* OBSOLETE if (msize) */
365/* OBSOLETE *msize = tag2 * 2; */
366/* OBSOLETE } */
367/* OBSOLETE else */
368/* OBSOLETE /* A one word tag */ */
369/* OBSOLETE { */
370/* OBSOLETE if (msize) */
371/* OBSOLETE *msize = tag1 & 0x7ff; */
372/* OBSOLETE } */
373/* OBSOLETE if (is_trans) */
374/* OBSOLETE *is_trans = ((tag1 & (1 << 21)) ? 1 : 0); */
375/* OBSOLETE /* Note that this includes the frame pointer and the return address */
376/* OBSOLETE register, so the actual number of registers of arguments is two less. */
377/* OBSOLETE argcount can be zero, however, sometimes, for strange assembler */
378/* OBSOLETE routines. */ */
379/* OBSOLETE if (argcount) */
380/* OBSOLETE *argcount = (tag1 >> 16) & 0x1f; */
381/* OBSOLETE if (mfp_used) */
382/* OBSOLETE *mfp_used = ((tag1 & (1 << 22)) ? 1 : 0); */
383/* OBSOLETE return 1; */
384/* OBSOLETE } */
385/* OBSOLETE */
386/* OBSOLETE /* Initialize the frame. In addition to setting "extra" frame info, */
387/* OBSOLETE we also set ->frame because we use it in a nonstandard way, and ->pc */
388/* OBSOLETE because we need to know it to get the other stuff. See the diagram */
389/* OBSOLETE of stacks and the frame cache in tm-a29k.h for more detail. */ */
390/* OBSOLETE */
391/* OBSOLETE static void */
392/* OBSOLETE init_frame_info (int innermost_frame, struct frame_info *frame) */
393/* OBSOLETE { */
394/* OBSOLETE CORE_ADDR p; */
395/* OBSOLETE long insn; */
396/* OBSOLETE unsigned rsize; */
397/* OBSOLETE unsigned msize; */
398/* OBSOLETE int mfp_used, trans; */
399/* OBSOLETE struct symbol *func; */
400/* OBSOLETE */
401/* OBSOLETE p = frame->pc; */
402/* OBSOLETE */
403/* OBSOLETE if (innermost_frame) */
404/* OBSOLETE frame->frame = read_register (GR1_REGNUM); */
405/* OBSOLETE else */
406/* OBSOLETE frame->frame = frame->next->frame + frame->next->rsize; */
407/* OBSOLETE */
408/* OBSOLETE #if 0 /* CALL_DUMMY_LOCATION == ON_STACK */ */
409/* OBSOLETE This wont work; */
410/* OBSOLETE #else */
411/* OBSOLETE if (PC_IN_CALL_DUMMY (p, 0, 0)) */
412/* OBSOLETE #endif */
413/* OBSOLETE { */
414/* OBSOLETE frame->rsize = DUMMY_FRAME_RSIZE; */
415/* OBSOLETE /* This doesn't matter since we never try to get locals or args */
416/* OBSOLETE from a dummy frame. */ */
417/* OBSOLETE frame->msize = 0; */
418/* OBSOLETE /* Dummy frames always use a memory frame pointer. */ */
419/* OBSOLETE frame->saved_msp = */
420/* OBSOLETE read_register_stack_integer (frame->frame + DUMMY_FRAME_RSIZE - 4, 4); */
421/* OBSOLETE frame->flags |= (TRANSPARENT_FRAME | MFP_USED); */
422/* OBSOLETE return; */
423/* OBSOLETE } */
424/* OBSOLETE */
425/* OBSOLETE func = find_pc_function (p); */
426/* OBSOLETE if (func != NULL) */
427/* OBSOLETE p = BLOCK_START (SYMBOL_BLOCK_VALUE (func)); */
428/* OBSOLETE else */
429/* OBSOLETE { */
430/* OBSOLETE /* Search backward to find the trace-back tag. However, */
431/* OBSOLETE do not trace back beyond the start of the text segment */
432/* OBSOLETE (just as a sanity check to avoid going into never-never land). */ */
433/* OBSOLETE #if 1 */
434/* OBSOLETE while (p >= text_start */
435/* OBSOLETE && ((insn = read_memory_integer (p, 4)) & TAGWORD_ZERO_MASK) != 0) */
436/* OBSOLETE p -= 4; */
437/* OBSOLETE #else /* 0 */ */
438/* OBSOLETE char pat[4] = */
439/* OBSOLETE {0, 0, 0, 0}; */
440/* OBSOLETE char mask[4]; */
441/* OBSOLETE char insn_raw[4]; */
442/* OBSOLETE store_unsigned_integer (mask, 4, TAGWORD_ZERO_MASK); */
443/* OBSOLETE /* Enable this once target_search is enabled and tested. */ */
444/* OBSOLETE target_search (4, pat, mask, p, -4, text_start, p + 1, &p, &insn_raw); */
445/* OBSOLETE insn = extract_unsigned_integer (insn_raw, 4); */
446/* OBSOLETE #endif /* 0 */ */
447/* OBSOLETE */
448/* OBSOLETE if (p < text_start) */
449/* OBSOLETE { */
450/* OBSOLETE /* Couldn't find the trace-back tag. */
451/* OBSOLETE Something strange is going on. */ */
452/* OBSOLETE frame->saved_msp = 0; */
453/* OBSOLETE frame->rsize = 0; */
454/* OBSOLETE frame->msize = 0; */
455/* OBSOLETE frame->flags = TRANSPARENT_FRAME; */
456/* OBSOLETE return; */
457/* OBSOLETE } */
458/* OBSOLETE else */
459/* OBSOLETE /* Advance to the first word of the function, i.e. the word */
460/* OBSOLETE after the trace-back tag. */ */
461/* OBSOLETE p += 4; */
462/* OBSOLETE } */
463/* OBSOLETE */
464/* OBSOLETE /* We've found the start of the function. */
465/* OBSOLETE Try looking for a tag word that indicates whether there is a */
466/* OBSOLETE memory frame pointer and what the memory stack allocation is. */
467/* OBSOLETE If one doesn't exist, try using a more exhaustive search of */
468/* OBSOLETE the prologue. */ */
469/* OBSOLETE */
470/* OBSOLETE if (examine_tag (p - 4, &trans, (int *) NULL, &msize, &mfp_used)) /* Found good tag */ */
471/* OBSOLETE examine_prologue (p, &rsize, 0, 0); */
472/* OBSOLETE else /* No tag try prologue */ */
473/* OBSOLETE examine_prologue (p, &rsize, &msize, &mfp_used); */
474/* OBSOLETE */
475/* OBSOLETE frame->rsize = rsize; */
476/* OBSOLETE frame->msize = msize; */
477/* OBSOLETE frame->flags = 0; */
478/* OBSOLETE if (mfp_used) */
479/* OBSOLETE frame->flags |= MFP_USED; */
480/* OBSOLETE if (trans) */
481/* OBSOLETE frame->flags |= TRANSPARENT_FRAME; */
482/* OBSOLETE if (innermost_frame) */
483/* OBSOLETE { */
484/* OBSOLETE frame->saved_msp = read_register (MSP_REGNUM) + msize; */
485/* OBSOLETE } */
486/* OBSOLETE else */
487/* OBSOLETE { */
488/* OBSOLETE if (mfp_used) */
489/* OBSOLETE frame->saved_msp = */
490/* OBSOLETE read_register_stack_integer (frame->frame + rsize - 4, 4); */
491/* OBSOLETE else */
492/* OBSOLETE frame->saved_msp = frame->next->saved_msp + msize; */
493/* OBSOLETE } */
494/* OBSOLETE } */
495/* OBSOLETE */
496/* OBSOLETE void */
497/* OBSOLETE init_extra_frame_info (struct frame_info *frame) */
498/* OBSOLETE { */
499/* OBSOLETE if (frame->next == 0) */
500/* OBSOLETE /* Assume innermost frame. May produce strange results for "info frame" */
501/* OBSOLETE but there isn't any way to tell the difference. */ */
502/* OBSOLETE init_frame_info (1, frame); */
503/* OBSOLETE else */
504/* OBSOLETE { */
505/* OBSOLETE /* We're in get_prev_frame. */
506/* OBSOLETE Take care of everything in init_frame_pc. */ */
507/* OBSOLETE ; */
508/* OBSOLETE } */
509/* OBSOLETE } */
510/* OBSOLETE */
511/* OBSOLETE void */
512/* OBSOLETE init_frame_pc (int fromleaf, struct frame_info *frame) */
513/* OBSOLETE { */
514/* OBSOLETE frame->pc = (fromleaf ? SAVED_PC_AFTER_CALL (frame->next) : */
515/* OBSOLETE frame->next ? FRAME_SAVED_PC (frame->next) : read_pc ()); */
516/* OBSOLETE init_frame_info (fromleaf, frame); */
517/* OBSOLETE } */
518/* OBSOLETE \f */
519/* OBSOLETE /* Local variables (i.e. LOC_LOCAL) are on the memory stack, with their */
520/* OBSOLETE offsets being relative to the memory stack pointer (high C) or */
521/* OBSOLETE saved_msp (gcc). */ */
522/* OBSOLETE */
523/* OBSOLETE CORE_ADDR */
524/* OBSOLETE frame_locals_address (struct frame_info *fi) */
525/* OBSOLETE { */
526/* OBSOLETE if (fi->flags & MFP_USED) */
527/* OBSOLETE return fi->saved_msp; */
528/* OBSOLETE else */
529/* OBSOLETE return fi->saved_msp - fi->msize; */
530/* OBSOLETE } */
531/* OBSOLETE \f */
532/* OBSOLETE /* Routines for reading the register stack. The caller gets to treat */
533/* OBSOLETE the register stack as a uniform stack in memory, from address $gr1 */
534/* OBSOLETE straight through $rfb and beyond. */ */
535/* OBSOLETE */
536/* OBSOLETE /* Analogous to read_memory except the length is understood to be 4. */
537/* OBSOLETE Also, myaddr can be NULL (meaning don't bother to read), and */
538/* OBSOLETE if actual_mem_addr is non-NULL, store there the address that it */
539/* OBSOLETE was fetched from (or if from a register the offset within */
540/* OBSOLETE registers). Set *LVAL to lval_memory or lval_register, depending */
541/* OBSOLETE on where it came from. The contents written into MYADDR are in */
542/* OBSOLETE target format. */ */
543/* OBSOLETE void */
544/* OBSOLETE read_register_stack (CORE_ADDR memaddr, char *myaddr, */
545/* OBSOLETE CORE_ADDR *actual_mem_addr, enum lval_type *lval) */
546/* OBSOLETE { */
547/* OBSOLETE long rfb = read_register (RFB_REGNUM); */
548/* OBSOLETE long rsp = read_register (RSP_REGNUM); */
549/* OBSOLETE */
550/* OBSOLETE /* If we don't do this 'info register' stops in the middle. */ */
551/* OBSOLETE if (memaddr >= rstack_high_address) */
552/* OBSOLETE { */
553/* OBSOLETE /* a bogus value */ */
554/* OBSOLETE static char val[] = */
555/* OBSOLETE {~0, ~0, ~0, ~0}; */
556/* OBSOLETE /* It's in a local register, but off the end of the stack. */ */
557/* OBSOLETE int regnum = (memaddr - rsp) / 4 + LR0_REGNUM; */
558/* OBSOLETE if (myaddr != NULL) */
559/* OBSOLETE { */
560/* OBSOLETE /* Provide bogusness */ */
561/* OBSOLETE memcpy (myaddr, val, 4); */
562/* OBSOLETE } */
563/* OBSOLETE supply_register (regnum, val); /* More bogusness */ */
564/* OBSOLETE if (lval != NULL) */
565/* OBSOLETE *lval = lval_register; */
566/* OBSOLETE if (actual_mem_addr != NULL) */
567/* OBSOLETE *actual_mem_addr = REGISTER_BYTE (regnum); */
568/* OBSOLETE } */
569/* OBSOLETE /* If it's in the part of the register stack that's in real registers, */
570/* OBSOLETE get the value from the registers. If it's anywhere else in memory */
571/* OBSOLETE (e.g. in another thread's saved stack), skip this part and get */
572/* OBSOLETE it from real live memory. */ */
573/* OBSOLETE else if (memaddr < rfb && memaddr >= rsp) */
574/* OBSOLETE { */
575/* OBSOLETE /* It's in a register. */ */
576/* OBSOLETE int regnum = (memaddr - rsp) / 4 + LR0_REGNUM; */
577/* OBSOLETE if (regnum > LR0_REGNUM + 127) */
578/* OBSOLETE error ("Attempt to read register stack out of range."); */
579/* OBSOLETE if (myaddr != NULL) */
580/* OBSOLETE read_register_gen (regnum, myaddr); */
581/* OBSOLETE if (lval != NULL) */
582/* OBSOLETE *lval = lval_register; */
583/* OBSOLETE if (actual_mem_addr != NULL) */
584/* OBSOLETE *actual_mem_addr = REGISTER_BYTE (regnum); */
585/* OBSOLETE } */
586/* OBSOLETE else */
587/* OBSOLETE { */
588/* OBSOLETE /* It's in the memory portion of the register stack. */ */
589/* OBSOLETE if (myaddr != NULL) */
590/* OBSOLETE read_memory (memaddr, myaddr, 4); */
591/* OBSOLETE if (lval != NULL) */
592/* OBSOLETE *lval = lval_memory; */
593/* OBSOLETE if (actual_mem_addr != NULL) */
594/* OBSOLETE *actual_mem_addr = memaddr; */
595/* OBSOLETE } */
596/* OBSOLETE } */
597/* OBSOLETE */
598/* OBSOLETE /* Analogous to read_memory_integer */
599/* OBSOLETE except the length is understood to be 4. */ */
600/* OBSOLETE long */
601/* OBSOLETE read_register_stack_integer (CORE_ADDR memaddr, int len) */
602/* OBSOLETE { */
603/* OBSOLETE char buf[4]; */
604/* OBSOLETE read_register_stack (memaddr, buf, NULL, NULL); */
605/* OBSOLETE return extract_signed_integer (buf, 4); */
606/* OBSOLETE } */
607/* OBSOLETE */
608/* OBSOLETE /* Copy 4 bytes from GDB memory at MYADDR into inferior memory */
609/* OBSOLETE at MEMADDR and put the actual address written into in */
610/* OBSOLETE *ACTUAL_MEM_ADDR. */ */
611/* OBSOLETE static void */
612/* OBSOLETE write_register_stack (CORE_ADDR memaddr, char *myaddr, */
613/* OBSOLETE CORE_ADDR *actual_mem_addr) */
614/* OBSOLETE { */
615/* OBSOLETE long rfb = read_register (RFB_REGNUM); */
616/* OBSOLETE long rsp = read_register (RSP_REGNUM); */
617/* OBSOLETE /* If we don't do this 'info register' stops in the middle. */ */
618/* OBSOLETE if (memaddr >= rstack_high_address) */
619/* OBSOLETE { */
620/* OBSOLETE /* It's in a register, but off the end of the stack. */ */
621/* OBSOLETE if (actual_mem_addr != NULL) */
622/* OBSOLETE *actual_mem_addr = 0; */
623/* OBSOLETE } */
624/* OBSOLETE else if (memaddr < rfb) */
625/* OBSOLETE { */
626/* OBSOLETE /* It's in a register. */ */
627/* OBSOLETE int regnum = (memaddr - rsp) / 4 + LR0_REGNUM; */
628/* OBSOLETE if (regnum < LR0_REGNUM || regnum > LR0_REGNUM + 127) */
629/* OBSOLETE error ("Attempt to read register stack out of range."); */
630/* OBSOLETE if (myaddr != NULL) */
631/* OBSOLETE write_register (regnum, *(long *) myaddr); */
632/* OBSOLETE if (actual_mem_addr != NULL) */
633/* OBSOLETE *actual_mem_addr = 0; */
634/* OBSOLETE } */
635/* OBSOLETE else */
636/* OBSOLETE { */
637/* OBSOLETE /* It's in the memory portion of the register stack. */ */
638/* OBSOLETE if (myaddr != NULL) */
639/* OBSOLETE write_memory (memaddr, myaddr, 4); */
640/* OBSOLETE if (actual_mem_addr != NULL) */
641/* OBSOLETE *actual_mem_addr = memaddr; */
642/* OBSOLETE } */
643/* OBSOLETE } */
644/* OBSOLETE \f */
645/* OBSOLETE /* Find register number REGNUM relative to FRAME and put its */
646/* OBSOLETE (raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable */
647/* OBSOLETE was optimized out (and thus can't be fetched). If the variable */
648/* OBSOLETE was fetched from memory, set *ADDRP to where it was fetched from, */
649/* OBSOLETE otherwise it was fetched from a register. */
650/* OBSOLETE */
651/* OBSOLETE The argument RAW_BUFFER must point to aligned memory. */ */
652/* OBSOLETE */
653/* OBSOLETE void */
654/* OBSOLETE a29k_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, */
655/* OBSOLETE struct frame_info *frame, int regnum, */
656/* OBSOLETE enum lval_type *lvalp) */
657/* OBSOLETE { */
658/* OBSOLETE struct frame_info *fi; */
659/* OBSOLETE CORE_ADDR addr; */
660/* OBSOLETE enum lval_type lval; */
661/* OBSOLETE */
662/* OBSOLETE if (!target_has_registers) */
663/* OBSOLETE error ("No registers."); */
664/* OBSOLETE */
665/* OBSOLETE /* Probably now redundant with the target_has_registers check. */ */
666/* OBSOLETE if (frame == 0) */
667/* OBSOLETE return; */
668/* OBSOLETE */
669/* OBSOLETE /* Once something has a register number, it doesn't get optimized out. */ */
670/* OBSOLETE if (optimized != NULL) */
671/* OBSOLETE *optimized = 0; */
672/* OBSOLETE if (regnum == RSP_REGNUM) */
673/* OBSOLETE { */
674/* OBSOLETE if (raw_buffer != NULL) */
675/* OBSOLETE { */
676/* OBSOLETE store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), frame->frame); */
677/* OBSOLETE } */
678/* OBSOLETE if (lvalp != NULL) */
679/* OBSOLETE *lvalp = not_lval; */
680/* OBSOLETE return; */
681/* OBSOLETE } */
682/* OBSOLETE else if (regnum == PC_REGNUM && frame->next != NULL) */
683/* OBSOLETE { */
684/* OBSOLETE if (raw_buffer != NULL) */
685/* OBSOLETE { */
686/* OBSOLETE store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), frame->pc); */
687/* OBSOLETE } */
688/* OBSOLETE */
689/* OBSOLETE /* Not sure we have to do this. */ */
690/* OBSOLETE if (lvalp != NULL) */
691/* OBSOLETE *lvalp = not_lval; */
692/* OBSOLETE */
693/* OBSOLETE return; */
694/* OBSOLETE } */
695/* OBSOLETE else if (regnum == MSP_REGNUM) */
696/* OBSOLETE { */
697/* OBSOLETE if (raw_buffer != NULL) */
698/* OBSOLETE { */
699/* OBSOLETE if (frame->next != NULL) */
700/* OBSOLETE { */
701/* OBSOLETE store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), */
702/* OBSOLETE frame->next->saved_msp); */
703/* OBSOLETE } */
704/* OBSOLETE else */
705/* OBSOLETE read_register_gen (MSP_REGNUM, raw_buffer); */
706/* OBSOLETE } */
707/* OBSOLETE /* The value may have been computed, not fetched. */ */
708/* OBSOLETE if (lvalp != NULL) */
709/* OBSOLETE *lvalp = not_lval; */
710/* OBSOLETE return; */
711/* OBSOLETE } */
712/* OBSOLETE else if (regnum < LR0_REGNUM || regnum >= LR0_REGNUM + 128) */
713/* OBSOLETE { */
714/* OBSOLETE /* These registers are not saved over procedure calls, */
715/* OBSOLETE so just print out the current values. */ */
716/* OBSOLETE if (raw_buffer != NULL) */
717/* OBSOLETE read_register_gen (regnum, raw_buffer); */
718/* OBSOLETE if (lvalp != NULL) */
719/* OBSOLETE *lvalp = lval_register; */
720/* OBSOLETE if (addrp != NULL) */
721/* OBSOLETE *addrp = REGISTER_BYTE (regnum); */
722/* OBSOLETE return; */
723/* OBSOLETE } */
724/* OBSOLETE */
725/* OBSOLETE addr = frame->frame + (regnum - LR0_REGNUM) * 4; */
726/* OBSOLETE if (raw_buffer != NULL) */
727/* OBSOLETE read_register_stack (addr, raw_buffer, &addr, &lval); */
728/* OBSOLETE if (lvalp != NULL) */
729/* OBSOLETE *lvalp = lval; */
730/* OBSOLETE if (addrp != NULL) */
731/* OBSOLETE *addrp = addr; */
732/* OBSOLETE } */
733/* OBSOLETE \f */
734/* OBSOLETE */
735/* OBSOLETE /* Discard from the stack the innermost frame, */
736/* OBSOLETE restoring all saved registers. */ */
737/* OBSOLETE */
738/* OBSOLETE void */
739/* OBSOLETE pop_frame (void) */
740/* OBSOLETE { */
741/* OBSOLETE struct frame_info *frame = get_current_frame (); */
742/* OBSOLETE CORE_ADDR rfb = read_register (RFB_REGNUM); */
743/* OBSOLETE CORE_ADDR gr1 = frame->frame + frame->rsize; */
744/* OBSOLETE CORE_ADDR lr1; */
745/* OBSOLETE CORE_ADDR original_lr0; */
746/* OBSOLETE int must_fix_lr0 = 0; */
747/* OBSOLETE int i; */
748/* OBSOLETE */
749/* OBSOLETE /* If popping a dummy frame, need to restore registers. */ */
750/* OBSOLETE if (PC_IN_CALL_DUMMY (read_register (PC_REGNUM), */
751/* OBSOLETE read_register (SP_REGNUM), */
752/* OBSOLETE FRAME_FP (frame))) */
753/* OBSOLETE { */
754/* OBSOLETE int lrnum = LR0_REGNUM + DUMMY_ARG / 4; */
755/* OBSOLETE for (i = 0; i < DUMMY_SAVE_SR128; ++i) */
756/* OBSOLETE write_register (SR_REGNUM (i + 128), read_register (lrnum++)); */
757/* OBSOLETE for (i = 0; i < DUMMY_SAVE_SR160; ++i) */
758/* OBSOLETE write_register (SR_REGNUM (i + 160), read_register (lrnum++)); */
759/* OBSOLETE for (i = 0; i < DUMMY_SAVE_GREGS; ++i) */
760/* OBSOLETE write_register (RETURN_REGNUM + i, read_register (lrnum++)); */
761/* OBSOLETE /* Restore the PCs and prepare to restore LR0. */ */
762/* OBSOLETE write_register (PC_REGNUM, read_register (lrnum++)); */
763/* OBSOLETE write_register (NPC_REGNUM, read_register (lrnum++)); */
764/* OBSOLETE write_register (PC2_REGNUM, read_register (lrnum++)); */
765/* OBSOLETE original_lr0 = read_register (lrnum++); */
766/* OBSOLETE must_fix_lr0 = 1; */
767/* OBSOLETE } */
768/* OBSOLETE */
769/* OBSOLETE /* Restore the memory stack pointer. */ */
770/* OBSOLETE write_register (MSP_REGNUM, frame->saved_msp); */
771/* OBSOLETE /* Restore the register stack pointer. */ */
772/* OBSOLETE write_register (GR1_REGNUM, gr1); */
773/* OBSOLETE */
774/* OBSOLETE /* If we popped a dummy frame, restore lr0 now that gr1 has been restored. */ */
775/* OBSOLETE if (must_fix_lr0) */
776/* OBSOLETE write_register (LR0_REGNUM, original_lr0); */
777/* OBSOLETE */
778/* OBSOLETE /* Check whether we need to fill registers. */ */
779/* OBSOLETE lr1 = read_register (LR0_REGNUM + 1); */
780/* OBSOLETE if (lr1 > rfb) */
781/* OBSOLETE { */
782/* OBSOLETE /* Fill. */ */
783/* OBSOLETE int num_bytes = lr1 - rfb; */
784/* OBSOLETE int i; */
785/* OBSOLETE long word; */
786/* OBSOLETE */
787/* OBSOLETE write_register (RAB_REGNUM, read_register (RAB_REGNUM) + num_bytes); */
788/* OBSOLETE write_register (RFB_REGNUM, lr1); */
789/* OBSOLETE for (i = 0; i < num_bytes; i += 4) */
790/* OBSOLETE { */
791/* OBSOLETE /* Note: word is in host byte order. */ */
792/* OBSOLETE word = read_memory_integer (rfb + i, 4); */
793/* OBSOLETE write_register (LR0_REGNUM + ((rfb - gr1) % 0x80) + i / 4, word); */
794/* OBSOLETE } */
795/* OBSOLETE } */
796/* OBSOLETE flush_cached_frames (); */
797/* OBSOLETE } */
798/* OBSOLETE */
799/* OBSOLETE /* Push an empty stack frame, to record the current PC, etc. */ */
800/* OBSOLETE */
801/* OBSOLETE void */
802/* OBSOLETE push_dummy_frame (void) */
803/* OBSOLETE { */
804/* OBSOLETE long w; */
805/* OBSOLETE CORE_ADDR rab, gr1; */
806/* OBSOLETE CORE_ADDR msp = read_register (MSP_REGNUM); */
807/* OBSOLETE int lrnum, i; */
808/* OBSOLETE CORE_ADDR original_lr0; */
809/* OBSOLETE */
810/* OBSOLETE /* Read original lr0 before changing gr1. This order isn't really needed */
811/* OBSOLETE since GDB happens to have a snapshot of all the regs and doesn't toss */
812/* OBSOLETE it when gr1 is changed. But it's The Right Thing To Do. */ */
813/* OBSOLETE original_lr0 = read_register (LR0_REGNUM); */
814/* OBSOLETE */
815/* OBSOLETE /* Allocate the new frame. */ */
816/* OBSOLETE gr1 = read_register (GR1_REGNUM) - DUMMY_FRAME_RSIZE; */
817/* OBSOLETE write_register (GR1_REGNUM, gr1); */
818/* OBSOLETE */
819/* OBSOLETE #ifdef VXWORKS_TARGET */
820/* OBSOLETE /* We force re-reading all registers to get the new local registers set */
821/* OBSOLETE after gr1 has been modified. This fix is due to the lack of single */
822/* OBSOLETE register read/write operation in the RPC interface between VxGDB and */
823/* OBSOLETE VxWorks. This really must be changed ! */ */
824/* OBSOLETE */
825/* OBSOLETE vx_read_register (-1); */
826/* OBSOLETE */
827/* OBSOLETE #endif /* VXWORK_TARGET */ */
828/* OBSOLETE */
829/* OBSOLETE rab = read_register (RAB_REGNUM); */
830/* OBSOLETE if (gr1 < rab) */
831/* OBSOLETE { */
832/* OBSOLETE /* We need to spill registers. */ */
833/* OBSOLETE int num_bytes = rab - gr1; */
834/* OBSOLETE CORE_ADDR rfb = read_register (RFB_REGNUM); */
835/* OBSOLETE int i; */
836/* OBSOLETE long word; */
837/* OBSOLETE */
838/* OBSOLETE write_register (RFB_REGNUM, rfb - num_bytes); */
839/* OBSOLETE write_register (RAB_REGNUM, gr1); */
840/* OBSOLETE for (i = 0; i < num_bytes; i += 4) */
841/* OBSOLETE { */
842/* OBSOLETE /* Note: word is in target byte order. */ */
843/* OBSOLETE read_register_gen (LR0_REGNUM + i / 4, (char *) &word); */
844/* OBSOLETE write_memory (rfb - num_bytes + i, (char *) &word, 4); */
845/* OBSOLETE } */
846/* OBSOLETE } */
847/* OBSOLETE */
848/* OBSOLETE /* There are no arguments in to the dummy frame, so we don't need */
849/* OBSOLETE more than rsize plus the return address and lr1. */ */
850/* OBSOLETE write_register (LR0_REGNUM + 1, gr1 + DUMMY_FRAME_RSIZE + 2 * 4); */
851/* OBSOLETE */
852/* OBSOLETE /* Set the memory frame pointer. */ */
853/* OBSOLETE write_register (LR0_REGNUM + DUMMY_FRAME_RSIZE / 4 - 1, msp); */
854/* OBSOLETE */
855/* OBSOLETE /* Allocate arg_slop. */ */
856/* OBSOLETE write_register (MSP_REGNUM, msp - 16 * 4); */
857/* OBSOLETE */
858/* OBSOLETE /* Save registers. */ */
859/* OBSOLETE lrnum = LR0_REGNUM + DUMMY_ARG / 4; */
860/* OBSOLETE for (i = 0; i < DUMMY_SAVE_SR128; ++i) */
861/* OBSOLETE write_register (lrnum++, read_register (SR_REGNUM (i + 128))); */
862/* OBSOLETE for (i = 0; i < DUMMY_SAVE_SR160; ++i) */
863/* OBSOLETE write_register (lrnum++, read_register (SR_REGNUM (i + 160))); */
864/* OBSOLETE for (i = 0; i < DUMMY_SAVE_GREGS; ++i) */
865/* OBSOLETE write_register (lrnum++, read_register (RETURN_REGNUM + i)); */
866/* OBSOLETE /* Save the PCs and LR0. */ */
867/* OBSOLETE write_register (lrnum++, read_register (PC_REGNUM)); */
868/* OBSOLETE write_register (lrnum++, read_register (NPC_REGNUM)); */
869/* OBSOLETE write_register (lrnum++, read_register (PC2_REGNUM)); */
870/* OBSOLETE */
871/* OBSOLETE /* Why are we saving LR0? What would clobber it? (the dummy frame should */
872/* OBSOLETE be below it on the register stack, no?). */ */
873/* OBSOLETE write_register (lrnum++, original_lr0); */
874/* OBSOLETE } */
875/* OBSOLETE */
876/* OBSOLETE */
877/* OBSOLETE */
878/* OBSOLETE /* */
879/* OBSOLETE This routine takes three arguments and makes the cached frames look */
880/* OBSOLETE as if these arguments defined a frame on the cache. This allows the */
881/* OBSOLETE rest of `info frame' to extract the important arguments without much */
882/* OBSOLETE difficulty. Since an individual frame on the 29K is determined by */
883/* OBSOLETE three values (FP, PC, and MSP), we really need all three to do a */
884/* OBSOLETE good job. */ */
885/* OBSOLETE */
886/* OBSOLETE struct frame_info * */
887/* OBSOLETE setup_arbitrary_frame (int argc, CORE_ADDR *argv) */
888/* OBSOLETE { */
889/* OBSOLETE struct frame_info *frame; */
890/* OBSOLETE */
891/* OBSOLETE if (argc != 3) */
892/* OBSOLETE error ("AMD 29k frame specifications require three arguments: rsp pc msp"); */
893/* OBSOLETE */
894/* OBSOLETE frame = create_new_frame (argv[0], argv[1]); */
895/* OBSOLETE */
896/* OBSOLETE if (!frame) */
897/* OBSOLETE internal_error (__FILE__, __LINE__, */
898/* OBSOLETE "create_new_frame returned invalid frame id"); */
899/* OBSOLETE */
900/* OBSOLETE /* Creating a new frame munges the `frame' value from the current */
901/* OBSOLETE GR1, so we restore it again here. FIXME, untangle all this */
902/* OBSOLETE 29K frame stuff... */ */
903/* OBSOLETE frame->frame = argv[0]; */
904/* OBSOLETE */
905/* OBSOLETE /* Our MSP is in argv[2]. It'd be intelligent if we could just */
906/* OBSOLETE save this value in the FRAME. But the way it's set up (FIXME), */
907/* OBSOLETE we must save our caller's MSP. We compute that by adding our */
908/* OBSOLETE memory stack frame size to our MSP. */ */
909/* OBSOLETE frame->saved_msp = argv[2] + frame->msize; */
910/* OBSOLETE */
911/* OBSOLETE return frame; */
912/* OBSOLETE } */
913/* OBSOLETE */
914/* OBSOLETE int */
915/* OBSOLETE gdb_print_insn_a29k (bfd_vma memaddr, disassemble_info *info) */
916/* OBSOLETE { */
917/* OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) */
918/* OBSOLETE return print_insn_big_a29k (memaddr, info); */
919/* OBSOLETE else */
920/* OBSOLETE return print_insn_little_a29k (memaddr, info); */
921/* OBSOLETE } */
922/* OBSOLETE */
923/* OBSOLETE enum a29k_processor_types processor_type = a29k_unknown; */
924/* OBSOLETE */
925/* OBSOLETE void */
926/* OBSOLETE a29k_get_processor_type (void) */
927/* OBSOLETE { */
928/* OBSOLETE unsigned int cfg_reg = (unsigned int) read_register (CFG_REGNUM); */
929/* OBSOLETE */
930/* OBSOLETE /* Most of these don't have freeze mode. */ */
931/* OBSOLETE processor_type = a29k_no_freeze_mode; */
932/* OBSOLETE */
933/* OBSOLETE switch ((cfg_reg >> 28) & 0xf) */
934/* OBSOLETE { */
935/* OBSOLETE case 0: */
936/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29000"); */
937/* OBSOLETE break; */
938/* OBSOLETE case 1: */
939/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29005"); */
940/* OBSOLETE break; */
941/* OBSOLETE case 2: */
942/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29050"); */
943/* OBSOLETE processor_type = a29k_freeze_mode; */
944/* OBSOLETE break; */
945/* OBSOLETE case 3: */
946/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29035"); */
947/* OBSOLETE break; */
948/* OBSOLETE case 4: */
949/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29030"); */
950/* OBSOLETE break; */
951/* OBSOLETE case 5: */
952/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am2920*"); */
953/* OBSOLETE break; */
954/* OBSOLETE case 6: */
955/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am2924*"); */
956/* OBSOLETE break; */
957/* OBSOLETE case 7: */
958/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an Am29040"); */
959/* OBSOLETE break; */
960/* OBSOLETE default: */
961/* OBSOLETE fprintf_filtered (gdb_stderr, "Remote debugging an unknown Am29k\n"); */
962/* OBSOLETE /* Don't bother to print the revision. */ */
963/* OBSOLETE return; */
964/* OBSOLETE } */
965/* OBSOLETE fprintf_filtered (gdb_stderr, " revision %c\n", 'A' + ((cfg_reg >> 24) & 0x0f)); */
966/* OBSOLETE } */
967/* OBSOLETE */
968/* OBSOLETE #ifdef GET_LONGJMP_TARGET */
969/* OBSOLETE /* Figure out where the longjmp will land. We expect that we have just entered */
970/* OBSOLETE longjmp and haven't yet setup the stack frame, so the args are still in the */
971/* OBSOLETE output regs. lr2 (LR2_REGNUM) points at the jmp_buf structure from which we */
972/* OBSOLETE extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. */
973/* OBSOLETE This routine returns true on success */ */
974/* OBSOLETE */
975/* OBSOLETE int */
976/* OBSOLETE get_longjmp_target (CORE_ADDR *pc) */
977/* OBSOLETE { */
978/* OBSOLETE CORE_ADDR jb_addr; */
979/* OBSOLETE char buf[sizeof (CORE_ADDR)]; */
980/* OBSOLETE */
981/* OBSOLETE jb_addr = read_register (LR2_REGNUM); */
982/* OBSOLETE */
983/* OBSOLETE if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, (char *) buf, */
984/* OBSOLETE sizeof (CORE_ADDR))) */
985/* OBSOLETE return 0; */
986/* OBSOLETE */
987/* OBSOLETE *pc = extract_address ((PTR) buf, sizeof (CORE_ADDR)); */
988/* OBSOLETE return 1; */
989/* OBSOLETE } */
990/* OBSOLETE #endif /* GET_LONGJMP_TARGET */ */
991/* OBSOLETE */
992/* OBSOLETE void */
993/* OBSOLETE _initialize_a29k_tdep (void) */
994/* OBSOLETE { */
995/* OBSOLETE extern CORE_ADDR text_end; */
996/* OBSOLETE */
997/* OBSOLETE tm_print_insn = gdb_print_insn_a29k; */
998/* OBSOLETE */
999/* OBSOLETE /* FIXME, there should be a way to make a CORE_ADDR variable settable. */ */
1000/* OBSOLETE add_show_from_set */
1001/* OBSOLETE (add_set_cmd ("rstack_high_address", class_support, var_uinteger, */
1002/* OBSOLETE (char *) &rstack_high_address, */
1003/* OBSOLETE "Set top address in memory of the register stack.\n\ */
1004/* OBSOLETE Attempts to access registers saved above this address will be ignored\n\ */
1005/* OBSOLETE or will produce the value -1.", &setlist), */
1006/* OBSOLETE &showlist); */
1007/* OBSOLETE */
1008/* OBSOLETE /* FIXME, there should be a way to make a CORE_ADDR variable settable. */ */
1009/* OBSOLETE add_show_from_set */
1010/* OBSOLETE (add_set_cmd ("call_scratch_address", class_support, var_uinteger, */
1011/* OBSOLETE (char *) &text_end, */
1012/* OBSOLETE "Set address in memory where small amounts of RAM can be used\n\ */
1013/* OBSOLETE when making function calls into the inferior.", &setlist), */
1014/* OBSOLETE &showlist); */
1015/* OBSOLETE } */
This page took 0.118481 seconds and 4 git commands to generate.