+2002-11-23 Andreas Schwab <schwab@suse.de>
+
+ * Makefile.in (m68k_tdep_h): Define.
+ (abug-rom.o, cpu32bug-rom.o, dbug-rom.o, m68k-tdep.o, m68klinux-nat.o)
+ (remote-est.o, rom68k-rom.o): Add $(m68k_tdep_h).
+ * m68k-tdep.c: Move register number enum ...
+ * m68k-tdep.h: ... to this new file and rename the constants from
+ E_* to M68K_*. All uses changed.
+ * config/m68k/tm-m68k.h (D0_REGNUM, A0_REGNUM): Remove definitions.
+ * abug-rom.c: Include "m68k-tdep.h". Use
+ M68K_D0_REGNUM/M68K_A0_REGNUM instead of D0_REGNUM/A0_REGNUM.
+ * cpu32bug-rom.c: Likewise.
+ * dbug-rom.c: Likewise.
+ * m68k-tdep.c: Likewise.
+ * m68klinux-nat.c: Likewise.
+ * remote-est.c: Likewise.
+ * rom68k-rom.c: Likewise.
+ * config/m68k/tm-linux.h: Likewise.
+
2002-11-23 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c (arm_gdbarch_init): Remove old style non-generic
language_h = language.h
linespec_h = linespec.h
m2_lang_h = m2-lang.h
+m68k_tdep_h = m68k-tdep.h
macroexp_h = macroexp.h
macroscope_h = macroscope.h $(macrotab_h) $(symtab_h)
macrotab_h = macrotab.h
a68v-nat.o: a68v-nat.c $(defs_h) $(inferior_h) $(regcache_h)
abug-rom.o: abug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h)
+ $(serial_h) $(regcache_h) $(m68k_tdep_h)
ada-lang.o: ada-lang.c $(gdb_string_h) $(demangle_h) $(defs_h) $(symtab_h) \
$(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \
$(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
$(demangle_h) $(annotate_h) $(gdb_string_h) $(c_lang_h) $(target_h) \
$(cp_abi_h)
cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \
- $(monitor_h) $(serial_h) $(regcache_h)
+ $(monitor_h) $(serial_h) $(regcache_h) $(m68k_tdep_h)
cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \
$(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \
$(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \
$(sim_regno_h)
# OBSOLETE d30v-tdep.o: d30v-tdep.c
dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h)
+ $(serial_h) $(regcache_h) $(m68k_tdep_h)
dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \
$(gdb_stat_h) $(symtab_h) $(breakpoint_h) $(target_h) $(gdbcore_h) \
$(libaout_h) $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
m68k-stub.o: m68k-stub.c
m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbcore_h) \
$(value_h) $(gdb_string_h) $(inferior_h) $(regcache_h) \
- $(arch_utils_h) $(gregset_h)
+ $(arch_utils_h) $(gregset_h) $(m68k_tdep_h)
m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
$(language_h) $(gdbcore_h) $(regcache_h) $(gdb_stat_h) \
- $(floatformat_h) $(target_h) $(gregset_h)
+ $(floatformat_h) $(target_h) $(gregset_h) $(m68k_tdep_h)
m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(target_h)
m68knbsd-nat.o: m68knbsd-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(target_h) $(command_h) $(symfile_h) $(remote_utils_h) $(gdbcore_h) \
$(serial_h) $(regcache_h) $(value_h)
remote-est.o: remote-est.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h)
+ $(serial_h) $(regcache_h) $(m68k_tdep_h)
remote-hms.o: remote-hms.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h)
remote-mips.o: remote-mips.c $(defs_h) $(inferior_h) $(bfd_h) $(symfile_h) \
$(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \
$(gdbcore_h)
rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h) $(value_h)
+ $(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h)
rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
$(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \
$(gdb_stabs_h) $(regcache_h) $(arch_utils_h) $(language_h) \
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
/* Prototypes for local functions. */
static void abug_open (char *args, int from_tty);
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + D0_REGNUM;
+ regno = regname[1] - '0' + M68K_D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + A0_REGNUM;
+ regno = regname[1] - '0' + M68K_A0_REGNUM;
break;
default:
return;
Boston, MA 02111-1307, USA. */
#include "regcache.h"
+#include "m68k-tdep.h"
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. This is 2
VALBUF); \
} \
else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
- memcpy (VALBUF, (char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM), \
+ memcpy (VALBUF, (char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM), \
TYPE_LENGTH (TYPE)); \
else \
memcpy (VALBUF, \
{ \
char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; \
REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buffer); \
- deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \
- raw_buffer, TYPE_LENGTH (TYPE)); \
+ deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \
+ raw_buffer, TYPE_LENGTH (TYPE)); \
} \
else \
{ \
if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
- deprecated_write_register_bytes (REGISTER_BYTE (A0_REGNUM), VALBUF, \
- TYPE_LENGTH (TYPE)); \
- deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \
+ deprecated_write_register_bytes (REGISTER_BYTE (M68K_A0_REGNUM), VALBUF, \
+ TYPE_LENGTH (TYPE)); \
+ deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \
} \
}
#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
- (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM)))
+ (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM)))
/* Offsets (in target ints) into jmp_buf. */
#include "regcache.h"
#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
-
-/* Generic 68000 stuff, to be included by other tm-*.h files. */
-
-/* D0_REGNM and A0_REGNUM must be defined here because they are
- used by the monitor. */
-
-#define D0_REGNUM 0
-#define A0_REGNUM 8
-
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void cpu32bug_open (char *args, int from_tty);
static void
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + D0_REGNUM;
+ regno = regname[1] - '0' + M68K_D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + A0_REGNUM;
+ regno = regname[1] - '0' + M68K_A0_REGNUM;
break;
default:
return;
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void dbug_open (char *args, int from_tty);
static void
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + D0_REGNUM;
+ regno = regname[1] - '0' + M68K_D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + A0_REGNUM;
+ regno = regname[1] - '0' + M68K_A0_REGNUM;
break;
default:
return;
#include "inferior.h"
#include "regcache.h"
#include "arch-utils.h"
+
+#include "m68k-tdep.h"
\f
#define P_LINKL_FP 0x480e
#define P_TRAP 0x4e40
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-/* Note: Since they are used in files other than this (monitor files),
- D0_REGNUM and A0_REGNUM are currently defined in tm-m68k.h. */
-
-enum
-{
- E_A1_REGNUM = 9,
- E_FP_REGNUM = 14, /* Contains address of executing stack frame */
- E_SP_REGNUM = 15, /* Contains address of top of stack */
- E_PS_REGNUM = 16, /* Contains processor status */
- E_PC_REGNUM = 17, /* Contains program counter */
- E_FP0_REGNUM = 18, /* Floating point register 0 */
- E_FPC_REGNUM = 26, /* 68881 control register */
- E_FPS_REGNUM = 27, /* 68881 status register */
- E_FPI_REGNUM = 28
-};
-
#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
#define REGISTER_BYTES_NOFP (16*4 + 8)
if (regnum >= FP0_REGNUM && regnum <= FP0_REGNUM + 7)
return builtin_type_m68881_ext;
- if (regnum == E_FPI_REGNUM || regnum == PC_REGNUM)
+ if (regnum == M68K_FPI_REGNUM || regnum == PC_REGNUM)
return builtin_type_void_func_ptr;
- if (regnum == E_FPC_REGNUM || regnum == E_FPS_REGNUM || regnum == PS_REGNUM)
+ if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM
+ || regnum == PS_REGNUM)
return builtin_type_int32;
- if (regnum >= A0_REGNUM && regnum <= A0_REGNUM + 7)
+ if (regnum >= M68K_A0_REGNUM && regnum <= M68K_A0_REGNUM + 7)
return builtin_type_void_data_ptr;
return builtin_type_int32;
static int
m68k_register_byte (int regnum)
{
- if (regnum >= E_FPC_REGNUM)
- return (((regnum - E_FPC_REGNUM) * 4) + 168);
+ if (regnum >= M68K_FPC_REGNUM)
+ return (((regnum - M68K_FPC_REGNUM) * 4) + 168);
else if (regnum >= FP0_REGNUM)
return (((regnum - FP0_REGNUM) * 12) + 72);
else
static void
m68k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
{
- write_register (E_A1_REGNUM, addr);
+ write_register (M68K_A1_REGNUM, addr);
}
/* Extract from an array regbuf containing the (raw) register state
static CORE_ADDR
m68k_frame_chain (struct frame_info *thisframe)
{
- if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
+ if (get_frame_type (thisframe) == SIGTRAMP_FRAME)
return thisframe->frame;
- else if (!inside_entry_file ((thisframe)->pc))
- return read_memory_integer ((thisframe)->frame, 4);
+ else if (!inside_entry_file (thisframe->pc))
+ return read_memory_integer (thisframe->frame, 4);
else
return 0;
}
static int
m68k_frameless_function_invocation (struct frame_info *fi)
{
- if ((get_frame_type (fi) == SIGTRAMP_FRAME))
+ if (get_frame_type (fi) == SIGTRAMP_FRAME)
return 0;
else
return frameless_look_for_prologue (fi);
static CORE_ADDR
m68k_frame_saved_pc (struct frame_info *frame)
{
- if ((get_frame_type (frame) == SIGTRAMP_FRAME))
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
{
if (frame->next)
return read_memory_integer (frame->next->frame + SIG_PC_FP_OFFSET, 4);
{
/* we assume here that the only frameless functions are the system calls
or other functions who do not put anything on the stack. */
- if ((get_frame_type (frame_info) == SIGTRAMP_FRAME))
+ if (get_frame_type (frame_info) == SIGTRAMP_FRAME)
return frame_info->frame + 12;
else if (frameless_look_for_prologue (frame_info))
{
register int regi;
char *from;
- for (regi = FP0_REGNUM; regi < E_FPC_REGNUM; regi++)
+ for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
{
from = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
supply_register (regi, from);
}
- supply_register (E_FPC_REGNUM, (char *) &(fpregsetp->f_pcr));
- supply_register (E_FPS_REGNUM, (char *) &(fpregsetp->f_psr));
- supply_register (E_FPI_REGNUM, (char *) &(fpregsetp->f_fpiaddr));
+ supply_register (M68K_FPC_REGNUM, (char *) &(fpregsetp->f_pcr));
+ supply_register (M68K_FPS_REGNUM, (char *) &(fpregsetp->f_psr));
+ supply_register (M68K_FPI_REGNUM, (char *) &(fpregsetp->f_fpiaddr));
}
/* Given a pointer to a floating point register set in /proc format
char *to;
char *from;
- for (regi = FP0_REGNUM; regi < E_FPC_REGNUM; regi++)
+ for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
{
memcpy (to, from, REGISTER_RAW_SIZE (regi));
}
}
- if ((regno == -1) || (regno == E_FPC_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPC_REGNUM))
{
- fpregsetp->f_pcr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPC_REGNUM)];
+ fpregsetp->f_pcr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPC_REGNUM)];
}
- if ((regno == -1) || (regno == E_FPS_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPS_REGNUM))
{
- fpregsetp->f_psr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPS_REGNUM)];
+ fpregsetp->f_psr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPS_REGNUM)];
}
- if ((regno == -1) || (regno == E_FPI_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPI_REGNUM))
{
- fpregsetp->f_fpiaddr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPI_REGNUM)];
+ fpregsetp->f_fpiaddr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPI_REGNUM)];
}
}
set_gdbarch_num_regs (gdbarch, 29);
set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4));
- set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
- set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM);
- set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
- set_gdbarch_ps_regnum (gdbarch, E_PS_REGNUM);
- set_gdbarch_fp0_regnum (gdbarch, E_FP0_REGNUM);
+ set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
+ set_gdbarch_fp_regnum (gdbarch, M68K_FP_REGNUM);
+ set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
+ set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
+ set_gdbarch_fp0_regnum (gdbarch, M68K_FP0_REGNUM);
set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
--- /dev/null
+/* Common target dependent code for the Motorola 68000 series.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef M68K_TDEP_H
+#define M68K_TDEP_H
+
+/* Register numbers of various important registers.
+ Note that some of these values are "real" register numbers,
+ and correspond to the general registers of the machine,
+ and some are "phony" register numbers which are too large
+ to be actual register numbers as far as the user is concerned
+ but do serve to get the desired values when passed to read_register. */
+
+enum
+{
+ M68K_D0_REGNUM = 0,
+ M68K_A0_REGNUM = 8,
+ M68K_A1_REGNUM = 9,
+ M68K_FP_REGNUM = 14, /* Contains address of executing stack frame */
+ M68K_SP_REGNUM = 15, /* Contains address of top of stack */
+ M68K_PS_REGNUM = 16, /* Contains processor status */
+ M68K_PC_REGNUM = 17, /* Contains program counter */
+ M68K_FP0_REGNUM = 18, /* Floating point register 0 */
+ M68K_FPC_REGNUM = 26, /* 68881 control register */
+ M68K_FPS_REGNUM = 27, /* 68881 status register */
+ M68K_FPI_REGNUM = 28
+};
+
+#endif /* M68K_TDEP_H */
#include "inferior.h"
#include "language.h"
#include "gdbcore.h"
+#include "gdb_string.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
#ifdef USG
#include <sys/types.h>
#endif
#include "target.h"
\f
-
/* This table must line up with REGISTER_NAMES in tm-m68k.h */
static const int regmap[] =
{
int
getfpregs_supplies (int regno)
{
- return FP0_REGNUM <= regno && regno <= FPI_REGNUM;
+ return FP0_REGNUM <= regno && regno <= M68K_FPI_REGNUM;
}
/* Does the current host support the GETREGS request? */
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int regi;
- for (regi = D0_REGNUM; regi <= SP_REGNUM; regi++)
+ for (regi = M68K_D0_REGNUM; regi <= SP_REGNUM; regi++)
supply_register (regi, (char *) ®p[regmap[regi]]);
supply_register (PS_REGNUM, (char *) ®p[PT_SR]);
supply_register (PC_REGNUM, (char *) ®p[PT_PC]);
{
int regi;
- for (regi = FP0_REGNUM; regi < FPC_REGNUM; regi++)
+ for (regi = FP0_REGNUM; regi < FP0_REGNUM + 8; regi++)
supply_register (regi, FPREG_ADDR (fpregsetp, regi - FP0_REGNUM));
- supply_register (FPC_REGNUM, (char *) &fpregsetp->fpcntl[0]);
- supply_register (FPS_REGNUM, (char *) &fpregsetp->fpcntl[1]);
- supply_register (FPI_REGNUM, (char *) &fpregsetp->fpcntl[2]);
+ supply_register (M68K_FPC_REGNUM, (char *) &fpregsetp->fpcntl[0]);
+ supply_register (M68K_FPS_REGNUM, (char *) &fpregsetp->fpcntl[1]);
+ supply_register (M68K_FPI_REGNUM, (char *) &fpregsetp->fpcntl[2]);
}
/* Fill register REGNO (if it is a floating-point register) in
regcache_collect (regno, FPREG_ADDR (fpregsetp, regno - FP0_REGNUM));
/* Fill in the floating-point control registers. */
- for (i = FPC_REGNUM; i <= FPI_REGNUM; i++)
+ for (i = M68K_FPC_REGNUM; i <= M68K_FPI_REGNUM; i++)
if (regno == -1 || regno == i)
- regcache_collect (regno, (char *) &fpregsetp->fpcntl[regno - FPC_REGNUM]);
+ regcache_collect (regno, (char *) &fpregsetp->fpcntl[regno - M68K_FPC_REGNUM]);
}
#ifdef HAVE_PTRACE_GETREGS
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void est_open (char *args, int from_tty);
static void
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + D0_REGNUM;
+ regno = regname[1] - '0' + M68K_D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
- regno = regname[1] - '0' + A0_REGNUM;
+ regno = regname[1] - '0' + M68K_A0_REGNUM;
break;
default:
return;
#include "regcache.h"
#include "value.h"
+#include "m68k-tdep.h"
+
static void rom68k_open (char *args, int from_tty);
/* Return true if C is a hex digit.
case 'D':
if (regname[1] != 'R')
break;
- regno = D0_REGNUM;
+ regno = M68K_D0_REGNUM;
numregs = 8;
break;
case 'A':
if (regname[1] != 'R')
break;
- regno = A0_REGNUM;
+ regno = M68K_A0_REGNUM;
numregs = 7;
break;
}