Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libunwind Teach the LLVM-derived unwinder about the ...



details:   https://anonhg.NetBSD.org/src/rev/2007bb6df377
branches:  trunk
changeset: 1026419:2007bb6df377
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Nov 24 00:21:59 2021 +0000

description:
Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for SuperH for GBR, MACH, MACL, and SR.

diffstat:

 sys/lib/libunwind/Registers.hpp |  34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diffs (73 lines):

diff -r deed22dccde2 -r 2007bb6df377 sys/lib/libunwind/Registers.hpp
--- a/sys/lib/libunwind/Registers.hpp   Tue Nov 23 23:29:55 2021 +0000
+++ b/sys/lib/libunwind/Registers.hpp   Wed Nov 24 00:21:59 2021 +0000
@@ -655,18 +655,26 @@
   DWARF_SH3_R15 = 15,
   DWARF_SH3_PC = 16,
   DWARF_SH3_PR = 17,
+  DWARF_SH3_GBR = 18,
+  DWARF_SH3_MACH = 20,
+  DWARF_SH3_MACL = 21,
+  DWARF_SH3_SR = 22,
 
   REGNO_SH3_R0 = 0,
   REGNO_SH3_R15 = 15,
   REGNO_SH3_PC = 16,
   REGNO_SH3_PR = 17,
+  REGNO_SH3_GBR = 18,
+  REGNO_SH3_MACH = 20,
+  REGNO_SH3_MACL = 21,
+  REGNO_SH3_SR = 22,
 };
 
 class Registers_SH3 {
 public:
   enum {
-    LAST_REGISTER = REGNO_SH3_PR,
-    LAST_RESTORE_REG = REGNO_SH3_PR,
+    LAST_REGISTER = REGNO_SH3_SR,
+    LAST_RESTORE_REG = REGNO_SH3_SR,
     RETURN_OFFSET = 0,
     RETURN_MASK = 0,
   };
@@ -676,15 +684,27 @@
   static int dwarf2regno(int num) {
     if (num >= DWARF_SH3_R0 && num <= DWARF_SH3_R15)
       return REGNO_SH3_R0 + (num - DWARF_SH3_R0);
-    if (num == DWARF_SH3_PC)
+    switch (num) {
+    case DWARF_SH3_PC:
       return REGNO_SH3_PC;
-    if (num == DWARF_SH3_PR)
+    case DWARF_SH3_PR:
       return REGNO_SH3_PR;
-    return LAST_REGISTER + 1;
+    case DWARF_SH3_GBR:
+      return REGNO_SH3_GBR;
+    case DWARF_SH3_MACH:
+      return REGNO_SH3_MACH;
+    case DWARF_SH3_MACL:
+      return REGNO_SH3_MACL;
+    case DWARF_SH3_SR:
+      return REGNO_SH3_SR;
+    default:
+      return LAST_REGISTER + 1;
+    }
   }
 
   bool validRegister(int num) const {
-    return num >= 0 && num <= REGNO_SH3_PR;
+    return (num >= 0 && num <= REGNO_SH3_GBR) ||
+       (num >= REGNO_SH3_MACH && num <= REGNO_SH3_SR);
   }
 
   uint64_t getRegister(int num) const {
@@ -712,7 +732,7 @@
   __dso_hidden void jumpto() const __dead;
 
 private:
-  uint32_t reg[REGNO_SH3_PR + 1];
+  uint32_t reg[REGNO_SH3_SR + 1];
 };
 
 enum {



Home | Main Index | Thread Index | Old Index