+ gdb_assert (len >= MIPSNBSD_NUM_GREGS * regsize);
+
+ for (i = 0; i <= MIPS_PC_REGNUM; i++)
+ {
+ if (regnum == i || regnum == -1)
+ regcache_raw_supply (regcache, i, regs + i * regsize);
+ }
+
+ if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * regsize)
+ {
+ regs += MIPSNBSD_NUM_GREGS * regsize;
+ len -= MIPSNBSD_NUM_GREGS * regsize;
+ mipsnbsd_supply_fpregset (regset, regcache, regnum, regs, len);
+ }
+}
+
+/* NetBSD/mips register sets. */
+
+static struct regset mipsnbsd_gregset =
+{
+ NULL,
+ mipsnbsd_supply_gregset
+};
+
+static struct regset mipsnbsd_fpregset =
+{
+ NULL,
+ mipsnbsd_supply_fpregset
+};
+
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+
+static const struct regset *
+mipsnbsd_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name, size_t sect_size)
+{
+ size_t regsize = mips_isa_regsize (gdbarch);
+
+ if (strcmp (sect_name, ".reg") == 0
+ && sect_size >= MIPSNBSD_NUM_GREGS * regsize)
+ return &mipsnbsd_gregset;
+
+ if (strcmp (sect_name, ".reg2") == 0
+ && sect_size >= MIPSNBSD_NUM_FPREGS * regsize)
+ return &mipsnbsd_fpregset;
+
+ return NULL;