/* Target-dependent code for the Motorola 68000 series.
- Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GDB.
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
-#include "floatformat.h"
+#include "gdbtypes.h"
#include "symtab.h"
#include "gdbcore.h"
#include "value.h"
#define P_MOVEL_SP 0x2f00
#define P_MOVEML_SP 0x48e7
-
-#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
-#define REGISTER_BYTES_NOFP (16*4 + 8)
-
/* Offset from SP to first arg on stack at first instruction of a function */
#define SP_ARG0 (1 * 4)
return break_insn;
}
-
-static int
-m68k_register_bytes_ok (long numbytes)
-{
- return ((numbytes == REGISTER_BYTES_FP)
- || (numbytes == REGISTER_BYTES_NOFP));
-}
-
/* Return the GDB type object for the "standard" data type of data in
register N. This should be int for D0-D7, SR, FPCONTROL and
FPSTATUS, long double for FP0-FP7, and void pointer for all others
/* pc */
return M68K_PC_REGNUM;
else
- return NUM_REGS + NUM_PSEUDO_REGS;
+ return gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch);
}
\f
else
break;
}
- else if ((op & 0170677) == P_MOVEL_SP)
+ else if ((op & 0177760) == P_MOVEL_SP)
{
/* move.l %R,-(%sp) */
- regno = ((op & 07000) >> 9) | ((op & 0100) >> 3);
+ regno = op & 017;
cache->saved_regs[regno] = offset;
offset -= 4;
pc += 2;
/* For normal frames, %pc is stored at 4(%fp). */
cache->saved_regs[M68K_PC_REGNUM] = 4;
- cache->pc = frame_func_unwind (next_frame);
+ cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
if (cache->pc != 0)
m68k_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
return frame_id_build (fp + 8, frame_pc_unwind (next_frame));
}
\f
-#ifdef USE_PROC_FS /* Target dependent support for /proc */
-
-#include <sys/procfs.h>
-
-/* Prototypes for supply_gregset etc. */
-#include "gregset.h"
-
-/* The /proc interface divides the target machine's register set up into
- two different sets, the general register set (gregset) and the floating
- point register set (fpregset). For each set, there is an ioctl to get
- the current register set and another ioctl to set the current values.
-
- The actual structure passed through the ioctl interface is, of course,
- naturally machine dependent, and is different for each set of registers.
- For the m68k for example, the general register set is typically defined
- by:
-
- typedef int gregset_t[18];
-
- #define R_D0 0
- ...
- #define R_PS 17
-
- and the floating point set by:
-
- typedef struct fpregset {
- int f_pcr;
- int f_psr;
- int f_fpiaddr;
- int f_fpregs[8][3]; (8 regs, 96 bits each)
- } fpregset_t;
-
- These routines provide the packing and unpacking of gregset_t and
- fpregset_t formatted data.
-
- */
-
-/* Atari SVR4 has R_SR but not R_PS */
-
-#if !defined (R_PS) && defined (R_SR)
-#define R_PS R_SR
-#endif
-
-/* Given a pointer to a general register set in /proc format (gregset_t *),
- unpack the register contents and supply them as gdb's idea of the current
- register values. */
-
-void
-supply_gregset (gregset_t *gregsetp)
-{
- int regi;
- greg_t *regp = (greg_t *) gregsetp;
-
- for (regi = 0; regi < R_PC; regi++)
- {
- regcache_raw_supply (current_regcache, regi, (char *) (regp + regi));
- }
- regcache_raw_supply (current_regcache, PS_REGNUM, (char *) (regp + R_PS));
- regcache_raw_supply (current_regcache, PC_REGNUM, (char *) (regp + R_PC));
-}
-
-void
-fill_gregset (gregset_t *gregsetp, int regno)
-{
- int regi;
- greg_t *regp = (greg_t *) gregsetp;
-
- for (regi = 0; regi < R_PC; regi++)
- {
- if (regno == -1 || regno == regi)
- regcache_raw_collect (current_regcache, regi, regp + regi);
- }
- if (regno == -1 || regno == PS_REGNUM)
- regcache_raw_collect (current_regcache, PS_REGNUM, regp + R_PS);
- if (regno == -1 || regno == PC_REGNUM)
- regcache_raw_collect (current_regcache, PC_REGNUM, regp + R_PC);
-}
-
-#if defined (FP0_REGNUM)
-
-/* Given a pointer to a floating point register set in /proc format
- (fpregset_t *), unpack the register contents and supply them as gdb's
- idea of the current floating point register values. */
-
-void
-supply_fpregset (fpregset_t *fpregsetp)
-{
- int regi;
- char *from;
-
- for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
- {
- from = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
- regcache_raw_supply (current_regcache, regi, from);
- }
- regcache_raw_supply (current_regcache, M68K_FPC_REGNUM,
- (char *) &(fpregsetp->f_pcr));
- regcache_raw_supply (current_regcache, M68K_FPS_REGNUM,
- (char *) &(fpregsetp->f_psr));
- regcache_raw_supply (current_regcache, M68K_FPI_REGNUM,
- (char *) &(fpregsetp->f_fpiaddr));
-}
-
-/* Given a pointer to a floating point register set in /proc format
- (fpregset_t *), update the register specified by REGNO from gdb's idea
- of the current floating point register set. If REGNO is -1, update
- them all. */
-
-void
-fill_fpregset (fpregset_t *fpregsetp, int regno)
-{
- int regi;
-
- for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
- {
- if (regno == -1 || regno == regi)
- regcache_raw_collect (current_regcache, regi,
- &fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
- }
- if (regno == -1 || regno == M68K_FPC_REGNUM)
- regcache_raw_collect (current_regcache, M68K_FPC_REGNUM,
- &fpregsetp->f_pcr);
- if (regno == -1 || regno == M68K_FPS_REGNUM)
- regcache_raw_collect (current_regcache, M68K_FPS_REGNUM,
- &fpregsetp->f_psr);
- if (regno == -1 || regno == M68K_FPI_REGNUM)
- regcache_raw_collect (current_regcache, M68K_FPI_REGNUM,
- &fpregsetp->f_fpiaddr);
-}
-
-#endif /* defined (FP0_REGNUM) */
-
-#endif /* USE_PROC_FS */
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
return 0;
}
- buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ buf = alloca (gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
sp = read_register (SP_REGNUM);
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
- buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
+ buf,
+ gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
return 0;
- jb_addr = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
- TARGET_PTR_BIT / TARGET_CHAR_BIT))
+ gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
return 0;
- *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
return 1;
}
\f
tdep = xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
- set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
+ set_gdbarch_long_double_format (gdbarch, floatformats_m68881_ext);
set_gdbarch_long_double_bit (gdbarch, 96);
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
set_gdbarch_frame_align (gdbarch, m68k_frame_align);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_dwarf_reg_to_regnum (gdbarch, m68k_dwarf_reg_to_regnum);
set_gdbarch_register_type (gdbarch, m68k_register_type);
set_gdbarch_register_name (gdbarch, m68k_register_name);
set_gdbarch_num_regs (gdbarch, M68K_NUM_REGS);
- set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);