ALPHA Linux: Fill 'collect_regset' in regset structures.

This commit is contained in:
Andreas Arnez 2014-04-01 06:57:34 +00:00 committed by Ulrich Weigand
parent d4d793bfeb
commit 1d6e755515
2 changed files with 47 additions and 23 deletions

View File

@ -1,3 +1,13 @@
2014-08-07 Andreas Arnez <arnez@linux.vnet.ibm.com>
* alpha-linux-tdep.c (alpha_linux_supply_gregset): Replace logic
by call to alpha_supply_int_regs.
(alpha_linux_collect_gregset): New function.
(alpha_linux_supply_fpregset): Replace logic by call to
alpha_supply_fp_regs.
(alpha_linux_collect_fpregset): New function.
(alpha_linux_gregset, alpha_linux_fpregset): Add collect method.
2014-08-07 Andreas Arnez <arnez@linux.vnet.ibm.com>
* aarch64-linux-nat.c (fill_gregset, fill_fpregset): Replace logic

View File

@ -164,23 +164,29 @@ alpha_linux_supply_gregset (const struct regset *regset,
int regnum, const void *gregs, size_t len)
{
const gdb_byte *regs = gregs;
int i;
gdb_assert (len >= 32 * 8);
for (i = 0; i < ALPHA_ZERO_REGNUM; i++)
{
if (regnum == i || regnum == -1)
regcache_raw_supply (regcache, i, regs + i * 8);
}
if (regnum == ALPHA_PC_REGNUM || regnum == -1)
regcache_raw_supply (regcache, ALPHA_PC_REGNUM, regs + 31 * 8);
if (regnum == ALPHA_UNIQUE_REGNUM || regnum == -1)
regcache_raw_supply (regcache, ALPHA_UNIQUE_REGNUM,
alpha_supply_int_regs (regcache, regnum, regs, regs + 31 * 8,
len >= 33 * 8 ? regs + 32 * 8 : NULL);
}
/* Collect register REGNUM from the register cache REGCACHE and store
it in the buffer specified by GREGS and LEN as described by the
general-purpose register set REGSET. If REGNUM is -1, do this for
all registers in REGSET. */
static void
alpha_linux_collect_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t len)
{
gdb_byte *regs = gregs;
gdb_assert (len >= 32 * 8);
alpha_fill_int_regs (regcache, regnum, regs, regs + 31 * 8,
len >= 33 * 8 ? regs + 32 * 8 : NULL);
}
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
in the floating-point register set REGSET to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
@ -191,29 +197,37 @@ alpha_linux_supply_fpregset (const struct regset *regset,
int regnum, const void *fpregs, size_t len)
{
const gdb_byte *regs = fpregs;
int i;
gdb_assert (len >= 32 * 8);
alpha_supply_fp_regs (regcache, regnum, regs, regs + 31 * 8);
}
for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; i++)
{
if (regnum == i || regnum == -1)
regcache_raw_supply (regcache, i, regs + (i - ALPHA_FP0_REGNUM) * 8);
}
/* Collect register REGNUM from the register cache REGCACHE and store
it in the buffer specified by FPREGS and LEN as described by the
general-purpose register set REGSET. If REGNUM is -1, do this for
all registers in REGSET. */
if (regnum == ALPHA_FPCR_REGNUM || regnum == -1)
regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8);
static void
alpha_linux_collect_fpregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *fpregs, size_t len)
{
gdb_byte *regs = fpregs;
gdb_assert (len >= 32 * 8);
alpha_fill_fp_regs (regcache, regnum, regs, regs + 31 * 8);
}
static const struct regset alpha_linux_gregset =
{
NULL,
alpha_linux_supply_gregset
alpha_linux_supply_gregset, alpha_linux_collect_gregset
};
static const struct regset alpha_linux_fpregset =
{
NULL,
alpha_linux_supply_fpregset
alpha_linux_supply_fpregset, alpha_linux_collect_fpregset
};
/* Return the appropriate register set for the core section identified