Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libunwind Add basic unwind support for VAX. PSW hand...
details: https://anonhg.NetBSD.org/src/rev/f16fcbe385eb
branches: trunk
changeset: 327841:f16fcbe385eb
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Mar 18 13:08:15 2014 +0000
description:
Add basic unwind support for VAX. PSW handling and stack pointer after
resume is still incomplete.
diffstat:
sys/lib/libunwind/Registers.hpp | 64 ++++++++++++++++++++++++++++++++++++
sys/lib/libunwind/libunwind.cxx | 2 +
sys/lib/libunwind/unwind_registers.S | 55 ++++++++++++++++++++++++++++++
3 files changed, 121 insertions(+), 0 deletions(-)
diffs (148 lines):
diff -r 9d74fd9afa4a -r f16fcbe385eb sys/lib/libunwind/Registers.hpp
--- a/sys/lib/libunwind/Registers.hpp Tue Mar 18 12:54:29 2014 +0000
+++ b/sys/lib/libunwind/Registers.hpp Tue Mar 18 13:08:15 2014 +0000
@@ -308,6 +308,70 @@
uint64_t fpreg[32];
};
+enum {
+ DWARF_VAX_R0 = 0,
+ DWARF_VAX_R15 = 15,
+ DWARF_VAX_PSW = 16,
+
+ REGNO_VAX_R0 = 0,
+ REGNO_VAX_R14 = 14,
+ REGNO_VAX_R15 = 15,
+ REGNO_VAX_PSW = 16,
+};
+
+class Registers_vax {
+public:
+ enum {
+ LAST_REGISTER = REGNO_VAX_PSW,
+ LAST_RESTORE_REG = REGNO_VAX_PSW,
+ RETURN_REG = REGNO_VAX_R15,
+ };
+
+ __dso_hidden Registers_vax();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_VAX_R0 && num <= DWARF_VAX_R15)
+ return REGNO_VAX_R0 + (num - DWARF_VAX_R0);
+ if (num == DWARF_VAX_PSW)
+ return REGNO_VAX_PSW;
+ 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_VAX_R15]; }
+
+ void setIP(uint64_t value) { reg[REGNO_VAX_R15] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_VAX_R14]; }
+
+ void setSP(uint64_t value) { reg[REGNO_VAX_R14] = 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_VAX_PSW + 1];
+};
+
} // namespace _Unwind
#endif // __REGISTERS_HPP__
diff -r 9d74fd9afa4a -r f16fcbe385eb sys/lib/libunwind/libunwind.cxx
--- a/sys/lib/libunwind/libunwind.cxx Tue Mar 18 12:54:29 2014 +0000
+++ b/sys/lib/libunwind/libunwind.cxx Tue Mar 18 13:08:15 2014 +0000
@@ -25,6 +25,8 @@
typedef Registers_ppc32 ThisUnwindRegisters;
#elif __arm__ && !defined(__ARM_EABI__)
typedef Registers_arm32 ThisUnwindRegisters;
+#elif __vax__
+typedef Registers_vax ThisUnwindRegisters;
#else
#error Unsupported architecture
#endif
diff -r 9d74fd9afa4a -r f16fcbe385eb sys/lib/libunwind/unwind_registers.S
--- a/sys/lib/libunwind/unwind_registers.S Tue Mar 18 12:54:29 2014 +0000
+++ b/sys/lib/libunwind/unwind_registers.S Tue Mar 18 13:08:15 2014 +0000
@@ -288,3 +288,58 @@
ldmia r0, {r0-r15}
END(_ZNK7_Unwind15Registers_arm326jumptoEv)
#endif
+
+#if defined(__vax__)
+ .hidden _ZN7_Unwind13Registers_vaxC1Ev
+ENTRY(_ZN7_Unwind13Registers_vaxC1Ev, R0)
+ subl2 $4, %sp
+ movl 4(%ap), %r0
+ movl %r1, 4(%r0)
+ movl %r2, 8(%r0)
+ movl %r3, 12(%r0)
+ movl %r4, 16(%r0)
+ movl %r5, 20(%r0)
+ movl %r6, 24(%r0)
+ movl %r7, 28(%r0)
+ movl %r8, 32(%r0)
+ movl %r9, 36(%r0)
+ movl %r10, 40(%r0)
+ movl %r11, 44(%r0)
+ movl 8(%fp), 48(%r0)
+ movl 12(%fp), 52(%r0)
+ /* XXX correct argument handling */
+ addl3 $36, %r14, 56(%r0)
+ /* Return PC */
+ movl 16(%fp), 60(%r0)
+ /* Load saved value of r0 as r1 */
+ movl 20(%fp), 0(%r0)
+ /* Saved PSW */
+ movl 4(%fp), 64(%r0)
+ ret
+END(_ZN7_Unwind13Registers_vaxC1Ev)
+
+ .hidden _ZNK7_Unwind13Registers_vax6jumptoEv
+ENTRY(_ZNK7_Unwind13Registers_vax6jumptoEv, 0)
+ subl2 $4, %sp
+ movl 4(%ap), %r0
+ movl 4(%r0), %r1
+ movl 8(%r0), %r2
+ movl 12(%r0), %r3
+ movl 16(%r0), %r4
+ movl 20(%r0), %r5
+ movl 24(%r0), %r6
+ movl 28(%r0), %r7
+ movl 32(%r0), %r8
+ movl 36(%r0), %r9
+ movl 40(%r0), %r10
+ movl 44(%r0), %r11
+ movl 48(%r0), %r12
+ movl 52(%r0), %r13
+ movl 56(%r0), %r14
+ movl 60(%r0), -(%sp)
+ movl 0(%r0), %r0
+ /* XXX restore PSW */
+ rsb
+
+END(_ZNK7_Unwind13Registers_vax6jumptoEv)
+#endif
Home |
Main Index |
Thread Index |
Old Index