/* Target-machine dependent code for Motorola 88000 series, for GDB.
- Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1988, 1990, 1991, 1994, 1995 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "value.h"
#include "gdbcore.h"
-
#include "symtab.h"
#include "setjmp.h"
#include "value.h"
void frame_find_saved_regs ();
-/* is this target an m88110? Otherwise assume m88100. This has
- relevance for the ways in which we screw with instruction pointers. */
+/* Is this target an m88110? Otherwise assume m88100. This has
+ relevance for the ways in which we screw with instruction pointers. */
+
int target_is_m88110 = 0;
+/* The m88k kernel aligns all instructions on 4-byte boundaries. The
+ kernel also uses the least significant two bits for its own hocus
+ pocus. When gdb receives an address from the kernel, it needs to
+ preserve those right-most two bits, but gdb also needs to be careful
+ to realize that those two bits are not really a part of the address
+ of an instruction. Shrug. */
+
+CORE_ADDR
+m88k_addr_bits_remove (addr)
+ CORE_ADDR addr;
+{
+ return ((addr) & ~3);
+}
+
+
/* Given a GDB frame, determine the address of the calling function's frame.
This will be used to create a new GDB frame struct, and then
INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
-FRAME_ADDR
+CORE_ADDR
frame_chain (thisframe)
- FRAME thisframe;
+ struct frame_info *thisframe;
{
frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
int
frameless_function_invocation (frame)
- FRAME frame;
+ struct frame_info *frame;
{
frame_find_saved_regs (frame, (struct frame_saved_regs *) 0);
}
void
-init_extra_frame_info (fromleaf, fi)
+init_extra_frame_info (fromleaf, frame)
int fromleaf;
- struct frame_info *fi;
+ struct frame_info *frame;
{
- fi->fsr = 0; /* Not yet allocated */
- fi->args_pointer = 0; /* Unknown */
- fi->locals_pointer = 0; /* Unknown */
+ frame->fsr = 0; /* Not yet allocated */
+ frame->args_pointer = 0; /* Unknown */
+ frame->locals_pointer = 0; /* Unknown */
}
\f
/* Examine an m88k function prologue, recording the addresses at which
/* Read a register from frames called by us (or from the hardware regs). */
static int
-read_next_frame_reg(fi, regno)
- FRAME fi;
+read_next_frame_reg(frame, regno)
+ struct frame_info *frame;
int regno;
{
- for (; fi; fi = fi->next) {
- if (regno == SP_REGNUM) return fi->frame;
- else if (fi->fsr->regs[regno])
- return read_memory_integer(fi->fsr->regs[regno], 4);
+ for (; frame; frame = frame->next) {
+ if (regno == SP_REGNUM)
+ return FRAME_FP (frame);
+ else if (frame->fsr->regs[regno])
+ return read_memory_integer(frame->fsr->regs[regno], 4);
}
return read_register(regno);
}
examine_prologue (ip, limit, frame_sp, fsr, fi)
register CORE_ADDR ip;
register CORE_ADDR limit;
- FRAME_ADDR frame_sp;
+ CORE_ADDR frame_sp;
struct frame_saved_regs *fsr;
struct frame_info *fi;
{
prologue. */
CORE_ADDR
-skip_prologue (ip)
+m88k_skip_prologue (ip)
CORE_ADDR (ip);
{
struct frame_saved_regs saved_regs_dummy;
sal = find_pc_line (ip, 0);
limit = (sal.end) ? sal.end : 0xffffffff;
- return (examine_prologue (ip, limit, (FRAME_ADDR) 0, &saved_regs_dummy,
+ return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy,
(struct frame_info *)0 ));
}
ways in the stack frame. sp is even more special:
the address we return for it IS the sp for the next frame.
- We cache the result of doing this in the frame_cache_obstack, since
- it is fairly expensive. */
+ We cache the result of doing this in the frame_obstack, since it is
+ fairly expensive. */
void
frame_find_saved_regs (fi, fsr)
struct frame_saved_regs *fsr;
{
register struct frame_saved_regs *cache_fsr;
- extern struct obstack frame_cache_obstack;
CORE_ADDR ip;
struct symtab_and_line sal;
CORE_ADDR limit;
if (!fi->fsr)
{
cache_fsr = (struct frame_saved_regs *)
- obstack_alloc (&frame_cache_obstack,
- sizeof (struct frame_saved_regs));
+ frame_obstack_alloc (sizeof (struct frame_saved_regs));
memset (cache_fsr, '\0', sizeof (struct frame_saved_regs));
fi->fsr = cache_fsr;
CORE_ADDR
frame_saved_pc (frame)
- FRAME frame;
+ struct frame_info *frame;
{
return read_next_frame_reg(frame, SRP_REGNUM);
}
static void
write_word (sp, word)
CORE_ADDR sp;
- unsigned LONGEST word;
+ ULONGEST word;
{
register int len = REGISTER_SIZE;
char buffer[MAX_REGISTER_RAW_SIZE];
void
pop_frame ()
{
- register FRAME frame = get_current_frame ();
+ register struct frame_info *frame = get_current_frame ();
register CORE_ADDR fp;
register int regnum;
struct frame_saved_regs fsr;
- struct frame_info *fi;
- fi = get_frame_info (frame);
- fp = fi -> frame;
- get_frame_saved_regs (fi, &fsr);
+ fp = FRAME_FP (frame);
+ get_frame_saved_regs (frame, &fsr);
- if (PC_IN_CALL_DUMMY (read_pc(), read_register(SP_REGNUM), FRAME_FP(fi)))
+ if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), FRAME_FP (fi)))
{
/* FIXME: I think get_frame_saved_regs should be handling this so
that we can deal with the saved registers properly (e.g. frame
if (fsr.regs[regnum])
write_register (regnum,
read_memory_integer (fsr.regs[regnum], 4));
- write_pc(frame_saved_pc(frame));
+ write_pc (frame_saved_pc (frame));
}
reinit_frame_cache ();
}
+
+void
+_initialize_m88k_tdep ()
+{
+ tm_print_insn = print_insn_m88k;
+}