Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libunwind Save & restore FP registers.



details:   https://anonhg.NetBSD.org/src/rev/01fa8dfdc53f
branches:  trunk
changeset: 328059:01fa8dfdc53f
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Mar 25 00:00:55 2014 +0000

description:
Save & restore FP registers.

diffstat:

 sys/lib/libunwind/Registers.hpp      |  21 +++++++++++++++++----
 sys/lib/libunwind/unwind_registers.S |   2 ++
 2 files changed, 19 insertions(+), 4 deletions(-)

diffs (91 lines):

diff -r b0c4768b4b3b -r 01fa8dfdc53f sys/lib/libunwind/Registers.hpp
--- a/sys/lib/libunwind/Registers.hpp   Mon Mar 24 23:03:21 2014 +0000
+++ b/sys/lib/libunwind/Registers.hpp   Tue Mar 25 00:00:55 2014 +0000
@@ -377,6 +377,8 @@
   DWARF_M68K_A7 = 7,
   DWARF_M68K_D0 = 8,
   DWARF_M68K_D7 = 15,
+  DWARF_M68K_FP0 = 16,
+  DWARF_M68K_FP7 = 23,
   DWARF_M68K_PC = 24,
 
   REGNO_M68K_A0 = 0,
@@ -384,13 +386,15 @@
   REGNO_M68K_D0 = 8,
   REGNO_M68K_D7 = 15,
   REGNO_M68K_PC = 16,
+  REGNO_M68K_FP0 = 17,
+  REGNO_M68K_FP7 = 24,
 };
 
 class Registers_M68K {
 public:
   enum {
-    LAST_REGISTER = REGNO_M68K_PC,
-    LAST_RESTORE_REG = REGNO_M68K_PC,
+    LAST_REGISTER = REGNO_M68K_FP7,
+    LAST_RESTORE_REG = REGNO_M68K_FP7,
     RETURN_REG = REGNO_M68K_PC,
   };
 
@@ -401,13 +405,15 @@
       return REGNO_M68K_A0 + (num - DWARF_M68K_A0);
     if (num >= DWARF_M68K_D0 && num <= DWARF_M68K_D7)
       return REGNO_M68K_D0 + (num - DWARF_M68K_D0);
+    if (num >= DWARF_M68K_FP0 && num <= DWARF_M68K_FP7)
+      return REGNO_M68K_FP0 + (num - DWARF_M68K_FP0);
     if (num == DWARF_M68K_PC)
       return REGNO_M68K_PC;
     return LAST_REGISTER + 1;
   }
 
   bool validRegister(int num) const {
-    return num >= 0 && num <= LAST_RESTORE_REG;
+    return num >= 0 && num <= REGNO_M68K_PC;
   }
 
   uint64_t getRegister(int num) const {
@@ -429,16 +435,23 @@
   void setSP(uint64_t value) { reg[REGNO_M68K_A7] = value; }
 
   bool validFloatVectorRegister(int num) const {
-    return false;
+    return num >= REGNO_M68K_FP0 && num <= REGNO_M68K_FP7;
   }
 
   void copyFloatVectorRegister(int num, uint64_t addr_) {
+    assert(validFloatVectorRegister(num));
+    const void *addr = reinterpret_cast<const void *>(addr_);
+    memcpy(fpreg + (num - REGNO_M68K_FP0), addr, sizeof(fpreg[0]));
   }
 
   __dso_hidden void jumpto() const __dead;
 
 private:
+  typedef uint32_t fpreg_t[3];
+
   uint32_t reg[REGNO_M68K_PC + 1];
+  uint32_t dummy;
+  fpreg_t fpreg[8];
 };
 
 } // namespace _Unwind
diff -r b0c4768b4b3b -r 01fa8dfdc53f sys/lib/libunwind/unwind_registers.S
--- a/sys/lib/libunwind/unwind_registers.S      Mon Mar 24 23:03:21 2014 +0000
+++ b/sys/lib/libunwind/unwind_registers.S      Tue Mar 25 00:00:55 2014 +0000
@@ -346,6 +346,7 @@
 ENTRY(_ZN7_Unwind14Registers_M68KC1Ev)
        move.l  4(%sp), %a0
        movem.l %d0-%d7/%a0-%a7, (%a0)
+       fmovem  %fp0-%fp7, 72(%a0)
        move.l  0(%sp), %a1
        move.l  %a1, 64(%a0)
        addq.l  #4, 60(%a0)
@@ -358,6 +359,7 @@
        move.l  64(%a0), %a1
        move.l  60(%a0), %a2
        move.l  %a1, (%a2)
+       fmovem  72(%a0), %fp0-%fp7
        movem.l (%a0), %d0-%d7/%a0-%a7
        rts
 END(_ZNK7_Unwind14Registers_M68K6jumptoEv)



Home | Main Index | Thread Index | Old Index