gdb/riscv: Add float status registers to save and restore reggroups
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 13 Dec 2018 19:06:23 +0000 (19:06 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Sat, 22 Dec 2018 10:02:20 +0000 (10:02 +0000)
We should save and restore the floating point status registers.  This
became an issue when testing 32-bit float on a target with 64-bit with
the gdb.base/callfuncs.exp test.

gdb/ChangeLog:

* riscv-tdep.c (riscv_register_reggroup_p): Save and restore fcsr,
fflags, and frm registers.

gdb/ChangeLog
gdb/riscv-tdep.c

index ea003617f2523dc28849890c6e1e10360055e612..513bc7ceb081695209c9a93c27fc2051c5c2362c 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-22  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * riscv-tdep.c (riscv_register_reggroup_p): Save and restore fcsr,
+       fflags, and frm registers.
+
 2018-12-22  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * riscv-tdep.c (riscv_dwarf_reg_to_regnum): New function.
index 3408f5a21df7e1cae705b34076ea0c34e8a38e7e..704e8512b3daac2eb80748a289b0e779ecf9f36d 100644 (file)
@@ -896,7 +896,10 @@ riscv_register_reggroup_p (struct gdbarch  *gdbarch, int regnum,
   else if (reggroup == restore_reggroup || reggroup == save_reggroup)
     {
       if (riscv_has_fp_regs (gdbarch))
-       return regnum <= RISCV_LAST_FP_REGNUM;
+       return (regnum <= RISCV_LAST_FP_REGNUM
+               || regnum == RISCV_CSR_FCSR_REGNUM
+               || regnum == RISCV_CSR_FFLAGS_REGNUM
+               || regnum == RISCV_CSR_FRM_REGNUM);
       else
        return regnum < RISCV_FIRST_FP_REGNUM;
     }