+\f
+/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
+ the loadmap addresses in the register set. (See below for more info.) */
+#define FRV_ELF_NGREG (46 + 2)
+typedef unsigned char frv_elf_greg_t[4];
+typedef struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; } frv_elf_gregset_t;
+
+typedef unsigned char frv_elf_fpreg_t[4];
+typedef struct
+{
+ frv_elf_fpreg_t fr[64];
+ frv_elf_fpreg_t fner[2];
+ frv_elf_fpreg_t msr[2];
+ frv_elf_fpreg_t acc[8];
+ unsigned char accg[8];
+ frv_elf_fpreg_t fsr[1];
+} frv_elf_fpregset_t;
+
+/* Register maps. */
+
+static const struct regcache_map_entry frv_linux_gregmap[] =
+ {
+ { 1, psr_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* isr */
+ { 1, ccr_regnum, 4 },
+ { 1, cccr_regnum, 4 },
+ { 1, lr_regnum, 4 },
+ { 1, lcr_regnum, 4 },
+ { 1, pc_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* __status */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* syscallno */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_gr8 */
+ { 1, gner0_regnum, 4 },
+ { 1, gner1_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* iacc0 */
+ { 1, tbr_regnum, 4 },
+ { 31, first_gpr_regnum + 1, 4 }, /* gr1 ... gr31 */
+
+ /* Technically, the loadmap addresses are not part of `pr_reg' as
+ found in the elf_prstatus struct. The fields which communicate
+ the loadmap address appear (by design) immediately after
+ `pr_reg' though, and the BFD function elf32_frv_grok_prstatus()
+ has been implemented to include these fields in the register
+ section that it extracts from the core file. So, for our
+ purposes, they may be viewed as registers. */
+
+ { 1, fdpic_loadmap_exec_regnum, 4 },
+ { 1, fdpic_loadmap_interp_regnum, 4 },
+ { 0 }
+ };
+
+static const struct regcache_map_entry frv_linux_fpregmap[] =
+ {
+ { 64, first_fpr_regnum, 4 }, /* fr0 ... fr63 */
+ { 1, fner0_regnum, 4 },
+ { 1, fner1_regnum, 4 },
+ { 1, msr0_regnum, 4 },
+ { 1, msr1_regnum, 4 },
+ { 8, acc0_regnum, 4 }, /* acc0 ... acc7 */
+ { 1, accg0123_regnum, 4 },
+ { 1, accg4567_regnum, 4 },
+ { 1, fsr0_regnum, 4 },
+ { 0 }
+ };
+
+/* Unpack an frv_elf_gregset_t into GDB's register cache. */
+
+static void
+frv_linux_supply_gregset (const struct regset *regset,
+ struct regcache *regcache,
+ int regnum, const void *gregs, size_t len)
+{
+ int regi;
+
+ /* gr0 always contains 0. Also, the kernel passes the TBR value in
+ this slot. */
+ regcache->raw_supply_zeroed (first_gpr_regnum);