#include "serial.h"
#include "target.h"
#include "exceptions.h"
-#include "remote-utils.h"
#include "gdb_string.h"
#include "gdb_stat.h"
#include "regcache.h"
static int mips_map_regno (int regno);
-static void mips_fetch_registers (int regno);
+static void mips_fetch_registers (struct regcache *regcache, int regno);
-static void mips_prepare_to_store (void);
+static void mips_prepare_to_store (struct regcache *regcache);
-static void mips_store_registers (int regno);
+static void mips_store_registers (struct regcache *regcache, int regno);
static unsigned int mips_fetch_word (CORE_ADDR addr);
mips_open (char *name, int from_tty)
{
const char *monitor_prompt = NULL;
- if (TARGET_ARCHITECTURE != NULL
- && TARGET_ARCHITECTURE->arch == bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (current_gdbarch) != NULL
+ && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips)
{
- switch (TARGET_ARCHITECTURE->mach)
+ switch (gdbarch_bfd_arch_info (current_gdbarch)->mach)
{
case bfd_mach_mips4100:
case bfd_mach_mips4300:
&rpc, &rfp, &rsp, flags);
if (nfields >= 3)
{
+ struct regcache *regcache = get_current_regcache ();
char buf[MAX_REGISTER_SIZE];
- store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rpc);
- regcache_raw_supply (current_regcache, PC_REGNUM, buf);
-
- store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rfp);
- regcache_raw_supply (current_regcache, 30, buf); /* This register they are avoiding and so it is unnamed */
-
- store_unsigned_integer (buf, register_size (current_gdbarch, SP_REGNUM), rsp);
- regcache_raw_supply (current_regcache, SP_REGNUM, buf);
-
- store_unsigned_integer (buf, register_size (current_gdbarch, DEPRECATED_FP_REGNUM), 0);
- regcache_raw_supply (current_regcache, DEPRECATED_FP_REGNUM, buf);
+ store_unsigned_integer (buf,
+ register_size
+ (current_gdbarch, gdbarch_pc_regnum
+ (current_gdbarch)), rpc);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), buf);
+
+ store_unsigned_integer
+ (buf, register_size (current_gdbarch,
+ gdbarch_pc_regnum (current_gdbarch)), rfp);
+ regcache_raw_supply (regcache, 30, buf); /* This register they are avoiding and so it is unnamed */
+
+ store_unsigned_integer (buf, register_size (current_gdbarch,
+ gdbarch_sp_regnum (current_gdbarch)), rsp);
+ regcache_raw_supply (regcache, gdbarch_sp_regnum (current_gdbarch), buf);
+
+ store_unsigned_integer (buf,
+ register_size (current_gdbarch,
+ gdbarch_deprecated_fp_regnum
+ (current_gdbarch)),
+ 0);
+ regcache_raw_supply (regcache,
+ gdbarch_deprecated_fp_regnum (current_gdbarch), buf);
if (nfields == 9)
{
/* Fetch the remote registers. */
static void
-mips_fetch_registers (int regno)
+mips_fetch_registers (struct regcache *regcache, int regno)
{
unsigned LONGEST val;
int err;
if (regno == -1)
{
- for (regno = 0; regno < NUM_REGS; regno++)
- mips_fetch_registers (regno);
+ for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ mips_fetch_registers (regcache, regno);
return;
}
- if (regno == DEPRECATED_FP_REGNUM || regno == MIPS_ZERO_REGNUM)
- /* DEPRECATED_FP_REGNUM on the mips is a hack which is just
+ if (regno == gdbarch_deprecated_fp_regnum (current_gdbarch)
+ || regno == MIPS_ZERO_REGNUM)
+ /* gdbarch_deprecated_fp_regnum on the mips is a hack which is just
supposed to read zero (see also mips-nat.c). */
val = 0;
else
/* We got the number the register holds, but gdb expects to see a
value in the target byte ordering. */
store_unsigned_integer (buf, register_size (current_gdbarch, regno), val);
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
}
}
registers, so this function doesn't have to do anything. */
static void
-mips_prepare_to_store (void)
+mips_prepare_to_store (struct regcache *regcache)
{
}
/* Store remote register(s). */
static void
-mips_store_registers (int regno)
+mips_store_registers (struct regcache *regcache, int regno)
{
+ ULONGEST val;
int err;
if (regno == -1)
{
- for (regno = 0; regno < NUM_REGS; regno++)
- mips_store_registers (regno);
+ for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ mips_store_registers (regcache, regno);
return;
}
- mips_request ('R', mips_map_regno (regno),
- read_register (regno),
+ regcache_cooked_read_unsigned (regcache, regno, &val);
+ mips_request ('R', mips_map_regno (regno), val,
&err, mips_receive_wait, NULL);
if (err)
mips_error ("Can't write register %d: %s", regno, safe_strerror (errno));
int rpid, rerrflg, rresponse, rlen;
int nfields;
- addr = ADDR_BITS_REMOVE (addr);
+ addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
if (mips_monitor == MON_LSI)
{
/* Work around problem where PMON monitor updates the PC after a load
to a different value than GDB thinks it has. The following ensures
that the write_pc() WILL update the PC value: */
- deprecated_register_valid[PC_REGNUM] = 0;
+ deprecated_register_valid[gdbarch_pc_regnum (current_gdbarch)] = 0;
}
if (exec_bfd)
write_pc (bfd_get_start_address (exec_bfd));