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
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "inferior.h"
#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 ();
+ struct gdbarch *gdbarch = get_regcache_arch (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
+ (gdbarch, gdbarch_pc_regnum (gdbarch)), rpc);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), 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 (gdbarch, gdbarch_pc_regnum (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, SP_REGNUM), rsp);
- regcache_raw_supply (current_regcache, SP_REGNUM, buf);
+ store_unsigned_integer (buf, register_size (gdbarch,
+ gdbarch_sp_regnum (gdbarch)), rsp);
+ regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), 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 (gdbarch,
+ gdbarch_deprecated_fp_regnum
+ (gdbarch)),
+ 0);
+ regcache_raw_supply (regcache,
+ gdbarch_deprecated_fp_regnum (gdbarch), buf);
if (nfields == 9)
{
/* Fetch the remote registers. */
static void
-mips_fetch_registers (int regno)
+mips_fetch_registers (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
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 (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 (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);
+ store_unsigned_integer (buf, register_size (gdbarch, regno), val);
+ 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)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ 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 (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));