aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2002-11-23 19:45:12 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2002-11-23 19:45:12 +0000
commit32eeb91a760126d6e7717f0220dee3fabd31877e (patch)
tree381d2dcf673e78bdc8fff19d2b462598eb44269f
parent9648bac836b757582577dd67e1faf39b465b39c4 (diff)
downloadgdb-32eeb91a760126d6e7717f0220dee3fabd31877e.zip
gdb-32eeb91a760126d6e7717f0220dee3fabd31877e.tar.gz
gdb-32eeb91a760126d6e7717f0220dee3fabd31877e.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/Makefile.in15
-rw-r--r--gdb/abug-rom.c6
-rw-r--r--gdb/config/m68k/tm-linux.h15
-rw-r--r--gdb/config/m68k/tm-m68k.h9
-rw-r--r--gdb/cpu32bug-rom.c6
-rw-r--r--gdb/dbug-rom.c6
-rw-r--r--gdb/m68k-tdep.c82
-rw-r--r--gdb/m68k-tdep.h47
-rw-r--r--gdb/m68klinux-nat.c20
-rw-r--r--gdb/remote-est.c6
-rw-r--r--gdb/rom68k-rom.c6
12 files changed, 144 insertions, 93 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 485b16e..9ae9123 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+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
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 81d8cd3..1b2b47c 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -683,6 +683,7 @@ kod_h = kod.h
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
@@ -1496,7 +1497,7 @@ ada-exp.tab.o: ada-exp.tab.c ada-lex.c ada-lang.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) \
@@ -1626,7 +1627,7 @@ cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_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) \
@@ -1639,7 +1640,7 @@ d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_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) \
@@ -1892,10 +1893,10 @@ m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) $(frame_h) $(symtab_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) \
@@ -2062,7 +2063,7 @@ remote-es.o: remote-es.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_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) \
@@ -2119,7 +2120,7 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_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) \
diff --git a/gdb/abug-rom.c b/gdb/abug-rom.c
index 8a9e8ff..d3a9c2e 100644
--- a/gdb/abug-rom.c
+++ b/gdb/abug-rom.c
@@ -28,6 +28,8 @@
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
/* Prototypes for local functions. */
static void abug_open (char *args, int from_tty);
@@ -55,12 +57,12 @@ abug_supply_register (char *regname, int regnamelen, char *val, int vallen)
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;
diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h
index 0bae116..4990bb0 100644
--- a/gdb/config/m68k/tm-linux.h
+++ b/gdb/config/m68k/tm-linux.h
@@ -21,6 +21,7 @@
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
@@ -46,7 +47,7 @@
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, \
@@ -64,15 +65,15 @@
{ \
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)); \
} \
}
@@ -85,7 +86,7 @@
#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. */
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index 8b92281..523cc4a 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -22,12 +22,3 @@
#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
-
diff --git a/gdb/cpu32bug-rom.c b/gdb/cpu32bug-rom.c
index efaf89a..4341789 100644
--- a/gdb/cpu32bug-rom.c
+++ b/gdb/cpu32bug-rom.c
@@ -28,6 +28,8 @@
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void cpu32bug_open (char *args, int from_tty);
static void
@@ -53,12 +55,12 @@ cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen)
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;
diff --git a/gdb/dbug-rom.c b/gdb/dbug-rom.c
index bd20184..aadab6f 100644
--- a/gdb/dbug-rom.c
+++ b/gdb/dbug-rom.c
@@ -32,6 +32,8 @@
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void dbug_open (char *args, int from_tty);
static void
@@ -57,12 +59,12 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
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;
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 2b8eb40..1eacea1 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -28,6 +28,8 @@
#include "inferior.h"
#include "regcache.h"
#include "arch-utils.h"
+
+#include "m68k-tdep.h"
#define P_LINKL_FP 0x480e
@@ -43,29 +45,6 @@
#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)
@@ -162,13 +141,14 @@ m68k_register_virtual_type (int regnum)
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;
@@ -210,8 +190,8 @@ m68k_stack_align (CORE_ADDR addr)
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
@@ -224,7 +204,7 @@ m68k_register_byte (int regnum)
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
@@ -276,10 +256,10 @@ m68k_store_return_value (struct type *type, char *valbuf)
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;
}
@@ -291,7 +271,7 @@ m68k_frame_chain (struct frame_info *thisframe)
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);
@@ -300,7 +280,7 @@ m68k_frameless_function_invocation (struct frame_info *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);
@@ -349,7 +329,7 @@ delta68_frame_args_address (struct frame_info *frame_info)
{
/* 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))
{
@@ -868,14 +848,14 @@ supply_fpregset (fpregset_t *fpregsetp)
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
@@ -890,7 +870,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
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))
{
@@ -899,17 +879,17 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
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)];
}
}
@@ -1045,11 +1025,11 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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);
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
new file mode 100644
index 0000000..8da568e
--- /dev/null
+++ b/gdb/m68k-tdep.h
@@ -0,0 +1,47 @@
+/* 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 */
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index b206852..cf47dd1 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -25,8 +25,11 @@
#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
@@ -51,7 +54,6 @@
#include "target.h"
-
/* This table must line up with REGISTER_NAMES in tm-m68k.h */
static const int regmap[] =
{
@@ -78,7 +80,7 @@ getregs_supplies (int regno)
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? */
@@ -275,7 +277,7 @@ supply_gregset (elf_gregset_t *gregsetp)
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 *) &regp[regmap[regi]]);
supply_register (PS_REGNUM, (char *) &regp[PT_SR]);
supply_register (PC_REGNUM, (char *) &regp[PT_PC]);
@@ -359,11 +361,11 @@ supply_fpregset (elf_fpregset_t *fpregsetp)
{
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
@@ -381,9 +383,9 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
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
diff --git a/gdb/remote-est.c b/gdb/remote-est.c
index 0a1d7af..93eddc9 100644
--- a/gdb/remote-est.c
+++ b/gdb/remote-est.c
@@ -30,6 +30,8 @@
#include "serial.h"
#include "regcache.h"
+#include "m68k-tdep.h"
+
static void est_open (char *args, int from_tty);
static void
@@ -55,12 +57,12 @@ est_supply_register (char *regname, int regnamelen, char *val, int vallen)
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;
diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c
index cc0586f..c065a87 100644
--- a/gdb/rom68k-rom.c
+++ b/gdb/rom68k-rom.c
@@ -27,6 +27,8 @@
#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.
@@ -129,13 +131,13 @@ rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen)
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;
}