Use mips_regnum instead of constants for FreeBSD/mips register operations.
gdb/ChangeLog: * mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove. (MIPS_FP0_REGNUM): Remove. (MIPS_FSR_REGNUM): Remove. (mips_fbsd_supply_fpregs): Use mips_regnum. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise.
This commit is contained in:
parent
d489d81d09
commit
f7241d4f27
|
@ -1,3 +1,13 @@
|
||||||
|
2017-05-23 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
|
* mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove.
|
||||||
|
(MIPS_FP0_REGNUM): Remove.
|
||||||
|
(MIPS_FSR_REGNUM): Remove.
|
||||||
|
(mips_fbsd_supply_fpregs): Use mips_regnum.
|
||||||
|
(mips_fbsd_supply_gregs): Likewise.
|
||||||
|
(mips_fbsd_collect_fpregs): Likewise.
|
||||||
|
(mips_fbsd_collect_gregs): Likewise.
|
||||||
|
|
||||||
2017-05-23 John Baldwin <jhb@FreeBSD.org>
|
2017-05-23 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
* mips-fbsd-nat.c (getregs_supplies): Fix upper bound comparison.
|
* mips-fbsd-nat.c (getregs_supplies): Fix upper bound comparison.
|
||||||
|
|
|
@ -29,11 +29,6 @@
|
||||||
|
|
||||||
#include "solib-svr4.h"
|
#include "solib-svr4.h"
|
||||||
|
|
||||||
/* Shorthand for some register numbers used below. */
|
|
||||||
#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
|
|
||||||
#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM
|
|
||||||
#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32
|
|
||||||
|
|
||||||
/* Core file support. */
|
/* Core file support. */
|
||||||
|
|
||||||
/* Number of registers in `struct reg' from <machine/reg.h>. The
|
/* Number of registers in `struct reg' from <machine/reg.h>. The
|
||||||
|
@ -108,13 +103,16 @@ void
|
||||||
mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum,
|
mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum,
|
||||||
const void *fpregs, size_t regsize)
|
const void *fpregs, size_t regsize)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
const gdb_byte *regs = (const gdb_byte *) fpregs;
|
const gdb_byte *regs = (const gdb_byte *) fpregs;
|
||||||
int i;
|
int i, fp0num, fsrnum;
|
||||||
|
|
||||||
for (i = MIPS_FP0_REGNUM; i <= MIPS_FSR_REGNUM; i++)
|
fp0num = mips_regnum (gdbarch)->fp0;
|
||||||
|
fsrnum = mips_regnum (gdbarch)->fp_control_status;
|
||||||
|
for (i = fp0num; i <= fsrnum; i++)
|
||||||
if (regnum == i || regnum == -1)
|
if (regnum == i || regnum == -1)
|
||||||
mips_fbsd_supply_reg (regcache, i,
|
mips_fbsd_supply_reg (regcache, i,
|
||||||
regs + (i - MIPS_FP0_REGNUM) * regsize, regsize);
|
regs + (i - fp0num) * regsize, regsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Supply the general-purpose registers stored in GREGS to REGCACHE.
|
/* Supply the general-purpose registers stored in GREGS to REGCACHE.
|
||||||
|
@ -125,10 +123,11 @@ void
|
||||||
mips_fbsd_supply_gregs (struct regcache *regcache, int regnum,
|
mips_fbsd_supply_gregs (struct regcache *regcache, int regnum,
|
||||||
const void *gregs, size_t regsize)
|
const void *gregs, size_t regsize)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
const gdb_byte *regs = (const gdb_byte *) gregs;
|
const gdb_byte *regs = (const gdb_byte *) gregs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i <= MIPS_PC_REGNUM; i++)
|
for (i = 0; i <= mips_regnum (gdbarch)->pc; i++)
|
||||||
if (regnum == i || regnum == -1)
|
if (regnum == i || regnum == -1)
|
||||||
mips_fbsd_supply_reg (regcache, i, regs + i * regsize, regsize);
|
mips_fbsd_supply_reg (regcache, i, regs + i * regsize, regsize);
|
||||||
}
|
}
|
||||||
|
@ -141,13 +140,16 @@ void
|
||||||
mips_fbsd_collect_fpregs (const struct regcache *regcache, int regnum,
|
mips_fbsd_collect_fpregs (const struct regcache *regcache, int regnum,
|
||||||
void *fpregs, size_t regsize)
|
void *fpregs, size_t regsize)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
gdb_byte *regs = (gdb_byte *) fpregs;
|
gdb_byte *regs = (gdb_byte *) fpregs;
|
||||||
int i;
|
int i, fp0num, fsrnum;
|
||||||
|
|
||||||
for (i = MIPS_FP0_REGNUM; i <= MIPS_FSR_REGNUM; i++)
|
fp0num = mips_regnum (gdbarch)->fp0;
|
||||||
|
fsrnum = mips_regnum (gdbarch)->fp_control_status;
|
||||||
|
for (i = fp0num; i <= fsrnum; i++)
|
||||||
if (regnum == i || regnum == -1)
|
if (regnum == i || regnum == -1)
|
||||||
mips_fbsd_collect_reg (regcache, i,
|
mips_fbsd_collect_reg (regcache, i,
|
||||||
regs + (i - MIPS_FP0_REGNUM) * regsize, regsize);
|
regs + (i - fp0num) * regsize, regsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Collect the general-purpose registers from REGCACHE and store them
|
/* Collect the general-purpose registers from REGCACHE and store them
|
||||||
|
@ -158,10 +160,11 @@ void
|
||||||
mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum,
|
mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum,
|
||||||
void *gregs, size_t regsize)
|
void *gregs, size_t regsize)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
gdb_byte *regs = (gdb_byte *) gregs;
|
gdb_byte *regs = (gdb_byte *) gregs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i <= MIPS_PC_REGNUM; i++)
|
for (i = 0; i <= mips_regnum (gdbarch)->pc; i++)
|
||||||
if (regnum == i || regnum == -1)
|
if (regnum == i || regnum == -1)
|
||||||
mips_fbsd_collect_reg (regcache, i, regs + i * regsize, regsize);
|
mips_fbsd_collect_reg (regcache, i, regs + i * regsize, regsize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue