Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add m68k support to our unwinder.
details: https://anonhg.NetBSD.org/src/rev/853666b94261
branches: trunk
changeset: 794794:853666b94261
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Mar 24 21:25:03 2014 +0000
description:
Add m68k support to our unwinder.
diffstat:
share/mk/bsd.own.mk | 3 +-
sys/lib/libunwind/Registers.hpp | 69 ++++++++++++++++++++++++++++++++++++
sys/lib/libunwind/libunwind.cxx | 2 +
sys/lib/libunwind/unwind_registers.S | 22 ++++++++++-
4 files changed, 94 insertions(+), 2 deletions(-)
diffs (139 lines):
diff -r 710be771dd36 -r 853666b94261 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk Mon Mar 24 20:21:02 2014 +0000
+++ b/share/mk/bsd.own.mk Mon Mar 24 21:25:03 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.own.mk,v 1.790 2014/03/18 13:10:27 joerg Exp $
+# $NetBSD: bsd.own.mk,v 1.791 2014/03/24 21:25:03 joerg Exp $
# This needs to be before bsd.init.mk
.if defined(BSD_MK_COMPAT_FILE)
@@ -99,6 +99,7 @@
.endif
_LIBC_UNWIND_SUPPORT.i386= yes
+_LIBC_UNWIND_SUPPORT.m68k= yes
_LIBC_UNWIND_SUPPORT.powerpc= yes
_LIBC_UNWIND_SUPPORT.vax= yes
_LIBC_UNWIND_SUPPORT.x86_64= yes
diff -r 710be771dd36 -r 853666b94261 sys/lib/libunwind/Registers.hpp
--- a/sys/lib/libunwind/Registers.hpp Mon Mar 24 20:21:02 2014 +0000
+++ b/sys/lib/libunwind/Registers.hpp Mon Mar 24 21:25:03 2014 +0000
@@ -372,6 +372,75 @@
uint32_t reg[REGNO_VAX_PSW + 1];
};
+enum {
+ DWARF_M68K_A0 = 0,
+ DWARF_M68K_A7 = 7,
+ DWARF_M68K_D0 = 8,
+ DWARF_M68K_D7 = 15,
+ DWARF_M68K_PC = 24,
+
+ REGNO_M68K_A0 = 0,
+ REGNO_M68K_A7 = 7,
+ REGNO_M68K_D0 = 8,
+ REGNO_M68K_D7 = 15,
+ REGNO_M68K_PC = 16,
+};
+
+class Registers_M68K {
+public:
+ enum {
+ LAST_REGISTER = REGNO_M68K_PC,
+ LAST_RESTORE_REG = REGNO_M68K_PC,
+ RETURN_REG = REGNO_M68K_PC,
+ };
+
+ __dso_hidden Registers_M68K();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_M68K_A0 && num <= DWARF_M68K_A7)
+ 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_PC)
+ return REGNO_M68K_PC;
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= 0 && num <= LAST_RESTORE_REG;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_M68K_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_M68K_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_M68K_A7]; }
+
+ void setSP(uint64_t value) { reg[REGNO_M68K_A7] = value; }
+
+ bool validFloatVectorRegister(int num) const {
+ return false;
+ }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {
+ }
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint32_t reg[REGNO_M68K_PC + 1];
+};
+
} // namespace _Unwind
#endif // __REGISTERS_HPP__
diff -r 710be771dd36 -r 853666b94261 sys/lib/libunwind/libunwind.cxx
--- a/sys/lib/libunwind/libunwind.cxx Mon Mar 24 20:21:02 2014 +0000
+++ b/sys/lib/libunwind/libunwind.cxx Mon Mar 24 21:25:03 2014 +0000
@@ -27,6 +27,8 @@
typedef Registers_arm32 ThisUnwindRegisters;
#elif __vax__
typedef Registers_vax ThisUnwindRegisters;
+#elif __m68k__
+typedef Registers_M68K ThisUnwindRegisters;
#else
#error Unsupported architecture
#endif
diff -r 710be771dd36 -r 853666b94261 sys/lib/libunwind/unwind_registers.S
--- a/sys/lib/libunwind/unwind_registers.S Mon Mar 24 20:21:02 2014 +0000
+++ b/sys/lib/libunwind/unwind_registers.S Mon Mar 24 21:25:03 2014 +0000
@@ -339,6 +339,26 @@
movl 0(%r0), %r0
/* XXX restore PSW */
rsb
-
END(_ZNK7_Unwind13Registers_vax6jumptoEv)
#endif
+
+#if defined(__m68k__)
+ENTRY(_ZN7_Unwind14Registers_M68KC1Ev)
+ move.l 4(%sp), %a0
+ movem.l %d0-%d7/%a0-%a7, (%a0)
+ move.l 0(%sp), %a1
+ move.l %a1, 64(%a0)
+ addq.l #4, 60(%a0)
+ rts
+END(_ZN7_Unwind14Registers_M68KC1Ev)
+
+ENTRY(_ZNK7_Unwind14Registers_M68K6jumptoEv)
+ move.l 4(%sp), %a0
+ subq.l #4, 60(%a0)
+ move.l 64(%a0), %a1
+ move.l 60(%a0), %a2
+ move.l %a1, (%a2)
+ movem.l (%a0), %d0-%d7/%a0-%a7
+ rts
+END(_ZNK7_Unwind14Registers_M68K6jumptoEv)
+#endif
Home |
Main Index |
Thread Index |
Old Index