* gdb.texinfo (Packets): Fix typos "alligned".
[deliverable/binutils-gdb.git] / gdb / m88k-tdep.c
CommitLineData
7fb623f7
AC
1// OBSOLETE /* Target-machine dependent code for Motorola 88000 series, for GDB.
2// OBSOLETE
3// OBSOLETE Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
4// OBSOLETE 2000, 2001, 2002 Free Software Foundation, Inc.
5// OBSOLETE
6// OBSOLETE This file is part of GDB.
7// OBSOLETE
8// OBSOLETE This program is free software; you can redistribute it and/or modify
9// OBSOLETE it under the terms of the GNU General Public License as published by
10// OBSOLETE the Free Software Foundation; either version 2 of the License, or
11// OBSOLETE (at your option) any later version.
12// OBSOLETE
13// OBSOLETE This program is distributed in the hope that it will be useful,
14// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
15// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// OBSOLETE GNU General Public License for more details.
17// OBSOLETE
18// OBSOLETE You should have received a copy of the GNU General Public License
19// OBSOLETE along with this program; if not, write to the Free Software
20// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
21// OBSOLETE Boston, MA 02111-1307, USA. */
22// OBSOLETE
23// OBSOLETE #include "defs.h"
24// OBSOLETE #include "frame.h"
25// OBSOLETE #include "inferior.h"
26// OBSOLETE #include "value.h"
27// OBSOLETE #include "gdbcore.h"
28// OBSOLETE #include "symtab.h"
29// OBSOLETE #include "setjmp.h"
30// OBSOLETE #include "value.h"
31// OBSOLETE #include "regcache.h"
32// OBSOLETE
33// OBSOLETE /* Size of an instruction */
34// OBSOLETE #define BYTES_PER_88K_INSN 4
35// OBSOLETE
36// OBSOLETE void frame_find_saved_regs ();
37// OBSOLETE
38// OBSOLETE /* Is this target an m88110? Otherwise assume m88100. This has
39// OBSOLETE relevance for the ways in which we screw with instruction pointers. */
40// OBSOLETE
41// OBSOLETE int target_is_m88110 = 0;
42// OBSOLETE
43// OBSOLETE void
44// OBSOLETE m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid)
45// OBSOLETE {
46// OBSOLETE /* According to the MC88100 RISC Microprocessor User's Manual,
47// OBSOLETE section 6.4.3.1.2:
48// OBSOLETE
49// OBSOLETE ... can be made to return to a particular instruction by placing
50// OBSOLETE a valid instruction address in the SNIP and the next sequential
51// OBSOLETE instruction address in the SFIP (with V bits set and E bits
52// OBSOLETE clear). The rte resumes execution at the instruction pointed to
53// OBSOLETE by the SNIP, then the SFIP.
54// OBSOLETE
55// OBSOLETE The E bit is the least significant bit (bit 0). The V (valid)
56// OBSOLETE bit is bit 1. This is why we logical or 2 into the values we are
57// OBSOLETE writing below. It turns out that SXIP plays no role when
58// OBSOLETE returning from an exception so nothing special has to be done
59// OBSOLETE with it. We could even (presumably) give it a totally bogus
60// OBSOLETE value.
61// OBSOLETE
62// OBSOLETE -- Kevin Buettner */
63// OBSOLETE
64// OBSOLETE write_register_pid (SXIP_REGNUM, pc, ptid);
65// OBSOLETE write_register_pid (SNIP_REGNUM, (pc | 2), ptid);
66// OBSOLETE write_register_pid (SFIP_REGNUM, (pc | 2) + 4, ptid);
67// OBSOLETE }
68// OBSOLETE
69// OBSOLETE /* The type of a register. */
70// OBSOLETE struct type *
71// OBSOLETE m88k_register_type (int regnum)
72// OBSOLETE {
73// OBSOLETE if (regnum >= XFP_REGNUM)
74// OBSOLETE return builtin_type_m88110_ext;
75// OBSOLETE else if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM)
76// OBSOLETE return builtin_type_void_func_ptr;
77// OBSOLETE else
78// OBSOLETE return builtin_type_int32;
79// OBSOLETE }
80// OBSOLETE
81// OBSOLETE
82// OBSOLETE /* The m88k kernel aligns all instructions on 4-byte boundaries. The
83// OBSOLETE kernel also uses the least significant two bits for its own hocus
84// OBSOLETE pocus. When gdb receives an address from the kernel, it needs to
85// OBSOLETE preserve those right-most two bits, but gdb also needs to be careful
86// OBSOLETE to realize that those two bits are not really a part of the address
87// OBSOLETE of an instruction. Shrug. */
88// OBSOLETE
89// OBSOLETE CORE_ADDR
90// OBSOLETE m88k_addr_bits_remove (CORE_ADDR addr)
91// OBSOLETE {
92// OBSOLETE return ((addr) & ~3);
93// OBSOLETE }
94// OBSOLETE
95// OBSOLETE
96// OBSOLETE /* Given a GDB frame, determine the address of the calling function's frame.
97// OBSOLETE This will be used to create a new GDB frame struct, and then
98// OBSOLETE INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
99// OBSOLETE
100// OBSOLETE For us, the frame address is its stack pointer value, so we look up
101// OBSOLETE the function prologue to determine the caller's sp value, and return it. */
102// OBSOLETE
103// OBSOLETE CORE_ADDR
104// OBSOLETE frame_chain (struct frame_info *thisframe)
105// OBSOLETE {
106// OBSOLETE
107// OBSOLETE frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
108// OBSOLETE /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not
109// OBSOLETE the ADDRESS, of SP_REGNUM. It also depends on the cache of
110// OBSOLETE frame_find_saved_regs results. */
111// OBSOLETE if (thisframe->fsr->regs[SP_REGNUM])
112// OBSOLETE return thisframe->fsr->regs[SP_REGNUM];
113// OBSOLETE else
114// OBSOLETE return thisframe->frame; /* Leaf fn -- next frame up has same SP. */
115// OBSOLETE }
116// OBSOLETE
117// OBSOLETE int
118// OBSOLETE frameless_function_invocation (struct frame_info *frame)
119// OBSOLETE {
120// OBSOLETE
121// OBSOLETE frame_find_saved_regs (frame, (struct frame_saved_regs *) 0);
122// OBSOLETE /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not
123// OBSOLETE the ADDRESS, of SP_REGNUM. It also depends on the cache of
124// OBSOLETE frame_find_saved_regs results. */
125// OBSOLETE if (frame->fsr->regs[SP_REGNUM])
126// OBSOLETE return 0; /* Frameful -- return addr saved somewhere */
127// OBSOLETE else
128// OBSOLETE return 1; /* Frameless -- no saved return address */
129// OBSOLETE }
130// OBSOLETE
131// OBSOLETE void
132// OBSOLETE init_extra_frame_info (int fromleaf, struct frame_info *frame)
133// OBSOLETE {
134// OBSOLETE frame->fsr = 0; /* Not yet allocated */
135// OBSOLETE frame->args_pointer = 0; /* Unknown */
136// OBSOLETE frame->locals_pointer = 0; /* Unknown */
137// OBSOLETE }
138// OBSOLETE \f
139// OBSOLETE /* Examine an m88k function prologue, recording the addresses at which
140// OBSOLETE registers are saved explicitly by the prologue code, and returning
141// OBSOLETE the address of the first instruction after the prologue (but not
142// OBSOLETE after the instruction at address LIMIT, as explained below).
143// OBSOLETE
144// OBSOLETE LIMIT places an upper bound on addresses of the instructions to be
145// OBSOLETE examined. If the prologue code scan reaches LIMIT, the scan is
146// OBSOLETE aborted and LIMIT is returned. This is used, when examining the
147// OBSOLETE prologue for the current frame, to keep examine_prologue () from
148// OBSOLETE claiming that a given register has been saved when in fact the
149// OBSOLETE instruction that saves it has not yet been executed. LIMIT is used
150// OBSOLETE at other times to stop the scan when we hit code after the true
151// OBSOLETE function prologue (e.g. for the first source line) which might
152// OBSOLETE otherwise be mistaken for function prologue.
153// OBSOLETE
154// OBSOLETE The format of the function prologue matched by this routine is
155// OBSOLETE derived from examination of the source to gcc 1.95, particularly
156// OBSOLETE the routine output_prologue () in config/out-m88k.c.
157// OBSOLETE
158// OBSOLETE subu r31,r31,n # stack pointer update
159// OBSOLETE
160// OBSOLETE (st rn,r31,offset)? # save incoming regs
161// OBSOLETE (st.d rn,r31,offset)?
162// OBSOLETE
163// OBSOLETE (addu r30,r31,n)? # frame pointer update
164// OBSOLETE
165// OBSOLETE (pic sequence)? # PIC code prologue
166// OBSOLETE
167// OBSOLETE (or rn,rm,0)? # Move parameters to other regs
168// OBSOLETE */
169// OBSOLETE
170// OBSOLETE /* Macros for extracting fields from instructions. */
171// OBSOLETE
172// OBSOLETE #define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos))
173// OBSOLETE #define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width))
174// OBSOLETE #define SUBU_OFFSET(x) ((unsigned)(x & 0xFFFF))
175// OBSOLETE #define ST_OFFSET(x) ((unsigned)((x) & 0xFFFF))
176// OBSOLETE #define ST_SRC(x) EXTRACT_FIELD ((x), 21, 5)
177// OBSOLETE #define ADDU_OFFSET(x) ((unsigned)(x & 0xFFFF))
178// OBSOLETE
179// OBSOLETE /*
180// OBSOLETE * prologue_insn_tbl is a table of instructions which may comprise a
181// OBSOLETE * function prologue. Associated with each table entry (corresponding
182// OBSOLETE * to a single instruction or group of instructions), is an action.
183// OBSOLETE * This action is used by examine_prologue (below) to determine
184// OBSOLETE * the state of certain machine registers and where the stack frame lives.
185// OBSOLETE */
186// OBSOLETE
187// OBSOLETE enum prologue_insn_action
188// OBSOLETE {
189// OBSOLETE PIA_SKIP, /* don't care what the instruction does */
190// OBSOLETE PIA_NOTE_ST, /* note register stored and where */
191// OBSOLETE PIA_NOTE_STD, /* note pair of registers stored and where */
192// OBSOLETE PIA_NOTE_SP_ADJUSTMENT, /* note stack pointer adjustment */
193// OBSOLETE PIA_NOTE_FP_ASSIGNMENT, /* note frame pointer assignment */
194// OBSOLETE PIA_NOTE_PROLOGUE_END, /* no more prologue */
195// OBSOLETE };
196// OBSOLETE
197// OBSOLETE struct prologue_insns
198// OBSOLETE {
199// OBSOLETE unsigned long insn;
200// OBSOLETE unsigned long mask;
201// OBSOLETE enum prologue_insn_action action;
202// OBSOLETE };
203// OBSOLETE
204// OBSOLETE struct prologue_insns prologue_insn_tbl[] =
205// OBSOLETE {
206// OBSOLETE /* Various register move instructions */
207// OBSOLETE {0x58000000, 0xf800ffff, PIA_SKIP}, /* or/or.u with immed of 0 */
208// OBSOLETE {0xf4005800, 0xfc1fffe0, PIA_SKIP}, /* or rd, r0, rs */
209// OBSOLETE {0xf4005800, 0xfc00ffff, PIA_SKIP}, /* or rd, rs, r0 */
210// OBSOLETE
211// OBSOLETE /* Stack pointer setup: "subu sp, sp, n" where n is a multiple of 8 */
212// OBSOLETE {0x67ff0000, 0xffff0007, PIA_NOTE_SP_ADJUSTMENT},
213// OBSOLETE
214// OBSOLETE /* Frame pointer assignment: "addu r30, r31, n" */
215// OBSOLETE {0x63df0000, 0xffff0000, PIA_NOTE_FP_ASSIGNMENT},
216// OBSOLETE
217// OBSOLETE /* Store to stack instructions; either "st rx, sp, n" or "st.d rx, sp, n" */
218// OBSOLETE {0x241f0000, 0xfc1f0000, PIA_NOTE_ST}, /* st rx, sp, n */
219// OBSOLETE {0x201f0000, 0xfc1f0000, PIA_NOTE_STD}, /* st.d rs, sp, n */
220// OBSOLETE
221// OBSOLETE /* Instructions needed for setting up r25 for pic code. */
222// OBSOLETE {0x5f200000, 0xffff0000, PIA_SKIP}, /* or.u r25, r0, offset_high */
223// OBSOLETE {0xcc000002, 0xffffffff, PIA_SKIP}, /* bsr.n Lab */
224// OBSOLETE {0x5b390000, 0xffff0000, PIA_SKIP}, /* or r25, r25, offset_low */
225// OBSOLETE {0xf7396001, 0xffffffff, PIA_SKIP}, /* Lab: addu r25, r25, r1 */
226// OBSOLETE
227// OBSOLETE /* Various branch or jump instructions which have a delay slot -- these
228// OBSOLETE do not form part of the prologue, but the instruction in the delay
229// OBSOLETE slot might be a store instruction which should be noted. */
230// OBSOLETE {0xc4000000, 0xe4000000, PIA_NOTE_PROLOGUE_END},
231// OBSOLETE /* br.n, bsr.n, bb0.n, or bb1.n */
232// OBSOLETE {0xec000000, 0xfc000000, PIA_NOTE_PROLOGUE_END}, /* bcnd.n */
233// OBSOLETE {0xf400c400, 0xfffff7e0, PIA_NOTE_PROLOGUE_END} /* jmp.n or jsr.n */
234// OBSOLETE
235// OBSOLETE };
236// OBSOLETE
237// OBSOLETE
238// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
239// OBSOLETE is not the address of a valid instruction, the address of the next
240// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word
241// OBSOLETE of the instruction. */
242// OBSOLETE
243// OBSOLETE #define NEXT_PROLOGUE_INSN(addr, lim, pword1) \
244// OBSOLETE (((addr) < (lim)) ? next_insn (addr, pword1) : 0)
245// OBSOLETE
246// OBSOLETE /* Read the m88k instruction at 'memaddr' and return the address of
247// OBSOLETE the next instruction after that, or 0 if 'memaddr' is not the
248// OBSOLETE address of a valid instruction. The instruction
249// OBSOLETE is stored at 'pword1'. */
250// OBSOLETE
251// OBSOLETE CORE_ADDR
252// OBSOLETE next_insn (CORE_ADDR memaddr, unsigned long *pword1)
253// OBSOLETE {
254// OBSOLETE *pword1 = read_memory_integer (memaddr, BYTES_PER_88K_INSN);
255// OBSOLETE return memaddr + BYTES_PER_88K_INSN;
256// OBSOLETE }
257// OBSOLETE
258// OBSOLETE /* Read a register from frames called by us (or from the hardware regs). */
259// OBSOLETE
260// OBSOLETE static int
261// OBSOLETE read_next_frame_reg (struct frame_info *frame, int regno)
262// OBSOLETE {
263// OBSOLETE for (; frame; frame = frame->next)
264// OBSOLETE {
265// OBSOLETE if (regno == SP_REGNUM)
266// OBSOLETE return FRAME_FP (frame);
267// OBSOLETE else if (frame->fsr->regs[regno])
268// OBSOLETE return read_memory_integer (frame->fsr->regs[regno], 4);
269// OBSOLETE }
270// OBSOLETE return read_register (regno);
271// OBSOLETE }
272// OBSOLETE
273// OBSOLETE /* Examine the prologue of a function. `ip' points to the first instruction.
274// OBSOLETE `limit' is the limit of the prologue (e.g. the addr of the first
275// OBSOLETE linenumber, or perhaps the program counter if we're stepping through).
276// OBSOLETE `frame_sp' is the stack pointer value in use in this frame.
277// OBSOLETE `fsr' is a pointer to a frame_saved_regs structure into which we put
278// OBSOLETE info about the registers saved by this frame.
279// OBSOLETE `fi' is a struct frame_info pointer; we fill in various fields in it
280// OBSOLETE to reflect the offsets of the arg pointer and the locals pointer. */
281// OBSOLETE
282// OBSOLETE static CORE_ADDR
283// OBSOLETE examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
284// OBSOLETE CORE_ADDR frame_sp, struct frame_saved_regs *fsr,
285// OBSOLETE struct frame_info *fi)
286// OBSOLETE {
287// OBSOLETE register CORE_ADDR next_ip;
288// OBSOLETE register int src;
289// OBSOLETE unsigned long insn;
290// OBSOLETE int size, offset;
291// OBSOLETE char must_adjust[32]; /* If set, must adjust offsets in fsr */
292// OBSOLETE int sp_offset = -1; /* -1 means not set (valid must be mult of 8) */
293// OBSOLETE int fp_offset = -1; /* -1 means not set */
294// OBSOLETE CORE_ADDR frame_fp;
295// OBSOLETE CORE_ADDR prologue_end = 0;
296// OBSOLETE
297// OBSOLETE memset (must_adjust, '\0', sizeof (must_adjust));
298// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn);
299// OBSOLETE
300// OBSOLETE while (next_ip)
301// OBSOLETE {
302// OBSOLETE struct prologue_insns *pip;
303// OBSOLETE
304// OBSOLETE for (pip = prologue_insn_tbl; (insn & pip->mask) != pip->insn;)
305// OBSOLETE if (++pip >= prologue_insn_tbl + sizeof prologue_insn_tbl)
306// OBSOLETE goto end_of_prologue_found; /* not a prologue insn */
307// OBSOLETE
308// OBSOLETE switch (pip->action)
309// OBSOLETE {
310// OBSOLETE case PIA_NOTE_ST:
311// OBSOLETE case PIA_NOTE_STD:
312// OBSOLETE if (sp_offset != -1)
313// OBSOLETE {
314// OBSOLETE src = ST_SRC (insn);
315// OBSOLETE offset = ST_OFFSET (insn);
316// OBSOLETE must_adjust[src] = 1;
317// OBSOLETE fsr->regs[src++] = offset; /* Will be adjusted later */
318// OBSOLETE if (pip->action == PIA_NOTE_STD && src < 32)
319// OBSOLETE {
320// OBSOLETE offset += 4;
321// OBSOLETE must_adjust[src] = 1;
322// OBSOLETE fsr->regs[src++] = offset;
323// OBSOLETE }
324// OBSOLETE }
325// OBSOLETE else
326// OBSOLETE goto end_of_prologue_found;
327// OBSOLETE break;
328// OBSOLETE case PIA_NOTE_SP_ADJUSTMENT:
329// OBSOLETE if (sp_offset == -1)
330// OBSOLETE sp_offset = -SUBU_OFFSET (insn);
331// OBSOLETE else
332// OBSOLETE goto end_of_prologue_found;
333// OBSOLETE break;
334// OBSOLETE case PIA_NOTE_FP_ASSIGNMENT:
335// OBSOLETE if (fp_offset == -1)
336// OBSOLETE fp_offset = ADDU_OFFSET (insn);
337// OBSOLETE else
338// OBSOLETE goto end_of_prologue_found;
339// OBSOLETE break;
340// OBSOLETE case PIA_NOTE_PROLOGUE_END:
341// OBSOLETE if (!prologue_end)
342// OBSOLETE prologue_end = ip;
343// OBSOLETE break;
344// OBSOLETE case PIA_SKIP:
345// OBSOLETE default:
346// OBSOLETE /* Do nothing */
347// OBSOLETE break;
348// OBSOLETE }
349// OBSOLETE
350// OBSOLETE ip = next_ip;
351// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn);
352// OBSOLETE }
353// OBSOLETE
354// OBSOLETE end_of_prologue_found:
355// OBSOLETE
356// OBSOLETE if (prologue_end)
357// OBSOLETE ip = prologue_end;
358// OBSOLETE
359// OBSOLETE /* We're done with the prologue. If we don't care about the stack
360// OBSOLETE frame itself, just return. (Note that fsr->regs has been trashed,
361// OBSOLETE but the one caller who calls with fi==0 passes a dummy there.) */
362// OBSOLETE
363// OBSOLETE if (fi == 0)
364// OBSOLETE return ip;
365// OBSOLETE
366// OBSOLETE /*
367// OBSOLETE OK, now we have:
368// OBSOLETE
369// OBSOLETE sp_offset original (before any alloca calls) displacement of SP
370// OBSOLETE (will be negative).
371// OBSOLETE
372// OBSOLETE fp_offset displacement from original SP to the FP for this frame
373// OBSOLETE or -1.
374// OBSOLETE
375// OBSOLETE fsr->regs[0..31] displacement from original SP to the stack
376// OBSOLETE location where reg[0..31] is stored.
377// OBSOLETE
378// OBSOLETE must_adjust[0..31] set if corresponding offset was set.
379// OBSOLETE
380// OBSOLETE If alloca has been called between the function prologue and the current
381// OBSOLETE IP, then the current SP (frame_sp) will not be the original SP as set by
382// OBSOLETE the function prologue. If the current SP is not the original SP, then the
383// OBSOLETE compiler will have allocated an FP for this frame, fp_offset will be set,
384// OBSOLETE and we can use it to calculate the original SP.
385// OBSOLETE
386// OBSOLETE Then, we figure out where the arguments and locals are, and relocate the
387// OBSOLETE offsets in fsr->regs to absolute addresses. */
388// OBSOLETE
389// OBSOLETE if (fp_offset != -1)
390// OBSOLETE {
391// OBSOLETE /* We have a frame pointer, so get it, and base our calc's on it. */
392// OBSOLETE frame_fp = (CORE_ADDR) read_next_frame_reg (fi->next, ACTUAL_FP_REGNUM);
393// OBSOLETE frame_sp = frame_fp - fp_offset;
394// OBSOLETE }
395// OBSOLETE else
396// OBSOLETE {
397// OBSOLETE /* We have no frame pointer, therefore frame_sp is still the same value
398// OBSOLETE as set by prologue. But where is the frame itself? */
399// OBSOLETE if (must_adjust[SRP_REGNUM])
400// OBSOLETE {
401// OBSOLETE /* Function header saved SRP (r1), the return address. Frame starts
402// OBSOLETE 4 bytes down from where it was saved. */
403// OBSOLETE frame_fp = frame_sp + fsr->regs[SRP_REGNUM] - 4;
404// OBSOLETE fi->locals_pointer = frame_fp;
405// OBSOLETE }
406// OBSOLETE else
407// OBSOLETE {
408// OBSOLETE /* Function header didn't save SRP (r1), so we are in a leaf fn or
409// OBSOLETE are otherwise confused. */
410// OBSOLETE frame_fp = -1;
411// OBSOLETE }
412// OBSOLETE }
413// OBSOLETE
414// OBSOLETE /* The locals are relative to the FP (whether it exists as an allocated
415// OBSOLETE register, or just as an assumed offset from the SP) */
416// OBSOLETE fi->locals_pointer = frame_fp;
417// OBSOLETE
418// OBSOLETE /* The arguments are just above the SP as it was before we adjusted it
419// OBSOLETE on entry. */
420// OBSOLETE fi->args_pointer = frame_sp - sp_offset;
421// OBSOLETE
422// OBSOLETE /* Now that we know the SP value used by the prologue, we know where
423// OBSOLETE it saved all the registers. */
424// OBSOLETE for (src = 0; src < 32; src++)
425// OBSOLETE if (must_adjust[src])
426// OBSOLETE fsr->regs[src] += frame_sp;
427// OBSOLETE
428// OBSOLETE /* The saved value of the SP is always known. */
429// OBSOLETE /* (we hope...) */
430// OBSOLETE if (fsr->regs[SP_REGNUM] != 0
431// OBSOLETE && fsr->regs[SP_REGNUM] != frame_sp - sp_offset)
432// OBSOLETE fprintf_unfiltered (gdb_stderr, "Bad saved SP value %lx != %lx, offset %x!\n",
433// OBSOLETE fsr->regs[SP_REGNUM],
434// OBSOLETE frame_sp - sp_offset, sp_offset);
435// OBSOLETE
436// OBSOLETE fsr->regs[SP_REGNUM] = frame_sp - sp_offset;
437// OBSOLETE
438// OBSOLETE return (ip);
439// OBSOLETE }
440// OBSOLETE
441// OBSOLETE /* Given an ip value corresponding to the start of a function,
442// OBSOLETE return the ip of the first instruction after the function
443// OBSOLETE prologue. */
444// OBSOLETE
445// OBSOLETE CORE_ADDR
446// OBSOLETE m88k_skip_prologue (CORE_ADDR ip)
447// OBSOLETE {
448// OBSOLETE struct frame_saved_regs saved_regs_dummy;
449// OBSOLETE struct symtab_and_line sal;
450// OBSOLETE CORE_ADDR limit;
451// OBSOLETE
452// OBSOLETE sal = find_pc_line (ip, 0);
453// OBSOLETE limit = (sal.end) ? sal.end : 0xffffffff;
454// OBSOLETE
455// OBSOLETE return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy,
456// OBSOLETE (struct frame_info *) 0));
457// OBSOLETE }
458// OBSOLETE
459// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
460// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO.
461// OBSOLETE This includes special registers such as pc and fp saved in special
462// OBSOLETE ways in the stack frame. sp is even more special:
463// OBSOLETE the address we return for it IS the sp for the next frame.
464// OBSOLETE
465// OBSOLETE We cache the result of doing this in the frame_obstack, since it is
466// OBSOLETE fairly expensive. */
467// OBSOLETE
468// OBSOLETE void
469// OBSOLETE frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr)
470// OBSOLETE {
471// OBSOLETE register struct frame_saved_regs *cache_fsr;
472// OBSOLETE CORE_ADDR ip;
473// OBSOLETE struct symtab_and_line sal;
474// OBSOLETE CORE_ADDR limit;
475// OBSOLETE
476// OBSOLETE if (!fi->fsr)
477// OBSOLETE {
478// OBSOLETE cache_fsr = (struct frame_saved_regs *)
479// OBSOLETE frame_obstack_alloc (sizeof (struct frame_saved_regs));
480// OBSOLETE memset (cache_fsr, '\0', sizeof (struct frame_saved_regs));
481// OBSOLETE fi->fsr = cache_fsr;
482// OBSOLETE
483// OBSOLETE /* Find the start and end of the function prologue. If the PC
484// OBSOLETE is in the function prologue, we only consider the part that
485// OBSOLETE has executed already. In the case where the PC is not in
486// OBSOLETE the function prologue, we set limit to two instructions beyond
487// OBSOLETE where the prologue ends in case if any of the prologue instructions
488// OBSOLETE were moved into a delay slot of a branch instruction. */
489// OBSOLETE
490// OBSOLETE ip = get_pc_function_start (fi->pc);
491// OBSOLETE sal = find_pc_line (ip, 0);
492// OBSOLETE limit = (sal.end && sal.end < fi->pc) ? sal.end + 2 * BYTES_PER_88K_INSN
493// OBSOLETE : fi->pc;
494// OBSOLETE
495// OBSOLETE /* This will fill in fields in *fi as well as in cache_fsr. */
496// OBSOLETE #ifdef SIGTRAMP_FRAME_FIXUP
497// OBSOLETE if (fi->signal_handler_caller)
498// OBSOLETE SIGTRAMP_FRAME_FIXUP (fi->frame);
499// OBSOLETE #endif
500// OBSOLETE examine_prologue (ip, limit, fi->frame, cache_fsr, fi);
501// OBSOLETE #ifdef SIGTRAMP_SP_FIXUP
502// OBSOLETE if (fi->signal_handler_caller && fi->fsr->regs[SP_REGNUM])
503// OBSOLETE SIGTRAMP_SP_FIXUP (fi->fsr->regs[SP_REGNUM]);
504// OBSOLETE #endif
505// OBSOLETE }
506// OBSOLETE
507// OBSOLETE if (fsr)
508// OBSOLETE *fsr = *fi->fsr;
509// OBSOLETE }
510// OBSOLETE
511// OBSOLETE /* Return the address of the locals block for the frame
512// OBSOLETE described by FI. Returns 0 if the address is unknown.
513// OBSOLETE NOTE! Frame locals are referred to by negative offsets from the
514// OBSOLETE argument pointer, so this is the same as frame_args_address(). */
515// OBSOLETE
516// OBSOLETE CORE_ADDR
517// OBSOLETE frame_locals_address (struct frame_info *fi)
518// OBSOLETE {
519// OBSOLETE struct frame_saved_regs fsr;
520// OBSOLETE
521// OBSOLETE if (fi->args_pointer) /* Cached value is likely there. */
522// OBSOLETE return fi->args_pointer;
523// OBSOLETE
524// OBSOLETE /* Nope, generate it. */
525// OBSOLETE
526// OBSOLETE get_frame_saved_regs (fi, &fsr);
527// OBSOLETE
528// OBSOLETE return fi->args_pointer;
529// OBSOLETE }
530// OBSOLETE
531// OBSOLETE /* Return the address of the argument block for the frame
532// OBSOLETE described by FI. Returns 0 if the address is unknown. */
533// OBSOLETE
534// OBSOLETE CORE_ADDR
535// OBSOLETE frame_args_address (struct frame_info *fi)
536// OBSOLETE {
537// OBSOLETE struct frame_saved_regs fsr;
538// OBSOLETE
539// OBSOLETE if (fi->args_pointer) /* Cached value is likely there. */
540// OBSOLETE return fi->args_pointer;
541// OBSOLETE
542// OBSOLETE /* Nope, generate it. */
543// OBSOLETE
544// OBSOLETE get_frame_saved_regs (fi, &fsr);
545// OBSOLETE
546// OBSOLETE return fi->args_pointer;
547// OBSOLETE }
548// OBSOLETE
549// OBSOLETE /* Return the saved PC from this frame.
550// OBSOLETE
551// OBSOLETE If the frame has a memory copy of SRP_REGNUM, use that. If not,
552// OBSOLETE just use the register SRP_REGNUM itself. */
553// OBSOLETE
554// OBSOLETE CORE_ADDR
555// OBSOLETE frame_saved_pc (struct frame_info *frame)
556// OBSOLETE {
557// OBSOLETE return read_next_frame_reg (frame, SRP_REGNUM);
558// OBSOLETE }
559// OBSOLETE
560// OBSOLETE
561// OBSOLETE #define DUMMY_FRAME_SIZE 192
562// OBSOLETE
563// OBSOLETE static void
564// OBSOLETE write_word (CORE_ADDR sp, ULONGEST word)
565// OBSOLETE {
566// OBSOLETE register int len = REGISTER_SIZE;
567// OBSOLETE char buffer[MAX_REGISTER_RAW_SIZE];
568// OBSOLETE
569// OBSOLETE store_unsigned_integer (buffer, len, word);
570// OBSOLETE write_memory (sp, buffer, len);
571// OBSOLETE }
572// OBSOLETE
573// OBSOLETE void
574// OBSOLETE m88k_push_dummy_frame (void)
575// OBSOLETE {
576// OBSOLETE register CORE_ADDR sp = read_register (SP_REGNUM);
577// OBSOLETE register int rn;
578// OBSOLETE int offset;
579// OBSOLETE
580// OBSOLETE sp -= DUMMY_FRAME_SIZE; /* allocate a bunch of space */
581// OBSOLETE
582// OBSOLETE for (rn = 0, offset = 0; rn <= SP_REGNUM; rn++, offset += 4)
583// OBSOLETE write_word (sp + offset, read_register (rn));
584// OBSOLETE
585// OBSOLETE write_word (sp + offset, read_register (SXIP_REGNUM));
586// OBSOLETE offset += 4;
587// OBSOLETE
588// OBSOLETE write_word (sp + offset, read_register (SNIP_REGNUM));
589// OBSOLETE offset += 4;
590// OBSOLETE
591// OBSOLETE write_word (sp + offset, read_register (SFIP_REGNUM));
592// OBSOLETE offset += 4;
593// OBSOLETE
594// OBSOLETE write_word (sp + offset, read_register (PSR_REGNUM));
595// OBSOLETE offset += 4;
596// OBSOLETE
597// OBSOLETE write_word (sp + offset, read_register (FPSR_REGNUM));
598// OBSOLETE offset += 4;
599// OBSOLETE
600// OBSOLETE write_word (sp + offset, read_register (FPCR_REGNUM));
601// OBSOLETE offset += 4;
602// OBSOLETE
603// OBSOLETE write_register (SP_REGNUM, sp);
604// OBSOLETE write_register (ACTUAL_FP_REGNUM, sp);
605// OBSOLETE }
606// OBSOLETE
607// OBSOLETE void
608// OBSOLETE pop_frame (void)
609// OBSOLETE {
610// OBSOLETE register struct frame_info *frame = get_current_frame ();
611// OBSOLETE register int regnum;
612// OBSOLETE struct frame_saved_regs fsr;
613// OBSOLETE
614// OBSOLETE get_frame_saved_regs (frame, &fsr);
615// OBSOLETE
616// OBSOLETE if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), frame->frame))
617// OBSOLETE {
618// OBSOLETE /* FIXME: I think get_frame_saved_regs should be handling this so
619// OBSOLETE that we can deal with the saved registers properly (e.g. frame
620// OBSOLETE 1 is a call dummy, the user types "frame 2" and then "print $ps"). */
621// OBSOLETE register CORE_ADDR sp = read_register (ACTUAL_FP_REGNUM);
622// OBSOLETE int offset;
623// OBSOLETE
624// OBSOLETE for (regnum = 0, offset = 0; regnum <= SP_REGNUM; regnum++, offset += 4)
625// OBSOLETE (void) write_register (regnum, read_memory_integer (sp + offset, 4));
626// OBSOLETE
627// OBSOLETE write_register (SXIP_REGNUM, read_memory_integer (sp + offset, 4));
628// OBSOLETE offset += 4;
629// OBSOLETE
630// OBSOLETE write_register (SNIP_REGNUM, read_memory_integer (sp + offset, 4));
631// OBSOLETE offset += 4;
632// OBSOLETE
633// OBSOLETE write_register (SFIP_REGNUM, read_memory_integer (sp + offset, 4));
634// OBSOLETE offset += 4;
635// OBSOLETE
636// OBSOLETE write_register (PSR_REGNUM, read_memory_integer (sp + offset, 4));
637// OBSOLETE offset += 4;
638// OBSOLETE
639// OBSOLETE write_register (FPSR_REGNUM, read_memory_integer (sp + offset, 4));
640// OBSOLETE offset += 4;
641// OBSOLETE
642// OBSOLETE write_register (FPCR_REGNUM, read_memory_integer (sp + offset, 4));
643// OBSOLETE offset += 4;
644// OBSOLETE
645// OBSOLETE }
646// OBSOLETE else
647// OBSOLETE {
648// OBSOLETE for (regnum = FP_REGNUM; regnum > 0; regnum--)
649// OBSOLETE if (fsr.regs[regnum])
650// OBSOLETE write_register (regnum,
651// OBSOLETE read_memory_integer (fsr.regs[regnum], 4));
652// OBSOLETE write_pc (frame_saved_pc (frame));
653// OBSOLETE }
654// OBSOLETE reinit_frame_cache ();
655// OBSOLETE }
656// OBSOLETE
657// OBSOLETE void
658// OBSOLETE _initialize_m88k_tdep (void)
659// OBSOLETE {
660// OBSOLETE tm_print_insn = print_insn_m88k;
661// OBSOLETE }
This page took 0.072631 seconds and 4 git commands to generate.