+2003-05-07 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (remote_d10v_translate_xfer_address): Add
+ "regcache".
+ (d10v_print_registers_info): Update.
+ (d10v_dmap_register, d10v_imap_register): Delete functions.
+ (struct gdbarch_tdep): Add "regcache" parameter to "dmap_register"
+ and "imap_register".
+ (d10v_ts2_dmap_register, d10v_ts2_imap_register): Add "regcache".
+ (d10v_ts3_dmap_register, d10v_ts3_imap_register): Add "regcache".
+ * arch-utils.c (generic_remote_translate_xfer_address): Add
+ "regcache" and "gdbarch" parameters.
+ * gdbarch.sh (REMOTE_TRANSLATE_XFER_ADDRESS): Add "regcache"
+ parameter. Change class to multi-arch.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * remote.c (remote_xfer_memory): Use
+ gdbarch_remote_translate_xfer_address.
+
2003-05-07 Jeff Johnston <jjohnstn@redhat.com>
* infrun.c (prev_pc): Move declaration ahead of proceed().
int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
void
-generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
+generic_remote_translate_xfer_address (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR gdb_addr, int gdb_len,
CORE_ADDR * rem_addr, int *rem_len)
{
*rem_addr = gdb_addr;
{
int a0_regnum;
int nr_dmap_regs;
- unsigned long (*dmap_register) (int nr);
- unsigned long (*imap_register) (int nr);
+ unsigned long (*dmap_register) (void *regcache, int nr);
+ unsigned long (*imap_register) (void *regcache, int nr);
};
/* These are the addresses the D10V-EVA board maps data and
one of the segments. */
static unsigned long
-d10v_ts2_dmap_register (int reg_nr)
+d10v_ts2_dmap_register (void *regcache, int reg_nr)
{
switch (reg_nr)
{
case 1:
return 0x2000;
case 2:
- return read_register (TS2_DMAP_REGNUM);
+ {
+ ULONGEST reg;
+ regcache_cooked_read_unsigned (regcache, TS2_DMAP_REGNUM, ®);
+ return reg;
+ }
default:
return 0;
}
}
static unsigned long
-d10v_ts3_dmap_register (int reg_nr)
-{
- return read_register (TS3_DMAP0_REGNUM + reg_nr);
-}
-
-static unsigned long
-d10v_dmap_register (int reg_nr)
-{
- return gdbarch_tdep (current_gdbarch)->dmap_register (reg_nr);
-}
-
-static unsigned long
-d10v_ts2_imap_register (int reg_nr)
+d10v_ts3_dmap_register (void *regcache, int reg_nr)
{
- return read_register (TS2_IMAP0_REGNUM + reg_nr);
+ ULONGEST reg;
+ regcache_cooked_read_unsigned (regcache, TS3_DMAP0_REGNUM + reg_nr, ®);
+ return reg;
}
static unsigned long
-d10v_ts3_imap_register (int reg_nr)
+d10v_ts2_imap_register (void *regcache, int reg_nr)
{
- return read_register (TS3_IMAP0_REGNUM + reg_nr);
+ ULONGEST reg;
+ regcache_cooked_read_unsigned (regcache, TS2_IMAP0_REGNUM + reg_nr, ®);
+ return reg;
}
static unsigned long
-d10v_imap_register (int reg_nr)
+d10v_ts3_imap_register (void *regcache, int reg_nr)
{
- return gdbarch_tdep (current_gdbarch)->imap_register (reg_nr);
+ ULONGEST reg;
+ regcache_cooked_read_unsigned (regcache, TS3_IMAP0_REGNUM + reg_nr, ®);
+ return reg;
}
/* MAP GDB's internal register numbering (determined by the layout fo
d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, int regnum, int all)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (regnum >= 0)
{
default_print_registers_info (gdbarch, file, frame, regnum, all);
{
if (a > 0)
fprintf_filtered (file, " ");
- fprintf_filtered (file, "IMAP%d %04lx", a, d10v_imap_register (a));
+ fprintf_filtered (file, "IMAP%d %04lx", a,
+ tdep->imap_register (current_regcache, a));
}
if (nr_dmap_regs (gdbarch) == 1)
/* Registers DMAP0 and DMAP1 are constant. Just return dmap2. */
- fprintf_filtered (file, " DMAP %04lx\n", d10v_dmap_register (2));
+ fprintf_filtered (file, " DMAP %04lx\n",
+ tdep->dmap_register (current_regcache, 2));
else
{
for (a = 0; a < nr_dmap_regs (gdbarch); a++)
{
- fprintf_filtered (file, " DMAP%d %04lx", a, d10v_dmap_register (a));
+ fprintf_filtered (file, " DMAP%d %04lx", a,
+ tdep->dmap_register (current_regcache, a));
}
fprintf_filtered (file, "\n");
}
VM system works, we just call that to do the translation. */
static void
-remote_d10v_translate_xfer_address (CORE_ADDR memaddr, int nr_bytes,
+remote_d10v_translate_xfer_address (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR memaddr, int nr_bytes,
CORE_ADDR *targ_addr, int *targ_len)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
long out_addr;
long out_len;
- out_len = sim_d10v_translate_addr (memaddr, nr_bytes,
- &out_addr,
- d10v_dmap_register,
- d10v_imap_register);
+ out_len = sim_d10v_translate_addr (memaddr, nr_bytes, &out_addr, regcache,
+ tdep->dmap_register, tdep->imap_register);
*targ_addr = out_addr;
*targ_len = out_len;
}
0,
0,
0,
- 0,
+ generic_remote_translate_xfer_address,
0,
0,
0,
(long) current_gdbarch->reg_struct_has_addr
/*REG_STRUCT_HAS_ADDR ()*/);
#endif
-#ifdef REMOTE_TRANSLATE_XFER_ADDRESS
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len)",
- XSTRING (REMOTE_TRANSLATE_XFER_ADDRESS (gdb_addr, gdb_len, rem_addr, rem_len)));
-#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: REMOTE_TRANSLATE_XFER_ADDRESS = <0x%08lx>\n",
- (long) current_gdbarch->remote_translate_xfer_address
- /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/);
-#endif
+ "gdbarch_dump: remote_translate_xfer_address = 0x%08lx\n",
+ (long) current_gdbarch->remote_translate_xfer_address);
#ifdef RETURN_VALUE_ON_STACK
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
}
void
-gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)
+gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)
{
gdb_assert (gdbarch != NULL);
if (gdbarch->remote_translate_xfer_address == 0)
"gdbarch: gdbarch_remote_translate_xfer_address invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n");
- gdbarch->remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len);
+ gdbarch->remote_translate_xfer_address (gdbarch, regcache, gdb_addr, gdb_len, rem_addr, rem_len);
}
void
#endif
#endif
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
-#define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (generic_remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len))
-#endif
-
-typedef void (gdbarch_remote_translate_xfer_address_ftype) (CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
-extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
+typedef void (gdbarch_remote_translate_xfer_address_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
+extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
extern void set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REMOTE_TRANSLATE_XFER_ADDRESS)
-#error "Non multi-arch definition of REMOTE_TRANSLATE_XFER_ADDRESS"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
-#define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (gdbarch_remote_translate_xfer_address (current_gdbarch, gdb_addr, gdb_len, rem_addr, rem_len))
-#endif
-#endif
extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
f:2:PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
#
-f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
+m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
#
v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1
f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0
int targ_len;
int res;
- REMOTE_TRANSLATE_XFER_ADDRESS (mem_addr, mem_len, &targ_addr, &targ_len);
+ /* Should this be the selected frame? */
+ gdbarch_remote_translate_xfer_address (current_gdbarch, current_regcache,
+ mem_addr, mem_len,
+ &targ_addr, &targ_len);
if (targ_len <= 0)
return 0;
+2003-05-07 Andrew Cagney <cagney@redhat.com>
+
+ * sim-d10v.h (sim_d10v_translate_addr): Add regcache parameter.
+ (sim_d10v_translate_imap_addr): Add regcache parameter.
+ (sim_d10v_translate_dmap_addr): Ditto.
+
2003-03-27 Nick Clifton <nickc@redhat.com>
* sim-arm.h (sim_arm_regs): Add iWMMXt registers.
(unsigned long offset,
int nr_bytes,
unsigned long *phys,
- unsigned long (*dmap_register) (int reg_nr));
+ void *regcache,
+ unsigned long (*dmap_register) (void *regcache, int reg_nr));
extern unsigned long sim_d10v_translate_imap_addr
(unsigned long offset,
int nr_bytes,
unsigned long *phys,
- unsigned long (*imap_register) (int reg_nr));
+ void *regcache,
+ unsigned long (*imap_register) (void *regcache, int reg_nr));
extern unsigned long sim_d10v_translate_addr
(unsigned long vaddr,
int nr_bytes,
unsigned long *phys,
- unsigned long (*dmap_register) (int reg_nr),
- unsigned long (*imap_register) (int reg_nr));
+ void *regcache,
+ unsigned long (*dmap_register) (void *regcache, int reg_nr),
+ unsigned long (*imap_register) (void *regcache, int reg_nr));
/* The simulator makes use of the following register information. */
+2003-05-07 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c (sim_d10v_translate_addr): Add "regcache" parameter.
+ (sim_d10v_translate_imap_addr): Ditto.
+ (sim_d10v_translate_dmap_addr): Ditto.
+ (xfer_mem): Pass NULL regcache to sim_d10v_translate_addr.
+ (dmem_addr): Pass NULL regcache to sim_d10v_translate_dmap_addr.
+ (dmap_register, imap_register): Add "regcache" parameter.
+ (imem_addr): Pass NULL regcache to sim_d10v_translate_imap_addr.
+ (sim_fetch_register): Pass NULL regcache to imap_register and
+ dmap_register.
+
2003-02-27 Andrew Cagney <cagney@redhat.com>
* interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
}
static unsigned long
-dmap_register (int reg_nr)
+dmap_register (void *regcache, int reg_nr)
{
uint8 *raw = map_memory (SIM_D10V_MEMORY_DATA
+ DMAP0_OFFSET + 2 * reg_nr);
}
static unsigned long
-imap_register (int reg_nr)
+imap_register (void *regcache, int reg_nr)
{
uint8 *raw = map_memory (SIM_D10V_MEMORY_DATA
+ IMAP0_OFFSET + 2 * reg_nr);
sim_d10v_translate_dmap_addr (unsigned long offset,
int nr_bytes,
unsigned long *phys,
- unsigned long (*dmap_register) (int reg_nr))
+ void *regcache,
+ unsigned long (*dmap_register) (void *regcache,
+ int reg_nr))
{
short map;
int regno;
/* Don't cross a BLOCK boundary */
nr_bytes = DMAP_BLOCK_SIZE - (offset % DMAP_BLOCK_SIZE);
}
- map = dmap_register (regno);
+ map = dmap_register (regcache, regno);
if (regno == 3)
{
/* Always maps to data memory */
sim_d10v_translate_imap_addr (unsigned long offset,
int nr_bytes,
unsigned long *phys,
- unsigned long (*imap_register) (int reg_nr))
+ void *regcache,
+ unsigned long (*imap_register) (void *regcache,
+ int reg_nr))
{
short map;
int regno;
/* Don't cross a BLOCK boundary */
nr_bytes = IMAP_BLOCK_SIZE - offset;
}
- map = imap_register (regno);
+ map = imap_register (regcache, regno);
sp = (map & 0x3000) >> 12;
segno = (map & 0x007f);
switch (sp)
sim_d10v_translate_addr (unsigned long memaddr,
int nr_bytes,
unsigned long *targ_addr,
- unsigned long (*dmap_register) (int reg_nr),
- unsigned long (*imap_register) (int reg_nr))
+ void *regcache,
+ unsigned long (*dmap_register) (void *regcache,
+ int reg_nr),
+ unsigned long (*imap_register) (void *regcache,
+ int reg_nr))
{
unsigned long phys;
unsigned long seg;
break;
case 0x10: /* in logical data address segment */
- nr_bytes = sim_d10v_translate_dmap_addr (off, nr_bytes, &phys,
+ nr_bytes = sim_d10v_translate_dmap_addr (off, nr_bytes, &phys, regcache,
dmap_register);
break;
case 0x11: /* in logical instruction address segment */
- nr_bytes = sim_d10v_translate_imap_addr (off, nr_bytes, &phys,
+ nr_bytes = sim_d10v_translate_imap_addr (off, nr_bytes, &phys, regcache,
imap_register);
break;
uint8 *memory;
unsigned long phys;
int phys_size;
- phys_size = sim_d10v_translate_addr (virt, size,
- &phys,
- dmap_register,
- imap_register);
+ phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
+ dmap_register, imap_register);
if (phys_size == 0)
return xfered;
things like ``0xfffe + 0x0e60 == 0x10e5d''. Since offset's type
is uint16 this is modulo'ed onto 0x0e5d. */
- phys_size = sim_d10v_translate_dmap_addr (offset, 1, &phys,
+ phys_size = sim_d10v_translate_dmap_addr (offset, 1, &phys, NULL,
dmap_register);
if (phys_size == 0)
{
{
unsigned long phys;
uint8 *mem;
- int phys_size = sim_d10v_translate_imap_addr (offset, 1, &phys, imap_register);
+ int phys_size = sim_d10v_translate_imap_addr (offset, 1, &phys, NULL,
+ imap_register);
if (phys_size == 0)
{
return State.mem.fault;
break;
case SIM_D10V_IMAP0_REGNUM:
case SIM_D10V_IMAP1_REGNUM:
- WRITE_16 (memory, imap_register (rn - SIM_D10V_IMAP0_REGNUM));
+ WRITE_16 (memory, imap_register (NULL, rn - SIM_D10V_IMAP0_REGNUM));
size = 2;
break;
case SIM_D10V_DMAP0_REGNUM:
case SIM_D10V_DMAP1_REGNUM:
case SIM_D10V_DMAP2_REGNUM:
case SIM_D10V_DMAP3_REGNUM:
- WRITE_16 (memory, dmap_register (rn - SIM_D10V_DMAP0_REGNUM));
+ WRITE_16 (memory, dmap_register (NULL, rn - SIM_D10V_DMAP0_REGNUM));
size = 2;
break;
case SIM_D10V_TS2_DMAP_REGNUM: