-
-/* Sizeof `struct reg' in <machine/reg.h>. */
-#define SHNBSD_SIZEOF_GREGS (21 * 4)
-
-/* Supply register REGNUM from the buffer specified by GREGS and LEN
- in the general-purpose register set REGSET to register cache
- REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
-
-static void
-shnbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- const gdb_byte *regs = gregs;
- int i;
-
- gdb_assert (len >= SHNBSD_SIZEOF_GREGS);
-
- if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
- regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch),
- regs + (0 * 4));
-
- if (regnum == SR_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SR_REGNUM, regs + (1 * 4));
-
- if (regnum == PR_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, PR_REGNUM, regs + (2 * 4));
-
- if (regnum == MACH_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, MACH_REGNUM, regs + (3 * 4));
-
- if (regnum == MACL_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, MACL_REGNUM, regs + (4 * 4));
-
- for (i = R0_REGNUM; i <= (R0_REGNUM + 15); i++)
- {
- if (regnum == i || regnum == -1)
- regcache_raw_supply (regcache, i, regs + regmap[i - R0_REGNUM]);
- }
-}
-
-/* Collect register REGNUM in the general-purpose register set
- REGSET. from register cache REGCACHE into the buffer specified by
- GREGS and LEN. If REGNUM is -1, do this for all registers in
- REGSET. */
-
-static void
-shnbsd_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- gdb_byte *regs = gregs;
- int i;
-
- gdb_assert (len >= SHNBSD_SIZEOF_GREGS);
-
- if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
- regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch),
- regs + (0 * 4));
-
- if (regnum == SR_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SR_REGNUM, regs + (1 * 4));
-
- if (regnum == PR_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, PR_REGNUM, regs + (2 * 4));
-
- if (regnum == MACH_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, MACH_REGNUM, regs + (3 * 4));
-
- if (regnum == MACL_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, MACL_REGNUM, regs + (4 * 4));
-
- for (i = R0_REGNUM; i <= (R0_REGNUM + 15); i++)
- {
- if (regnum == i || regnum == -1)
- regcache_raw_collect (regcache, i, regs + regmap[i - R0_REGNUM]);
- }
-}
-
-/* SH register sets. */
-
-static struct regset shnbsd_gregset =
-{
- NULL,
- shnbsd_supply_gregset,
- shnbsd_collect_gregset
-};
-
-/* Return the appropriate register set for the core section identified
- by SECT_NAME and SECT_SIZE. */
-
-static const struct regset *
-shnbsd_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name, size_t sect_size)
-{
- if (strcmp (sect_name, ".reg") == 0 && sect_size >= SHNBSD_SIZEOF_GREGS)
- return &shnbsd_gregset;
-
- return NULL;
-}
-
-void
-shnbsd_supply_reg (struct regcache *regcache, const char *regs, int regnum)
-{
- shnbsd_supply_gregset (&shnbsd_gregset, regcache, regnum,
- regs, SHNBSD_SIZEOF_GREGS);
-}
-
-void
-shnbsd_fill_reg (const struct regcache *regcache, char *regs, int regnum)
-{
- shnbsd_collect_gregset (&shnbsd_gregset, regcache, regnum,
- regs, SHNBSD_SIZEOF_GREGS);
-}