CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 21:31:34 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 Stop using enum for flags, as per request from joerg. #define constants and #undef after use. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.27 src/sys/lib/libunwind/Registers.hpp:1.28 --- src/sys/lib/libunwind/Registers.hpp:1.27 Mon May 31 12:12:24 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 21:31:33 2021 @@ -332,6 +332,11 @@ enum { REGNO_ARM32_S31 = 80, }; +#define FLAGS_VFPV2_USED 0x1 +#define FLAGS_VFPV3_USED 0x2 +#define FLAGS_LEGACY_VFPV2_REGNO 0x4 +#define FLAGS_EXTENDED_VFPV2_REGNO 0x8 + class Registers_arm32 { public: enum { @@ -438,15 +443,13 @@ private: uint32_t reg[REGNO_ARM32_SPSR + 1]; uint32_t flags; uint64_t fpreg[32]; - - enum { -FLAGS_VFPV2_USED = 0x1, -FLAGS_VFPV3_USED = 0x2, -FLAGS_LEGACY_VFPV2_REGNO = 0x4, -FLAGS_EXTENDED_VFPV2_REGNO = 0x8, - }; }; +#undef FLAGS_VFPV2_USED +#undef FLAGS_VFPV3_USED +#undef FLAGS_LEGACY_VFPV2_REGNO +#undef FLAGS_EXTENDED_VFPV2_REGNO + enum { DWARF_VAX_R0 = 0, DWARF_VAX_R15 = 15,
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 12:12:24 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 Bump LAST_REGISTER and LAST_RESTORE_REG to REGNO_ARM32_S31 for arm. There are two numbering schemes for VFPv2 registers: s0-s31 and d0-d15. The former is used by GCC, and the latter is by LLVM. Since libunwind was derived from LLVM, it has never supported the former. This results in crashes for GCC-compiled binaries in exception handler of C++, if it encounters VFPv2 registers when unwinding frames. This commit adds support for s0-s31 numbering to libunwind. I choose an implementation in which VFPv2 registers are ``double-counted'' as s0-s31 AND d0-d15. This does not cause real problems, since the former is only used by GCC, and the later is by LLVM. That is, different numbering schemes cannot appear in a same frame. To make sure, assertions are added in order to check this. I've confirmed that no regression for ATF both for GCC- and LLVM-compiled userlands. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.26 src/sys/lib/libunwind/Registers.hpp:1.27 --- src/sys/lib/libunwind/Registers.hpp:1.26 Mon May 31 11:57:28 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 12:12:24 2021 @@ -335,8 +335,8 @@ enum { class Registers_arm32 { public: enum { -LAST_REGISTER = REGNO_ARM32_D31, -LAST_RESTORE_REG = REGNO_ARM32_D31, +LAST_REGISTER = REGNO_ARM32_S31, +LAST_RESTORE_REG = REGNO_ARM32_S31, RETURN_OFFSET = 0, RETURN_MASK = 0, }; @@ -385,6 +385,14 @@ public: assert(validFloatVectorRegister(num)); const void *addr = reinterpret_cast(addr_); if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) { + /* + * XXX + * There are two numbering schemes for VFPv2 registers: s0-s31 + * (used by GCC) and d0-d15 (used by LLVM). We won't support both + * schemes simultaneously in a same frame. + */ + assert((flags & FLAGS_EXTENDED_VFPV2_REGNO) == 0); + flags |= FLAGS_LEGACY_VFPV2_REGNO; if ((flags & FLAGS_VFPV2_USED) == 0) { lazyVFPv2(); flags |= FLAGS_VFPV2_USED; @@ -402,6 +410,12 @@ public: addr, sizeof(fpreg[0]) / 2); } else { if (num <= REGNO_ARM32_D15) { + /* + * XXX + * See XXX comment above. + */ +assert((flags & FLAGS_LEGACY_VFPV2_REGNO) == 0); +flags |= FLAGS_EXTENDED_VFPV2_REGNO; if ((flags & FLAGS_VFPV2_USED) == 0) { lazyVFPv2(); flags |= FLAGS_VFPV2_USED; @@ -428,6 +442,8 @@ private: enum { FLAGS_VFPV2_USED = 0x1, FLAGS_VFPV3_USED = 0x2, +FLAGS_LEGACY_VFPV2_REGNO = 0x4, +FLAGS_EXTENDED_VFPV2_REGNO = 0x8, }; };
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:57:28 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 Fix logic error in copyFloatVectorRegister() for arm; copy s0-s31 or d0-d31, not both. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.25 src/sys/lib/libunwind/Registers.hpp:1.26 --- src/sys/lib/libunwind/Registers.hpp:1.25 Mon May 31 11:54:01 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 11:57:28 2021 @@ -400,19 +400,20 @@ public: #endif memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2, addr, sizeof(fpreg[0]) / 2); -} -if (num <= REGNO_ARM32_D15) { - if ((flags & FLAGS_VFPV2_USED) == 0) { -lazyVFPv2(); -flags |= FLAGS_VFPV2_USED; - } } else { - if ((flags & FLAGS_VFPV3_USED) == 0) { -lazyVFPv3(); -flags |= FLAGS_VFPV3_USED; + if (num <= REGNO_ARM32_D15) { +if ((flags & FLAGS_VFPV2_USED) == 0) { + lazyVFPv2(); + flags |= FLAGS_VFPV2_USED; +} + } else { +if ((flags & FLAGS_VFPV3_USED) == 0) { + lazyVFPv3(); + flags |= FLAGS_VFPV3_USED; +} } + memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); } -memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); } __dso_hidden void lazyVFPv2();
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:54:01 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 Fix pointer arithmetic when copying s0-s31 registers for arm. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.24 src/sys/lib/libunwind/Registers.hpp:1.25 --- src/sys/lib/libunwind/Registers.hpp:1.24 Mon May 31 11:50:43 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 11:54:01 2021 @@ -398,7 +398,7 @@ public: #if _BYTE_ORDER == _BIG_ENDIAN part = 1 - part; #endif - memcpy(fpreg + dnum + part * sizeof(fpreg[0]) / 2, + memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2, addr, sizeof(fpreg[0]) / 2); } if (num <= REGNO_ARM32_D15) {
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:50:43 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 Fix DWARF/internal register numbers of s31 for arm. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.23 src/sys/lib/libunwind/Registers.hpp:1.24 --- src/sys/lib/libunwind/Registers.hpp:1.23 Mon May 31 11:44:06 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 11:50:43 2021 @@ -318,7 +318,7 @@ enum { DWARF_ARM32_R15 = 15, DWARF_ARM32_SPSR = 128, DWARF_ARM32_S0 = 64, - DWARF_ARM32_S31 = 91, + DWARF_ARM32_S31 = 95, DWARF_ARM32_D0 = 256, DWARF_ARM32_D31 = 287, REGNO_ARM32_R0 = 0, @@ -329,7 +329,7 @@ enum { REGNO_ARM32_D15 = 32, REGNO_ARM32_D31 = 48, REGNO_ARM32_S0 = 49, - REGNO_ARM32_S31 = 70, + REGNO_ARM32_S31 = 80, }; class Registers_arm32 {
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:47:18 UTC 2021 Modified Files: src/sys/lib/libunwind: unwind_registers.S Log Message: PR toolchain/55837 Fix for jumpto() armeb; use word-wise load for flags, instead of byte-wise one. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.19 src/sys/lib/libunwind/unwind_registers.S:1.20 --- src/sys/lib/libunwind/unwind_registers.S:1.19 Mon May 31 11:41:22 2021 +++ src/sys/lib/libunwind/unwind_registers.S Mon May 31 11:47:18 2021 @@ -380,7 +380,7 @@ END(_ZN7_Unwind15Registers_arm329lazyVFP .hidden _ZNK7_Unwind15Registers_arm326jumptoEv ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) - ldrb r1, [r0, #68] /* flags */ + ldr r1, [r0, #68] /* flags */ tst r1, #1 beq .Lnovfpv2 add r2, r0, #72
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:44:07 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: PR toolchain/55837 copyFloatVectorRegister(): Assert register number is valid to make sure. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.22 src/sys/lib/libunwind/Registers.hpp:1.23 --- src/sys/lib/libunwind/Registers.hpp:1.22 Mon May 31 11:41:22 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 11:44:06 2021 @@ -382,6 +382,7 @@ public: } void copyFloatVectorRegister(int num, uint64_t addr_) { +assert(validFloatVectorRegister(num)); const void *addr = reinterpret_cast(addr_); if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) { if ((flags & FLAGS_VFPV2_USED) == 0) {
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: rin Date: Mon May 31 11:41:22 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: PR toolchain/55837 Misc style fixes for clarity: - Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(), respectively. Note that VFPv1 was obsoleted and replaced by VFPv2. - Introduce enum for flags. - Add few comments. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.18 -r1.19 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.21 src/sys/lib/libunwind/Registers.hpp:1.22 --- src/sys/lib/libunwind/Registers.hpp:1.21 Tue Feb 23 15:09:27 2021 +++ src/sys/lib/libunwind/Registers.hpp Mon May 31 11:41:22 2021 @@ -350,9 +350,8 @@ public: return REGNO_ARM32_SPSR; if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31) return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0); -if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) { +if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) return REGNO_ARM32_S0 + (num - DWARF_ARM32_S0); -} return LAST_REGISTER + 1; } @@ -385,9 +384,9 @@ public: void copyFloatVectorRegister(int num, uint64_t addr_) { const void *addr = reinterpret_cast(addr_); if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) { - if ((flags & 1) == 0) { -lazyVFP1(); -flags |= 1; + if ((flags & FLAGS_VFPV2_USED) == 0) { +lazyVFPv2(); +flags |= FLAGS_VFPV2_USED; } /* * Emulate single precision register as half of the @@ -402,27 +401,32 @@ public: addr, sizeof(fpreg[0]) / 2); } if (num <= REGNO_ARM32_D15) { - if ((flags & 1) == 0) { -lazyVFP1(); -flags |= 1; + if ((flags & FLAGS_VFPV2_USED) == 0) { +lazyVFPv2(); +flags |= FLAGS_VFPV2_USED; } } else { - if ((flags & 2) == 0) { -lazyVFP3(); -flags |= 2; + if ((flags & FLAGS_VFPV3_USED) == 0) { +lazyVFPv3(); +flags |= FLAGS_VFPV3_USED; } } memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); } - __dso_hidden void lazyVFP1(); - __dso_hidden void lazyVFP3(); + __dso_hidden void lazyVFPv2(); + __dso_hidden void lazyVFPv3(); __dso_hidden void jumpto() const __dead; private: uint32_t reg[REGNO_ARM32_SPSR + 1]; uint32_t flags; uint64_t fpreg[32]; + + enum { +FLAGS_VFPV2_USED = 0x1, +FLAGS_VFPV3_USED = 0x2, + }; }; enum { Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.18 src/sys/lib/libunwind/unwind_registers.S:1.19 --- src/sys/lib/libunwind/unwind_registers.S:1.18 Tue Feb 23 15:09:27 2021 +++ src/sys/lib/libunwind/unwind_registers.S Mon May 31 11:41:22 2021 @@ -360,37 +360,37 @@ ARM_ENTRY(_ZN7_Unwind15Registers_arm32C1 mrs r1, cpsr str r1, [r0, #64] /* CPSR */ mov r1, #0 - str r1, [r0, #68] + str r1, [r0, #68] /* flags */ RET END(_ZN7_Unwind15Registers_arm32C1Ev) - .hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev -ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) + .hidden _ZN7_Unwind15Registers_arm329lazyVFPv2Ev +ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev) add r0, #72 vstmia r0, {d0-d15} RET -END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) +END(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev) - .hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev -ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) + .hidden _ZN7_Unwind15Registers_arm329lazyVFPv3Ev +ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev) add r0, #200 vstmia r0, {d16-d31} RET -END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) +END(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev) .hidden _ZNK7_Unwind15Registers_arm326jumptoEv ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) - ldrb r1, [r0, #68] + ldrb r1, [r0, #68] /* flags */ tst r1, #1 - beq .Lnovfp1 + beq .Lnovfpv2 add r2, r0, #72 vldmia r2, {d0-d15} -.Lnovfp1: +.Lnovfpv2: tst r1, #2 - beq .Lnovfp3 + beq .Lnovfpv3 add r2, r0, #200 vldmia r2, {d16-d31} -.Lnovfp3: +.Lnovfpv3: ldr r1, [r0, #64] msr cpsr_sxc, r1 ldmia r0, {r0-r15}
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sun Feb 28 23:12:37 UTC 2021 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Defer acquiring the FDE lock until after the allocation. This can avoid nesting issues between malloc and backtrace when using LSan. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.9 src/sys/lib/libunwind/AddressSpace.hpp:1.10 --- src/sys/lib/libunwind/AddressSpace.hpp:1.9 Thu Nov 2 16:09:33 2017 +++ src/sys/lib/libunwind/AddressSpace.hpp Sun Feb 28 23:12:37 2021 @@ -283,7 +283,6 @@ public: } bool addFDE(pint_t pcStart, pint_t pcEnd, pint_t fde) { -pthread_rwlock_wrlock(); Range *n = (Range *)malloc(sizeof(*n)); n->hdr_base = fde; n->hdr_start = 0; @@ -292,6 +291,7 @@ public: n->last_pc = pcEnd; n->data_base = 0; n->ehframe_base = 0; +pthread_rwlock_wrlock(); if (static_cast(rb_tree_insert_node(, n)) == n) { pthread_rwlock_unlock(); return true;
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Feb 23 15:09:27 UTC 2021 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: Redo the aarch64 support in libunwind. This included a number of bugs starting from returning the wrong value from the constructor to completely bogus offset computations. Drop the ELR support for now. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.17 -r1.18 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.20 src/sys/lib/libunwind/Registers.hpp:1.21 --- src/sys/lib/libunwind/Registers.hpp:1.20 Thu Jul 13 15:13:19 2017 +++ src/sys/lib/libunwind/Registers.hpp Tue Feb 23 15:09:27 2021 @@ -244,16 +244,14 @@ enum { DWARF_AARCH64_X0 = 0, DWARF_AARCH64_X30 = 30, DWARF_AARCH64_SP = 31, - DWARF_AARCH64_ELR_MODE = 33, DWARF_AARCH64_V0 = 64, DWARF_AARCH64_V31 = 95, REGNO_AARCH64_X0 = 0, REGNO_AARCH64_X30 = 30, REGNO_AARCH64_SP = 31, - REGNO_AARCH64_ELR_MODE = 32, - REGNO_AARCH64_V0 = 33, - REGNO_AARCH64_V31 = 64, + REGNO_AARCH64_V0 = 32, + REGNO_AARCH64_V31 = 63, }; class Registers_aarch64 { @@ -272,8 +270,6 @@ public: return REGNO_AARCH64_X0 + (num - DWARF_AARCH64_X0); if (num == DWARF_AARCH64_SP) return REGNO_AARCH64_SP; -if (num == DWARF_AARCH64_ELR_MODE) - return REGNO_AARCH64_ELR_MODE; if (num >= DWARF_AARCH64_V0 && num <= DWARF_AARCH64_V31) return REGNO_AARCH64_V0 + (num - DWARF_AARCH64_V0); return LAST_REGISTER + 1; @@ -307,17 +303,14 @@ public: void copyFloatVectorRegister(int num, uint64_t addr_) { const void *addr = reinterpret_cast(addr_); -memcpy(vecreg + (num - REGNO_AARCH64_V0), addr, sizeof(vecreg[0])); +memcpy(vecreg + (num - REGNO_AARCH64_V0), addr, 16); } __dso_hidden void jumpto() const __dead; private: - struct vecreg_t { -uint64_t low, high; - }; - uint64_t reg[REGNO_AARCH64_ELR_MODE + 1]; - vecreg_t vecreg[32]; + uint64_t reg[REGNO_AARCH64_SP + 1]; + uint64_t vecreg[64]; }; enum { Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.17 src/sys/lib/libunwind/unwind_registers.S:1.18 --- src/sys/lib/libunwind/unwind_registers.S:1.17 Mon May 25 18:41:08 2015 +++ src/sys/lib/libunwind/unwind_registers.S Tue Feb 23 15:09:27 2021 @@ -272,68 +272,81 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jump #ifdef __aarch64__ .hidden _ZN7_Unwind17Registers_aarch64C1Ev ENTRY(_ZN7_Unwind17Registers_aarch64C1Ev) - stp x0, x1, [x0] - add x0, x0, #16 - stp x2, x3, [x0], #16 - stp x4, x5, [x0], #16 - stp x6, x7, [x0], #16 - stp x8, x9, [x0], #16 - stp x10, x11, [x0], #16 - stp x12, x13, [x0], #16 - stp x14, x15, [x0], #16 - stp x16, x17, [x0], #16 - stp x18, x19, [x0], #16 - stp x20, x22, [x0], #16 - stp x22, x24, [x0], #16 - stp x24, x26, [x0], #16 - stp x26, x27, [x0], #16 - stp x28, x29, [x0], #16 - mov x1, sp - stp x30, x1, [x0], #16 - - add x0, x0, #8 - str xzr, [x0], #8 - - stp q0, q1, [x0], #64 - stp q2, q3, [x0], #64 - stp q4, q5, [x0], #64 - stp q6, q7, [x0], #64 - stp q8, q9, [x0], #64 - stp q10, q11, [x0], #64 - stp q12, q13, [x0], #64 - stp q14, q15, [x0], #64 - stp q16, q17, [x0], #64 - stp q18, q19, [x0], #64 - stp q20, q21, [x0], #64 - stp q22, q23, [x0], #64 - stp q24, q25, [x0], #64 - stp q26, q27, [x0], #64 - stp q28, q29, [x0], #64 - stp q30, q31, [x0], #64 + stp x0, x1, [x0, #0x000] + stp x2, x3, [x0, #0x010] + stp x4, x5, [x0, #0x020] + stp x6, x7, [x0, #0x030] + stp x8, x9, [x0, #0x040] + stp x10,x11, [x0, #0x050] + stp x12,x13, [x0, #0x060] + stp x14,x15, [x0, #0x070] + stp x16,x17, [x0, #0x080] + stp x18,x19, [x0, #0x090] + stp x20,x21, [x0, #0x0A0] + stp x22,x23, [x0, #0x0B0] + stp x24,x25, [x0, #0x0C0] + stp x26,x27, [x0, #0x0D0] + stp x28,x29, [x0, #0x0E0] + mov x1,sp + stp x30,x1, [x0, #0x0F0] + + stp q0, q1, [x0, #0x100] + stp q2, q3, [x0, #0x120] + stp q4, q5, [x0, #0x140] + stp q6, q7, [x0, #0x160] + stp q8, q9, [x0, #0x180] + stp q10, q11, [x0, #0x1a0] + stp q12, q13, [x0, #0x1c0] + stp q14, q15, [x0, #0x1e0] + stp q16, q17, [x0, #0x200] + stp q18, q19, [x0, #0x220] + stp q20, q21, [x0, #0x240] + stp q22, q23, [x0, #0x260] + stp q24, q25, [x0, #0x280] + stp q26, q27, [x0, #0x2a0] + stp q28, q29, [x0, #0x2c0] + stp q30, q31, [x0, #0x2e0] ret END(_ZN7_Unwind17Registers_aarch64C1Ev) .hidden _ZNK7_Unwind17Registers_aarch646jumptoEv ENTRY(_ZNK7_Unwind17Registers_aarch646jumptoEv) - ldp x2, x3, [x0, #16] - ldp x4, x6, [x0, #32] - ldp x6, x7, [x0, #48] - ldp x8, x9, [x0, #64] - ldp x10, x11, [x0, #80] - ldp x12, x13, [x0, #96] - ldp x14, x16, [x0, #112] - ldp x16, x17, [x0, #128] - ldp x18, x19, [x0, #144] - ldp x20, x21, [x0, #160] - ldp x22,
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Feb 23 15:07:32 UTC 2021 Modified Files: src/sys/lib/libunwind: DwarfParser.hpp Log Message: The return address register entry is the DWARF register. On PowerPC, this is not the same as the internal encoding, since the Link Register is deliberately non-continous from the other general purpose register values. To handle this, always translate the value into the internal format. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libunwind/DwarfParser.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfParser.hpp diff -u src/sys/lib/libunwind/DwarfParser.hpp:1.5 src/sys/lib/libunwind/DwarfParser.hpp:1.6 --- src/sys/lib/libunwind/DwarfParser.hpp:1.5 Sat May 3 23:19:56 2014 +++ src/sys/lib/libunwind/DwarfParser.hpp Tue Feb 23 15:07:32 2021 @@ -239,7 +239,7 @@ bool CFI_Parser::parseCIE(A // Parse data alignment factor cieInfo->dataAlignFactor = addressSpace.getSLEB128(p, cieContentEnd); // Parse return address register - cieInfo->returnAddressRegister = (uint8_t)addressSpace.getULEB128(p, cieContentEnd); + cieInfo->returnAddressRegister = R::dwarf2regno((uint8_t)addressSpace.getULEB128(p, cieContentEnd)); // Parse augmentation data based on augmentation string. if (addressSpace.get8(strStart) == 'z') { // parse augmentation data length
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Jul 17 19:01:16 UTC 2018 Modified Files: src/sys/lib/libunwind: UnwindCursor.hpp libunwind.cxx Log Message: The semantics of DW_CFA_GNU_args_size have changed subtile over the years. Adopt the new convention that it is call-site specific and that it should be applied before moving the IP by personality routines, but not during normal unwinding. Further discussion can be found in LLVM's phabricator review D38680. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/UnwindCursor.hpp cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libunwind/libunwind.cxx Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/UnwindCursor.hpp diff -u src/sys/lib/libunwind/UnwindCursor.hpp:1.3 src/sys/lib/libunwind/UnwindCursor.hpp:1.4 --- src/sys/lib/libunwind/UnwindCursor.hpp:1.3 Mon Apr 28 13:39:23 2014 +++ src/sys/lib/libunwind/UnwindCursor.hpp Tue Jul 17 19:01:16 2018 @@ -61,9 +61,6 @@ public: this->setInfoBasedOnIPRegister(true); if (fUnwindInfoMissing) return UNW_STEP_END; - - if (fInfo.extra_args) -setSP(getSP() + fInfo.extra_args); return UNW_STEP_SUCCESS; } __builtin_unreachable(); Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.9 src/sys/lib/libunwind/libunwind.cxx:1.10 --- src/sys/lib/libunwind/libunwind.cxx:1.9 Tue Feb 17 21:02:33 2015 +++ src/sys/lib/libunwind/libunwind.cxx Tue Jul 17 19:01:16 2018 @@ -277,6 +277,8 @@ void _Unwind_SetIP(struct _Unwind_Contex unw_proc_info_t info; cursor->getInfo(); cursor->setInfoBasedOnIPRegister(false); + if (info.extra_args) +cursor->setSP(cursor->getSP() + info.extra_args); } uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context) {
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Jul 17 18:58:58 UTC 2018 Modified Files: src/sys/lib/libunwind: DwarfInstructions.hpp Log Message: Remove redundant setIP call overwritten a few lines later. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libunwind/DwarfInstructions.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfInstructions.hpp diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.6 src/sys/lib/libunwind/DwarfInstructions.hpp:1.7 --- src/sys/lib/libunwind/DwarfInstructions.hpp:1.6 Sat Sep 27 12:08:46 2014 +++ src/sys/lib/libunwind/DwarfInstructions.hpp Tue Jul 17 18:58:58 2018 @@ -153,7 +153,6 @@ step_result DwarfInstructions::ste // The CFA is defined as the stack pointer at the call site. // Therefore the SP is restored by setting it to the CFA. newRegisters.setSP(cfa); - newRegisters.setIP(returnAddress + R::RETURN_OFFSET); returnAddress += R::RETURN_OFFSET; returnAddress &= ~R::RETURN_MASK; newRegisters.setIP(returnAddress);
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: christos Date: Thu Nov 2 16:09:33 UTC 2017 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Avoid negative shift. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.8 src/sys/lib/libunwind/AddressSpace.hpp:1.9 --- src/sys/lib/libunwind/AddressSpace.hpp:1.8 Thu Jan 29 15:05:56 2015 +++ src/sys/lib/libunwind/AddressSpace.hpp Thu Nov 2 12:09:33 2017 @@ -140,7 +140,7 @@ public: } while (byte >= 0x80); // sign extend negative numbers if ((byte & 0x40) != 0) - result |= (-1LL) << bit; + result |= (~0ULL) << bit; return result; }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Jul 13 15:13:19 UTC 2017 Modified Files: src/sys/lib/libunwind: Registers.hpp Log Message: GCC 5.3 likes to emit unwind data with float registers, i.e. register halfs. Compensate. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.19 src/sys/lib/libunwind/Registers.hpp:1.20 --- src/sys/lib/libunwind/Registers.hpp:1.19 Sat Sep 27 12:08:46 2014 +++ src/sys/lib/libunwind/Registers.hpp Thu Jul 13 15:13:19 2017 @@ -12,6 +12,7 @@ #ifndef __REGISTERS_HPP__ #define __REGISTERS_HPP__ +#include #include #include @@ -323,8 +324,8 @@ enum { DWARF_ARM32_R0 = 0, DWARF_ARM32_R15 = 15, DWARF_ARM32_SPSR = 128, - DWARF_ARM32_OLD_S0 = 64, - DWARF_ARM32_OLD_S31 = 91, + DWARF_ARM32_S0 = 64, + DWARF_ARM32_S31 = 91, DWARF_ARM32_D0 = 256, DWARF_ARM32_D31 = 287, REGNO_ARM32_R0 = 0, @@ -334,6 +335,8 @@ enum { REGNO_ARM32_D0 = 17, REGNO_ARM32_D15 = 32, REGNO_ARM32_D31 = 48, + REGNO_ARM32_S0 = 49, + REGNO_ARM32_S31 = 70, }; class Registers_arm32 { @@ -354,9 +357,8 @@ public: return REGNO_ARM32_SPSR; if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31) return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0); -if (num >= DWARF_ARM32_OLD_S0 && num <= DWARF_ARM32_OLD_S31) { - assert(num % 2 == 0); - return REGNO_ARM32_D0 + (num - DWARF_ARM32_OLD_S0) / 2; +if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) { + return REGNO_ARM32_S0 + (num - DWARF_ARM32_S0); } return LAST_REGISTER + 1; } @@ -384,10 +386,28 @@ public: void setSP(uint64_t value) { reg[REGNO_ARM32_SP] = value; } bool validFloatVectorRegister(int num) const { -return (num >= REGNO_ARM32_D0 && num <= REGNO_ARM32_D31); +return (num >= REGNO_ARM32_D0 && num <= REGNO_ARM32_S31); } void copyFloatVectorRegister(int num, uint64_t addr_) { +const void *addr = reinterpret_cast(addr_); +if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) { + if ((flags & 1) == 0) { +lazyVFP1(); +flags |= 1; + } + /* + * Emulate single precision register as half of the + * corresponding double register. + */ + int dnum = (num - REGNO_ARM32_S0) / 2; + int part = (num - REGNO_ARM32_S0) % 2; +#if _BYTE_ORDER == _BIG_ENDIAN + part = 1 - part; +#endif + memcpy(fpreg + dnum + part * sizeof(fpreg[0]) / 2, +addr, sizeof(fpreg[0]) / 2); +} if (num <= REGNO_ARM32_D15) { if ((flags & 1) == 0) { lazyVFP1(); @@ -399,7 +419,6 @@ public: flags |= 2; } } -const void *addr = reinterpret_cast(addr_); memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: matt Date: Mon May 25 18:41:08 UTC 2015 Modified Files: src/sys/lib/libunwind: unwind_registers.S Log Message: Use ARM_ENTRY since these aren't thumb compatible. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.16 src/sys/lib/libunwind/unwind_registers.S:1.17 --- src/sys/lib/libunwind/unwind_registers.S:1.16 Wed Sep 3 19:27:21 2014 +++ src/sys/lib/libunwind/unwind_registers.S Mon May 25 18:41:08 2015 @@ -341,7 +341,7 @@ END(_ZNK7_Unwind17Registers_aarch646jump #if defined(__arm__) .fpu vfpv3 .hidden _ZN7_Unwind15Registers_arm32C1Ev -ENTRY(_ZN7_Unwind15Registers_arm32C1Ev) +ARM_ENTRY(_ZN7_Unwind15Registers_arm32C1Ev) stmia r0, {r0-r14} str lr, [r0, #60] /* PC */ mrs r1, cpsr @@ -352,21 +352,21 @@ ENTRY(_ZN7_Unwind15Registers_arm32C1Ev) END(_ZN7_Unwind15Registers_arm32C1Ev) .hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev -ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) +ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) add r0, #72 vstmia r0, {d0-d15} RET END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) .hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev -ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) +ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) add r0, #200 vstmia r0, {d16-d31} RET END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) .hidden _ZNK7_Unwind15Registers_arm326jumptoEv -ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) +ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) ldrb r1, [r0, #68] tst r1, #1 beq .Lnovfp1
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Feb 17 21:02:33 UTC 2015 Modified Files: src/sys/lib/libunwind: libunwind.cxx unwind.h Log Message: Provide _Unwind_Find_FDE for libgcc_s compatibility. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libunwind/libunwind.cxx cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/unwind.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.8 src/sys/lib/libunwind/libunwind.cxx:1.9 --- src/sys/lib/libunwind/libunwind.cxx:1.8 Sun Apr 13 19:04:01 2014 +++ src/sys/lib/libunwind/libunwind.cxx Tue Feb 17 21:02:33 2015 @@ -11,6 +11,8 @@ // //===--===// +#define _UNWIND_GCC_EXTENSIONS + #include unwind.h #include UnwindCursor.hpp @@ -329,6 +331,23 @@ void *_Unwind_FindEnclosingFunction(void return info.end_ip ? (void *)info.start_ip : NULL; } +void *_Unwind_Find_FDE(void *pc, struct dwarf_eh_bases *bases) { + NativeUnwindRegisters registers; + ThisUnwindCursor cursor(registers, sThisAddressSpace); + + unw_proc_info_t info; + cursor.setIP((uintptr_t)pc); + cursor.setInfoBasedOnIPRegister(); + + cursor.getInfo(info); + if (info.end_ip == 0) +return NULL; + bases-tbase = 0; /* Not supported */ + bases-dbase = (void *)info.data_base; + bases-func = (void *)info.start_ip; + return (void *)info.unwind_info; +} + uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context) { ThisUnwindCursor *cursor = (ThisUnwindCursor *)context; unw_proc_info_t frameInfo; Index: src/sys/lib/libunwind/unwind.h diff -u src/sys/lib/libunwind/unwind.h:1.2 src/sys/lib/libunwind/unwind.h:1.3 --- src/sys/lib/libunwind/unwind.h:1.2 Thu Mar 13 00:28:20 2014 +++ src/sys/lib/libunwind/unwind.h Tue Feb 17 21:02:33 2015 @@ -56,6 +56,14 @@ typedef _Unwind_Reason_Code (*__personal struct _Unwind_Exception *, struct _Unwind_Context *); +#ifdef _UNWIND_GCC_EXTENSIONS +struct dwarf_eh_bases { + void *tbase; + void *dbase; + void *func; +}; +#endif + __BEGIN_DECLS _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *); @@ -85,6 +93,10 @@ void __register_frame_info(const void *, void __deregister_frame(const void *); void *__deregister_frame_info(const void *); +#ifdef _UNWIND_GCC_EXTENSIONS +void *_Unwind_Find_FDE(void *, struct dwarf_eh_bases *); +#endif + __END_DECLS #endif // _UNWIND_H
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Jan 29 20:45:16 UTC 2015 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: Force FPU support for Clang, don't disable IAS completely. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.10 src/sys/lib/libunwind/Makefile.inc:1.11 --- src/sys/lib/libunwind/Makefile.inc:1.10 Thu Oct 23 17:51:22 2014 +++ src/sys/lib/libunwind/Makefile.inc Thu Jan 29 20:45:16 2015 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.10 2014/10/23 17:51:22 christos Exp $ +# $NetBSD: Makefile.inc,v 1.11 2015/01/29 20:45:16 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -13,6 +13,6 @@ COPTS.libunwind.cxx+= -fno-exceptions -f COPTS.libunwind.cxx+= -Wno-old-style-cast CPPFLAGS.libunwind.cxx+=-I${NETBSDSRCDIR}/sys/lib/libunwind -.if ${MACHINE_CPU} == arm -AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == clang:? -no-integrated-as :} +.if ${LIBC_MACHINE_CPU} == arm +AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == clang:? -mfpu=vfp3 :} .endif
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Jan 29 20:05:56 UTC 2015 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Fix binary search when search value is in the last block, but not equal to the start of the range. PR 49444. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.7 src/sys/lib/libunwind/AddressSpace.hpp:1.8 --- src/sys/lib/libunwind/AddressSpace.hpp:1.7 Sun Jul 20 14:40:58 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Thu Jan 29 20:05:56 2015 @@ -263,21 +263,19 @@ public: pint_t base = n-hdr_base; pint_t first = n-hdr_start; -pint_t len = n-hdr_entries; -while (len) { - pint_t next = first + ((len + 1) / 2) * 8; +for (pint_t len = n-hdr_entries; len 1; ) { + pint_t next = first + (len / 2) * 8; pint_t nextPC = base + (int32_t)get32(next); if (nextPC == pc) { first = next; break; } if (nextPC pc) { -len -= (len + 1) / 2; first = next; - } else if (len == 1) -break; - else -len = (len + 1) / 2; +len -= (len / 2); + } else { +len /= 2; + } } fdeStart = base + (int32_t)get32(first + 4); data_base = n-data_base;
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: christos Date: Thu Oct 23 17:51:22 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: prefer our own unwind.h To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.9 src/sys/lib/libunwind/Makefile.inc:1.10 --- src/sys/lib/libunwind/Makefile.inc:1.9 Mon Jun 30 16:42:31 2014 +++ src/sys/lib/libunwind/Makefile.inc Thu Oct 23 13:51:22 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.9 2014/06/30 20:42:31 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.10 2014/10/23 17:51:22 christos Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -11,6 +11,7 @@ COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == COPTS.libunwind.cxx+= -funwind-tables -fno-rtti COPTS.libunwind.cxx+= -fno-exceptions -fvisibility=hidden COPTS.libunwind.cxx+= -Wno-old-style-cast +CPPFLAGS.libunwind.cxx+=-I${NETBSDSRCDIR}/sys/lib/libunwind .if ${MACHINE_CPU} == arm AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == clang:? -no-integrated-as :}
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sat Sep 27 12:08:46 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfInstructions.hpp Registers.hpp Log Message: Introduce a separate bit mask for the return address. Use it on HPPA. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libunwind/DwarfInstructions.hpp cvs rdiff -u -r1.18 -r1.19 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfInstructions.hpp diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.5 src/sys/lib/libunwind/DwarfInstructions.hpp:1.6 --- src/sys/lib/libunwind/DwarfInstructions.hpp:1.5 Sat Apr 26 23:17:38 2014 +++ src/sys/lib/libunwind/DwarfInstructions.hpp Sat Sep 27 12:08:46 2014 @@ -154,6 +154,9 @@ step_result DwarfInstructionsA, R::ste // Therefore the SP is restored by setting it to the CFA. newRegisters.setSP(cfa); newRegisters.setIP(returnAddress + R::RETURN_OFFSET); + returnAddress += R::RETURN_OFFSET; + returnAddress = ~R::RETURN_MASK; + newRegisters.setIP(returnAddress); // Now replace register set with the working copy. registers = newRegisters; Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.18 src/sys/lib/libunwind/Registers.hpp:1.19 --- src/sys/lib/libunwind/Registers.hpp:1.18 Wed Sep 3 19:27:21 2014 +++ src/sys/lib/libunwind/Registers.hpp Sat Sep 27 12:08:46 2014 @@ -35,6 +35,7 @@ public: LAST_REGISTER = REGNO_X86_EIP, LAST_RESTORE_REG = REGNO_X86_EIP, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_x86(); @@ -100,6 +101,7 @@ public: LAST_REGISTER = REGNO_X86_64_RIP, LAST_RESTORE_REG = REGNO_X86_64_RIP, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_x86_64(); @@ -168,6 +170,7 @@ public: LAST_REGISTER = REGNO_PPC32_V31, LAST_RESTORE_REG = REGNO_PPC32_V31, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_ppc32(); @@ -258,6 +261,7 @@ public: LAST_RESTORE_REG = REGNO_AARCH64_V31, LAST_REGISTER = REGNO_AARCH64_V31, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_aarch64(); @@ -338,6 +342,7 @@ public: LAST_REGISTER = REGNO_ARM32_D31, LAST_RESTORE_REG = REGNO_ARM32_D31, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_arm32(); @@ -425,6 +430,7 @@ public: LAST_REGISTER = REGNO_VAX_PSW, LAST_RESTORE_REG = REGNO_VAX_PSW, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_vax(); @@ -496,6 +502,7 @@ public: LAST_REGISTER = REGNO_M68K_FP7, LAST_RESTORE_REG = REGNO_M68K_FP7, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_M68K(); @@ -572,6 +579,7 @@ public: LAST_REGISTER = REGNO_SH3_PR, LAST_RESTORE_REG = REGNO_SH3_PR, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_SH3(); @@ -636,6 +644,7 @@ public: LAST_REGISTER = REGNO_SPARC64_PC, LAST_RESTORE_REG = REGNO_SPARC64_PC, RETURN_OFFSET = 8, +RETURN_MASK = 0, }; typedef uint64_t reg_t; @@ -699,6 +708,7 @@ public: LAST_REGISTER = REGNO_SPARC_PC, LAST_RESTORE_REG = REGNO_SPARC_PC, RETURN_OFFSET = 8, +RETURN_MASK = 0, }; typedef uint32_t reg_t; @@ -764,6 +774,7 @@ public: LAST_REGISTER = REGNO_ALPHA_F30, LAST_RESTORE_REG = REGNO_ALPHA_F30, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; typedef uint32_t reg_t; @@ -830,7 +841,8 @@ public: enum { LAST_REGISTER = REGNO_HPPA_FR31H, LAST_RESTORE_REG = REGNO_HPPA_FR31H, -RETURN_OFFSET = -3, // strictly speaking, this is a mask +RETURN_OFFSET = 0, +RETURN_MASK = 3, }; __dso_hidden Registers_HPPA(); @@ -902,6 +914,7 @@ public: LAST_REGISTER = REGNO_MIPS_F31, LAST_RESTORE_REG = REGNO_MIPS_F31, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_MIPS(); @@ -973,6 +986,7 @@ public: LAST_REGISTER = REGNO_MIPS64_F31, LAST_RESTORE_REG = REGNO_MIPS64_F31, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_MIPS64(); @@ -1044,6 +1058,7 @@ public: LAST_REGISTER = REGNO_OR1K_FPCSR, LAST_RESTORE_REG = REGNO_OR1K_FPCSR, RETURN_OFFSET = 0, +RETURN_MASK = 0, }; __dso_hidden Registers_or1k();
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: matt Date: Wed Sep 3 19:27:22 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: Add OR1K support To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.15 -r1.16 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.17 src/sys/lib/libunwind/Registers.hpp:1.18 --- src/sys/lib/libunwind/Registers.hpp:1.17 Sun Aug 10 05:57:31 2014 +++ src/sys/lib/libunwind/Registers.hpp Wed Sep 3 19:27:21 2014 @@ -1024,6 +1024,73 @@ private: uint64_t fpreg[32]; }; +enum { + DWARF_OR1K_R0 = 0, + DWARF_OR1K_SP = 1, + DWARF_OR1K_LR = 9, + DWARF_OR1K_R31 = 31, + DWARF_OR1K_FPCSR = 32, + + REGNO_OR1K_R0 = 0, + REGNO_OR1K_SP = 1, + REGNO_OR1K_LR = 9, + REGNO_OR1K_R31 = 31, + REGNO_OR1K_FPCSR = 32, +}; + +class Registers_or1k { +public: + enum { +LAST_REGISTER = REGNO_OR1K_FPCSR, +LAST_RESTORE_REG = REGNO_OR1K_FPCSR, +RETURN_OFFSET = 0, + }; + + __dso_hidden Registers_or1k(); + + static int dwarf2regno(int num) { +if (num = DWARF_OR1K_R0 num = DWARF_OR1K_R31) + return REGNO_OR1K_R0 + (num - DWARF_OR1K_R0); +if (num == DWARF_OR1K_FPCSR) + return REGNO_OR1K_FPCSR; +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_OR1K_LR]; } + + void setIP(uint64_t value) { reg[REGNO_OR1K_LR] = value; } + + uint64_t getSP() const { return reg[REGNO_OR1K_SP]; } + + void setSP(uint64_t value) { reg[REGNO_OR1K_SP] = 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_OR1K_FPCSR + 1]; +}; + #if __i386__ typedef Registers_x86 NativeUnwindRegisters; #elif __x86_64__ @@ -1052,6 +1119,8 @@ typedef Registers_SPARC NativeUnwindRegi typedef Registers_Alpha NativeUnwindRegisters; #elif __hppa__ typedef Registers_HPPA NativeUnwindRegisters; +#elif __or1k__ +typedef Registers_or1k NativeUnwindRegisters; #endif } // namespace _Unwind Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.15 src/sys/lib/libunwind/unwind_registers.S:1.16 --- src/sys/lib/libunwind/unwind_registers.S:1.15 Sun Aug 10 05:57:31 2014 +++ src/sys/lib/libunwind/unwind_registers.S Wed Sep 3 19:27:21 2014 @@ -1253,3 +1253,84 @@ LEAF_ENTRY_NOPROFILE(_ZNK7_Unwind14Regis bv,n %r0(%r2) EXIT(_ZNK7_Unwind14Registers_HPPA6jumptoEv) #endif + +#ifdef __or1k__ +ENTRY_NP(_ZN7_Unwind14Registers_or1kC1Ev) + l.sw (0*3)(r3), r0 + l.sw (1*3)(r3), r1 + l.sw (2*3)(r3), r2 + l.sw (3*3)(r3), r3 + l.sw (4*3)(r3), r4 + l.sw (5*3)(r3), r5 + l.sw (6*3)(r3), r6 + l.sw (7*3)(r3), r7 + l.sw (8*3)(r3), r8 + l.sw (9*3)(r3), r9 + l.sw (10*3)(r3), r10 + l.sw (11*3)(r3), r11 + l.sw (12*3)(r3), r12 + l.sw (13*3)(r3), r13 + l.sw (14*3)(r3), r14 + l.sw (15*3)(r3), r15 + l.sw (16*3)(r3), r16 + l.sw (17*3)(r3), r17 + l.sw (18*3)(r3), r18 + l.sw (19*3)(r3), r19 + l.sw (20*3)(r3), r20 + l.sw (21*3)(r3), r21 + l.sw (22*3)(r3), r22 + l.sw (23*3)(r3), r23 + l.sw (24*3)(r3), r24 + l.sw (25*3)(r3), r25 + l.sw (26*3)(r3), r26 + l.sw (27*3)(r3), r27 + l.sw (28*3)(r3), r28 + l.sw (29*3)(r3), r29 + l.sw (30*3)(r3), r30 + l.sw (31*3)(r3), r31 + l.mfspr r4, r0, 20 + l.sw (32*4)(r3), r4 + l.jr lr + l.nop +END(_ZN7_Unwind14Registers_or1kC1Ev) + +ENTRY_NP(_ZNK7_Unwind14Registers_or1k6jumptoEv) + l.lwz r6, (32*4)(r3) + l.mtspr r0, r6, 20 + l.lwz r0, (0*4)(r3) + l.lwz r1, (1*4)(r3) + l.lwz r2, (2*4)(r3) + l.lwz r4, (4*4)(r3) + l.lwz r5, (5*4)(r3) + l.lwz r6, (6*4)(r3) + l.lwz r7, (7*4)(r3) + l.lwz r8, (8*4)(r3) + l.lwz r9, (9*4)(r3) + l.lwz r10, (10*4)(r3) + l.lwz r11, (11*4)(r3) + l.lwz r12, (12*4)(r3) + l.lwz r13, (13*4)(r3) + l.lwz r14, (14*4)(r3) + l.lwz r15, (15*4)(r3) + l.lwz r16, (16*4)(r3) + l.lwz r17, (17*4)(r3) + l.lwz r18, (18*4)(r3) + l.lwz r19, (19*4)(r3) + l.lwz r20, (20*4)(r3) + l.lwz r21, (21*4)(r3) + l.lwz r22, (22*4)(r3) + l.lwz r23, (23*4)(r3) + l.lwz r24, (24*4)(r3) + l.lwz r25, (25*4)(r3) + l.lwz r26, (26*4)(r3) + l.lwz r27, (27*4)(r3) + l.lwz r28, (28*4)(r3) + l.lwz r29, (29*4)(r3) + l.lwz r30, (30*4)(r3) + l.lwz r31, (31*4)(r3) + + l.lwz r3, (3*4)(r3) /* return r3 */ + l.jr lr +END(_ZNK7_Unwind14Registers_or1k6jumptoEv) + +#endif
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sun Jul 20 14:40:58 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Fix braino in last commit and free the node iff the insert failed. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.6 src/sys/lib/libunwind/AddressSpace.hpp:1.7 --- src/sys/lib/libunwind/AddressSpace.hpp:1.6 Mon Jul 14 11:36:39 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Sun Jul 20 14:40:58 2014 @@ -402,7 +402,7 @@ private: n-data_base = data_base; n-ehframe_base = ehframe_base; -if (static_castRange *(rb_tree_insert_node(segmentTree, n)) == n) { +if (static_castRange *(rb_tree_insert_node(segmentTree, n)) != n) { free(n); return; }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Mon Jul 14 11:36:39 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Use static_cast for rb_tree_insert_node void * return value. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.5 src/sys/lib/libunwind/AddressSpace.hpp:1.6 --- src/sys/lib/libunwind/AddressSpace.hpp:1.5 Mon Apr 28 13:39:23 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Mon Jul 14 11:36:39 2014 @@ -294,7 +294,7 @@ public: n-last_pc = pcEnd; n-data_base = 0; n-ehframe_base = 0; -if (rb_tree_insert_node(segmentTree, n) == n) { +if (static_castRange *(rb_tree_insert_node(segmentTree, n)) == n) { pthread_rwlock_unlock(fdeTreeLock); return true; } @@ -305,7 +305,7 @@ public: bool removeFDE(pint_t pcStart, pint_t pcEnd, pint_t fde) { pthread_rwlock_wrlock(fdeTreeLock); -Range *n = (Range *)rb_tree_find_node(segmentTree, pcStart); +Range *n = static_castRange *(rb_tree_find_node(segmentTree, pcStart)); if (n == NULL) { pthread_rwlock_unlock(fdeTreeLock); return false; @@ -402,7 +402,7 @@ private: n-data_base = data_base; n-ehframe_base = ehframe_base; -if (rb_tree_insert_node(segmentTree, n) != n) { +if (static_castRange *(rb_tree_insert_node(segmentTree, n)) == n) { free(n); return; }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Mon Jun 30 20:42:31 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: IAS is clang specific. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.8 src/sys/lib/libunwind/Makefile.inc:1.9 --- src/sys/lib/libunwind/Makefile.inc:1.8 Sat Jun 28 20:18:15 2014 +++ src/sys/lib/libunwind/Makefile.inc Mon Jun 30 20:42:31 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.8 2014/06/28 20:18:15 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.9 2014/06/30 20:42:31 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -13,5 +13,5 @@ COPTS.libunwind.cxx+= -fno-exceptions -f COPTS.libunwind.cxx+= -Wno-old-style-cast .if ${MACHINE_CPU} == arm -AFLAGS.unwind_registers.S+= -no-integrated-as +AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == clang:? -no-integrated-as :} .endif
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: matt Date: Fri Jun 13 21:31:20 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: Split COPTS.libunwind.cxx into multiple lines. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.6 src/sys/lib/libunwind/Makefile.inc:1.7 --- src/sys/lib/libunwind/Makefile.inc:1.6 Fri Jun 13 01:17:46 2014 +++ src/sys/lib/libunwind/Makefile.inc Fri Jun 13 21:31:20 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.6 2014/06/13 01:17:46 mrg Exp $ +# $NetBSD: Makefile.inc,v 1.7 2014/06/13 21:31:20 matt Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -8,4 +8,6 @@ SRCS+= libunwind.cxx \ INCS+= unwind.h COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == gcc:? -std=c++0x : -std=c++11 } -COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast +COPTS.libunwind.cxx+= -funwind-tables -fno-rtti +COPTS.libunwind.cxx+= -fno-exceptions -fvisibility=hidden +COPTS.libunwind.cxx+= -Wno-old-style-cast
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed May 14 22:13:36 UTC 2014 Modified Files: src/sys/lib/libunwind: unwind_registers.S Log Message: Lazy VFP processing works a lot better if the functions contain a return instruction. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.13 src/sys/lib/libunwind/unwind_registers.S:1.14 --- src/sys/lib/libunwind/unwind_registers.S:1.13 Sun May 11 02:07:35 2014 +++ src/sys/lib/libunwind/unwind_registers.S Wed May 14 22:13:36 2014 @@ -286,12 +286,14 @@ END(_ZN7_Unwind15Registers_arm32C1Ev) ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) add r0, #72 vstmia r0, {d0-d15} + RET END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) .hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) add r0, #200 vstmia r0, {d16-d31} + RET END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) .hidden _ZNK7_Unwind15Registers_arm326jumptoEv
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sun May 11 02:07:35 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: Support DWARFish unwind for ARM. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.15 src/sys/lib/libunwind/Registers.hpp:1.16 --- src/sys/lib/libunwind/Registers.hpp:1.15 Sat Apr 26 23:17:38 2014 +++ src/sys/lib/libunwind/Registers.hpp Sun May 11 02:07:35 2014 @@ -240,21 +240,24 @@ enum { DWARF_ARM32_R0 = 0, DWARF_ARM32_R15 = 15, DWARF_ARM32_SPSR = 128, - DWARF_ARM32_D0 = 256, // VFP-v3/Neon + DWARF_ARM32_OLD_S0 = 64, + DWARF_ARM32_OLD_S31 = 91, + DWARF_ARM32_D0 = 256, DWARF_ARM32_D31 = 287, REGNO_ARM32_R0 = 0, REGNO_ARM32_SP = 13, REGNO_ARM32_R15 = 15, REGNO_ARM32_SPSR = 16, - REGNO_ARM32_D0 = 0, - REGNO_ARM32_D31 = 31, + REGNO_ARM32_D0 = 17, + REGNO_ARM32_D15 = 32, + REGNO_ARM32_D31 = 48, }; class Registers_arm32 { public: enum { LAST_REGISTER = REGNO_ARM32_D31, -LAST_RESTORE_REG = REGNO_ARM32_SPSR, +LAST_RESTORE_REG = REGNO_ARM32_D31, RETURN_OFFSET = 0, }; @@ -263,15 +266,19 @@ public: static int dwarf2regno(int num) { if (num = DWARF_ARM32_R0 num = DWARF_ARM32_R15) return REGNO_ARM32_R0 + (num - DWARF_ARM32_R0); -if (num = DWARF_ARM32_D0 num = DWARF_ARM32_D31) - return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0); if (num == DWARF_ARM32_SPSR) return REGNO_ARM32_SPSR; +if (num = DWARF_ARM32_D0 num = DWARF_ARM32_D31) + return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0); +if (num = DWARF_ARM32_OLD_S0 num = DWARF_ARM32_OLD_S31) { + assert(num % 2 == 0); + return REGNO_ARM32_D0 + (num - DWARF_ARM32_OLD_S0) / 2; +} return LAST_REGISTER + 1; } bool validRegister(int num) const { -return num = 0 num = LAST_RESTORE_REG; +return num = 0 num = REGNO_ARM32_SPSR; } uint64_t getRegister(int num) const { @@ -297,14 +304,28 @@ public: } void copyFloatVectorRegister(int num, uint64_t addr_) { +if (num = REGNO_ARM32_D15) { + if ((flags 1) == 0) { +lazyVFP1(); +flags |= 1; + } +} else { + if ((flags 2) == 0) { +lazyVFP3(); +flags |= 2; + } +} const void *addr = reinterpret_castconst void *(addr_); memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); } + __dso_hidden void lazyVFP1(); + __dso_hidden void lazyVFP3(); __dso_hidden void jumpto() const __dead; private: uint32_t reg[REGNO_ARM32_SPSR + 1]; + uint32_t flags; uint64_t fpreg[32]; }; @@ -930,7 +951,7 @@ typedef Registers_x86 NativeUnwindRegist typedef Registers_x86_64 NativeUnwindRegisters; #elif __powerpc__ typedef Registers_ppc32 NativeUnwindRegisters; -#elif __arm__ !defined(__ARM_EABI__) +#elif __arm__ typedef Registers_arm32 NativeUnwindRegisters; #elif __vax__ typedef Registers_vax NativeUnwindRegisters; Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.12 src/sys/lib/libunwind/unwind_registers.S:1.13 --- src/sys/lib/libunwind/unwind_registers.S:1.12 Sat Apr 26 20:15:48 2014 +++ src/sys/lib/libunwind/unwind_registers.S Sun May 11 02:07:35 2014 @@ -269,20 +269,44 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jump bctr #endif -#if defined(__arm__) !defined(__ARM_EABI__) +#if defined(__arm__) + .fpu vfpv3 .hidden _ZN7_Unwind15Registers_arm32C1Ev ENTRY(_ZN7_Unwind15Registers_arm32C1Ev) stmia r0, {r0-r14} - str lr, [r0, #60] /* PC */ mrs r1, cpsr str r1, [r0, #64] /* CPSR */ - + mov r1, #0 + str r1, [r0, #68] RET END(_ZN7_Unwind15Registers_arm32C1Ev) + .hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev +ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) + add r0, #72 + vstmia r0, {d0-d15} +END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev) + + .hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev +ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) + add r0, #200 + vstmia r0, {d16-d31} +END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev) + .hidden _ZNK7_Unwind15Registers_arm326jumptoEv ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) + ldrb r1, [r0, #68] + tst r1, #1 + beq .Lnovfp1 + add r2, r0, #72 + vldmia r2, {d0-d15} +.Lnovfp1: + tst r1, #2 + beq .Lnovfp3 + add r2, r0, #200 + vldmia r2, {d16-d31} +.Lnovfp3: ldr r1, [r0, #64] msr cpsr_sxc, r1 ldmia r0, {r0-r15}
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sat May 3 23:19:56 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfParser.hpp Log Message: Missing register validation check. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/DwarfParser.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfParser.hpp diff -u src/sys/lib/libunwind/DwarfParser.hpp:1.4 src/sys/lib/libunwind/DwarfParser.hpp:1.5 --- src/sys/lib/libunwind/DwarfParser.hpp:1.4 Sat Apr 26 23:17:38 2014 +++ src/sys/lib/libunwind/DwarfParser.hpp Sat May 3 23:19:56 2014 @@ -461,6 +461,8 @@ CFI_ParserA, R::parseInstructions(A a reg = R::dwarf2regno(addressSpace.getULEB128(p, instructionsEnd)); offset = addressSpace.getULEB128(p, instructionsEnd) * cieInfo.dataAlignFactor; + if (reg kMaxRegisterNumber) +return false; results-savedRegisters[reg].location = kRegisterOffsetFromCFA; results-savedRegisters[reg].value = offset; break;
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Mon Apr 28 13:39:23 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp UnwindCursor.hpp Log Message: GC unwind_info_size. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/AddressSpace.hpp cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/UnwindCursor.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.4 src/sys/lib/libunwind/AddressSpace.hpp:1.5 --- src/sys/lib/libunwind/AddressSpace.hpp:1.4 Wed Apr 2 22:22:37 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Mon Apr 28 13:39:23 2014 @@ -41,7 +41,6 @@ struct unw_proc_info_t { uintptr_t lsda;// Address of Language Specific Data Area uintptr_t handler; // Personality routine uintptr_t extra_args; // Extra stack space for frameless routines - uint32_t unwind_info_size; // Size of DWARF unwind info uintptr_t unwind_info; // Address of DWARF unwind info }; Index: src/sys/lib/libunwind/UnwindCursor.hpp diff -u src/sys/lib/libunwind/UnwindCursor.hpp:1.2 src/sys/lib/libunwind/UnwindCursor.hpp:1.3 --- src/sys/lib/libunwind/UnwindCursor.hpp:1.2 Thu Mar 20 01:35:45 2014 +++ src/sys/lib/libunwind/UnwindCursor.hpp Mon Apr 28 13:39:23 2014 @@ -135,7 +135,6 @@ void UnwindCursorA, R::setInfoBasedOnI fInfo.handler = cieInfo.personality; fInfo.extra_args = prolog.spExtraArgSize; fInfo.unwind_info = fdeInfo.fdeStart; - fInfo.unwind_info_size = fdeInfo.fdeLength; } }; // namespace _Unwind
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sat Apr 26 23:17:38 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfInstructions.hpp DwarfParser.hpp Registers.hpp Log Message: Use the return address register from the CIE. Based on patch from Nick Kledzik. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/DwarfInstructions.hpp cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/DwarfParser.hpp cvs rdiff -u -r1.14 -r1.15 src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfInstructions.hpp diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.4 src/sys/lib/libunwind/DwarfInstructions.hpp:1.5 --- src/sys/lib/libunwind/DwarfInstructions.hpp:1.4 Mon Apr 14 18:15:17 2014 +++ src/sys/lib/libunwind/DwarfInstructions.hpp Sat Apr 26 23:17:38 2014 @@ -48,9 +48,6 @@ private: const typename CFI_ParserA, R::RegisterLocation ); static int lastRestoreReg(const R ) { return R::LAST_RESTORE_REG; } - static bool isReturnAddressRegister(int regno, const R ) { -return regno == R::RETURN_REG; - } static pint_t getCFA(A addressSpace, const typename CFI_ParserA, R::PrologInfo prolog, @@ -139,7 +136,7 @@ step_result DwarfInstructionsA, R::ste for (int i = 0; i = lastRestoreReg(newRegisters); ++i) { if (prolog.savedRegisters[i].location == CFI_ParserA, R::kRegisterUnused) continue; -if (isReturnAddressRegister(i, registers)) +if (i == (int)cieInfo.returnAddressRegister) returnAddress = getSavedRegister(addressSpace, registers, cfa, prolog.savedRegisters[i]); else if (registers.validRegister(i)) Index: src/sys/lib/libunwind/DwarfParser.hpp diff -u src/sys/lib/libunwind/DwarfParser.hpp:1.3 src/sys/lib/libunwind/DwarfParser.hpp:1.4 --- src/sys/lib/libunwind/DwarfParser.hpp:1.3 Tue Apr 15 11:44:26 2014 +++ src/sys/lib/libunwind/DwarfParser.hpp Sat Apr 26 23:17:38 2014 @@ -43,6 +43,7 @@ public: uint8_t personalityOffsetInCIE; bool isSignalFrame; bool fdesHaveAugmentationData; +uint8_t returnAddressRegister; }; /// Information about an FDE (Frame Description Entry) @@ -238,7 +239,7 @@ bool CFI_ParserA, R::parseCIE(A addre // Parse data alignment factor cieInfo-dataAlignFactor = addressSpace.getSLEB128(p, cieContentEnd); // Parse return address register - addressSpace.getULEB128(p, cieContentEnd); + cieInfo-returnAddressRegister = (uint8_t)addressSpace.getULEB128(p, cieContentEnd); // Parse augmentation data based on augmentation string. if (addressSpace.get8(strStart) == 'z') { // parse augmentation data length Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.14 src/sys/lib/libunwind/Registers.hpp:1.15 --- src/sys/lib/libunwind/Registers.hpp:1.14 Sat Apr 26 20:15:48 2014 +++ src/sys/lib/libunwind/Registers.hpp Sat Apr 26 23:17:38 2014 @@ -34,7 +34,6 @@ public: enum { LAST_REGISTER = REGNO_X86_EIP, LAST_RESTORE_REG = REGNO_X86_EIP, -RETURN_REG = REGNO_X86_EIP, RETURN_OFFSET = 0, }; @@ -100,7 +99,6 @@ public: enum { LAST_REGISTER = REGNO_X86_64_RIP, LAST_RESTORE_REG = REGNO_X86_64_RIP, -RETURN_REG = REGNO_X86_64_RIP, RETURN_OFFSET = 0, }; @@ -169,7 +167,6 @@ public: enum { LAST_REGISTER = REGNO_PPC32_V31, LAST_RESTORE_REG = REGNO_PPC32_V31, -RETURN_REG = REGNO_PPC32_LR, RETURN_OFFSET = 0, }; @@ -258,7 +255,6 @@ public: enum { LAST_REGISTER = REGNO_ARM32_D31, LAST_RESTORE_REG = REGNO_ARM32_SPSR, -RETURN_REG = REGNO_ARM32_SPSR, RETURN_OFFSET = 0, }; @@ -328,7 +324,6 @@ public: enum { LAST_REGISTER = REGNO_VAX_PSW, LAST_RESTORE_REG = REGNO_VAX_PSW, -RETURN_REG = REGNO_VAX_R15, RETURN_OFFSET = 0, }; @@ -400,7 +395,6 @@ public: enum { LAST_REGISTER = REGNO_M68K_FP7, LAST_RESTORE_REG = REGNO_M68K_FP7, -RETURN_REG = REGNO_M68K_PC, RETURN_OFFSET = 0, }; @@ -477,7 +471,6 @@ public: enum { LAST_REGISTER = REGNO_SH3_PR, LAST_RESTORE_REG = REGNO_SH3_PR, -RETURN_REG = REGNO_SH3_PR, RETURN_OFFSET = 0, }; @@ -542,7 +535,6 @@ public: enum { LAST_REGISTER = REGNO_SPARC64_PC, LAST_RESTORE_REG = REGNO_SPARC64_PC, -RETURN_REG = REGNO_SPARC64_R15, RETURN_OFFSET = 8, }; typedef uint64_t reg_t; @@ -606,7 +598,6 @@ public: enum { LAST_REGISTER = REGNO_SPARC_PC, LAST_RESTORE_REG = REGNO_SPARC_PC, -RETURN_REG = REGNO_SPARC_R15, RETURN_OFFSET = 8, }; typedef uint32_t reg_t; @@ -672,7 +663,6 @@ public: enum { LAST_REGISTER = REGNO_ALPHA_F30, LAST_RESTORE_REG = REGNO_ALPHA_F30, -RETURN_REG = REGNO_ALPHA_R26, RETURN_OFFSET = 0, }; typedef uint32_t reg_t; @@
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sun Apr 13 19:04:02 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp libunwind.cxx Log Message: Move definition of what the native register layout is into Registers.hpp. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libunwind/libunwind.cxx Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.8 src/sys/lib/libunwind/Registers.hpp:1.9 --- src/sys/lib/libunwind/Registers.hpp:1.8 Wed Apr 2 22:34:29 2014 +++ src/sys/lib/libunwind/Registers.hpp Sun Apr 13 19:04:01 2014 @@ -518,6 +518,21 @@ private: uint32_t reg[REGNO_SH3_PR + 1]; }; +#if __i386__ +typedef Registers_x86 NativeUnwindRegisters; +#elif __x86_64__ +typedef Registers_x86_64 NativeUnwindRegisters; +#elif __powerpc__ +typedef Registers_ppc32 NativeUnwindRegisters; +#elif __arm__ !defined(__ARM_EABI__) +typedef Registers_arm32 NativeUnwindRegisters; +#elif __vax__ +typedef Registers_vax NativeUnwindRegisters; +#elif __m68k__ +typedef Registers_M68K NativeUnwindRegisters; +#elif __sh3__ +typedef Registers_SH3 NativeUnwindRegisters; +#endif } // namespace _Unwind #endif // __REGISTERS_HPP__ Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.7 src/sys/lib/libunwind/libunwind.cxx:1.8 --- src/sys/lib/libunwind/libunwind.cxx:1.7 Wed Apr 2 22:34:29 2014 +++ src/sys/lib/libunwind/libunwind.cxx Sun Apr 13 19:04:01 2014 @@ -17,30 +17,12 @@ using namespace _Unwind; -#if __i386__ -typedef Registers_x86 ThisUnwindRegisters; -#elif __x86_64__ -typedef Registers_x86_64 ThisUnwindRegisters; -#elif __powerpc__ -typedef Registers_ppc32 ThisUnwindRegisters; -#elif __arm__ !defined(__ARM_EABI__) -typedef Registers_arm32 ThisUnwindRegisters; -#elif __vax__ -typedef Registers_vax ThisUnwindRegisters; -#elif __m68k__ -typedef Registers_M68K ThisUnwindRegisters; -#elif __sh3__ -typedef Registers_SH3 ThisUnwindRegisters; -#else -#error Unsupported architecture -#endif - -typedef CFI_ParserLocalAddressSpace, ThisUnwindRegisters MyCFIParser; +typedef CFI_ParserLocalAddressSpace, NativeUnwindRegisters MyCFIParser; // Internal object representing the address space of this process. static LocalAddressSpace sThisAddressSpace(MyCFIParser::findPCRange); -typedef UnwindCursorLocalAddressSpace, ThisUnwindRegisters ThisUnwindCursor; +typedef UnwindCursorLocalAddressSpace, NativeUnwindRegisters ThisUnwindCursor; static _Unwind_Reason_Code unwind_phase1(ThisUnwindCursor cursor, struct _Unwind_Exception *exc) { @@ -205,7 +187,7 @@ static _Unwind_Reason_Code unwind_phase2 } _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *exc) { - ThisUnwindRegisters registers; + NativeUnwindRegisters registers; ThisUnwindCursor cursor1(registers, sThisAddressSpace); ThisUnwindCursor cursor2(registers, sThisAddressSpace); @@ -224,7 +206,7 @@ _Unwind_Reason_Code _Unwind_RaiseExcepti _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop, void *stop_arg) { - ThisUnwindRegisters registers; + NativeUnwindRegisters registers; ThisUnwindCursor cursor(registers, sThisAddressSpace); // Mark this as forced unwind for _Unwind_Resume(). @@ -235,7 +217,7 @@ _Unwind_Reason_Code _Unwind_ForcedUnwind } void _Unwind_Resume(struct _Unwind_Exception *exc) { - ThisUnwindRegisters registers; + NativeUnwindRegisters registers; ThisUnwindCursor cursor(registers, sThisAddressSpace); if (exc-private_1 != 0) @@ -310,7 +292,7 @@ uintptr_t _Unwind_GetLanguageSpecificDat } _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) { - ThisUnwindRegisters registers; + NativeUnwindRegisters registers; ThisUnwindCursor cursor(registers, sThisAddressSpace); cursor.setInfoBasedOnIPRegister(); @@ -336,7 +318,7 @@ uintptr_t _Unwind_GetCFA(struct _Unwind_ } void *_Unwind_FindEnclosingFunction(void *pc) { - ThisUnwindRegisters registers; + NativeUnwindRegisters registers; ThisUnwindCursor cursor(registers, sThisAddressSpace); unw_proc_info_t info;
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Apr 2 22:22:37 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: SH3 uses unaligned data in the .eh_frame section, so use memcpy. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.3 src/sys/lib/libunwind/AddressSpace.hpp:1.4 --- src/sys/lib/libunwind/AddressSpace.hpp:1.3 Wed Mar 12 22:50:59 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Wed Apr 2 22:22:37 2014 @@ -69,13 +69,29 @@ public: pthread_rwlock_init(fdeTreeLock, NULL); } - uint8_t get8(pint_t addr) { return *((uint8_t *)addr); } + uint8_t get8(pint_t addr) { +uint8_t val; +memcpy(val, (void *)addr, sizeof(val)); +return val; + } - uint16_t get16(pint_t addr) { return *((uint16_t *)addr); } + uint16_t get16(pint_t addr) { +uint16_t val; +memcpy(val, (void *)addr, sizeof(val)); +return val; + } - uint32_t get32(pint_t addr) { return *((uint32_t *)addr); } + uint32_t get32(pint_t addr) { +uint32_t val; +memcpy(val, (void *)addr, sizeof(val)); +return val; + } - uint64_t get64(pint_t addr) { return *((uint64_t *)addr); } + uint64_t get64(pint_t addr) { +uint64_t val; +memcpy(val, (void *)addr, sizeof(val)); +return val; + } uintptr_t getP(pint_t addr) { if (sizeof(uintptr_t) == sizeof(uint32_t))
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Mar 25 00:00:55 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: Save restore FP registers. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libunwind/Registers.hpp \ src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.6 src/sys/lib/libunwind/Registers.hpp:1.7 --- src/sys/lib/libunwind/Registers.hpp:1.6 Mon Mar 24 21:25:03 2014 +++ src/sys/lib/libunwind/Registers.hpp Tue Mar 25 00:00:55 2014 @@ -377,6 +377,8 @@ enum { 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 @@ enum { 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 @@ public: 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 @@ public: 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_castconst 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 Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.6 src/sys/lib/libunwind/unwind_registers.S:1.7 --- src/sys/lib/libunwind/unwind_registers.S:1.6 Mon Mar 24 21:25:03 2014 +++ src/sys/lib/libunwind/unwind_registers.S Tue Mar 25 00:00:55 2014 @@ -346,6 +346,7 @@ END(_ZNK7_Unwind13Registers_vax6jumptoEv 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 @@ ENTRY(_ZNK7_Unwind14Registers_M68K6jumpt 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)
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Mar 19 16:46:23 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: Allow building with GCC 4.1 by providing cstdint To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.4 src/sys/lib/libunwind/Makefile.inc:1.5 --- src/sys/lib/libunwind/Makefile.inc:1.4 Thu Mar 13 01:50:50 2014 +++ src/sys/lib/libunwind/Makefile.inc Wed Mar 19 16:46:23 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.4 2014/03/13 01:50:50 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.5 2014/03/19 16:46:23 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -7,5 +7,15 @@ SRCS+= libunwind.cxx \ INCS+= unwind.h +.if ${HAVE_GCC:U48} == 4 +CLEANFILES+= cstdint +DPSRCS+= cstdint + +cstdint: + echo '#include stdint.h' ${.TARGET} + +COPTS.libunwind.cxx+= -D__builtin_unreachable()=abort() +.else COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == gcc:? -std=c++0x : -std=c++11 } +.endif COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Mar 19 21:15:45 UTC 2014 Modified Files: src/sys/lib/libunwind: unwind_registers.S Log Message: Drop XXX, spell R14 as SP. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.4 src/sys/lib/libunwind/unwind_registers.S:1.5 --- src/sys/lib/libunwind/unwind_registers.S:1.4 Tue Mar 18 13:08:15 2014 +++ src/sys/lib/libunwind/unwind_registers.S Wed Mar 19 21:15:45 2014 @@ -307,8 +307,7 @@ ENTRY(_ZN7_Unwind13Registers_vaxC1Ev, R0 movl %r11, 44(%r0) movl 8(%fp), 48(%r0) movl 12(%fp), 52(%r0) - /* XXX correct argument handling */ - addl3 $36, %r14, 56(%r0) + addl3 $36, %sp, 56(%r0) /* Return PC */ movl 16(%fp), 60(%r0) /* Load saved value of r0 as r1 */
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Mar 20 01:35:45 UTC 2014 Modified Files: src/sys/lib/libunwind: UnwindCursor.hpp libunwind.cxx Log Message: Fix DW_CFA_GNU_args_size handling. The primary architecture using this opcode is VAX. A function call pushes the number of arguments given onto the stack and ret will pop it automatically. The FDE of the caller contains the amount of stack space used for arguments (and possibly extra padding), so unwinding has to compensate for this when returning from a function. This is exactly the case when step() is done. The existing handling in _Unwind_SetIP no longer makes sense. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/UnwindCursor.hpp cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/libunwind.cxx Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/UnwindCursor.hpp diff -u src/sys/lib/libunwind/UnwindCursor.hpp:1.1 src/sys/lib/libunwind/UnwindCursor.hpp:1.2 --- src/sys/lib/libunwind/UnwindCursor.hpp:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/UnwindCursor.hpp Thu Mar 20 01:35:45 2014 @@ -61,6 +61,9 @@ public: this-setInfoBasedOnIPRegister(true); if (fUnwindInfoMissing) return UNW_STEP_END; + + if (fInfo.extra_args) +setSP(getSP() + fInfo.extra_args); return UNW_STEP_SUCCESS; } __builtin_unreachable(); Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.4 src/sys/lib/libunwind/libunwind.cxx:1.5 --- src/sys/lib/libunwind/libunwind.cxx:1.4 Tue Mar 18 13:08:15 2014 +++ src/sys/lib/libunwind/libunwind.cxx Thu Mar 20 01:35:45 2014 @@ -288,12 +288,7 @@ void _Unwind_SetIP(struct _Unwind_Contex cursor-setIP(new_value); unw_proc_info_t info; cursor-getInfo(info); - uint64_t orgArgSize = info.extra_args; - uint64_t orgFuncStart = info.start_ip; cursor-setInfoBasedOnIPRegister(false); - // Adjust REG_SP if there was a DW_CFA_GNU_args_size. - if (orgFuncStart == info.start_ip orgArgSize != 0) -cursor-setSP(cursor-getSP() + orgArgSize); } uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context) {
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Mar 18 13:08:15 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp libunwind.cxx unwind_registers.S Log Message: Add basic unwind support for VAX. PSW handling and stack pointer after resume is still incomplete. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/libunwind.cxx \ src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.4 src/sys/lib/libunwind/Registers.hpp:1.5 --- src/sys/lib/libunwind/Registers.hpp:1.4 Wed Mar 12 00:01:12 2014 +++ src/sys/lib/libunwind/Registers.hpp Tue Mar 18 13:08:15 2014 @@ -308,6 +308,70 @@ private: 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__ Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.3 src/sys/lib/libunwind/libunwind.cxx:1.4 --- src/sys/lib/libunwind/libunwind.cxx:1.3 Thu Mar 13 00:28:20 2014 +++ src/sys/lib/libunwind/libunwind.cxx Tue Mar 18 13:08:15 2014 @@ -25,6 +25,8 @@ typedef Registers_x86_64 ThisUnwindRegis typedef Registers_ppc32 ThisUnwindRegisters; #elif __arm__ !defined(__ARM_EABI__) typedef Registers_arm32 ThisUnwindRegisters; +#elif __vax__ +typedef Registers_vax ThisUnwindRegisters; #else #error Unsupported architecture #endif Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.3 src/sys/lib/libunwind/unwind_registers.S:1.4 --- src/sys/lib/libunwind/unwind_registers.S:1.3 Wed Mar 12 00:01:12 2014 +++ src/sys/lib/libunwind/unwind_registers.S Tue Mar 18 13:08:15 2014 @@ -288,3 +288,58 @@ ENTRY(_ZNK7_Unwind15Registers_arm326jump 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
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Mar 12 15:31:55 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Add more const to make GCC happy. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.1 src/sys/lib/libunwind/AddressSpace.hpp:1.2 --- src/sys/lib/libunwind/AddressSpace.hpp:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/AddressSpace.hpp Wed Mar 12 15:31:55 2014 @@ -424,8 +424,8 @@ static int phdr_callback(struct dl_phdr_ } static int rangeCmp(void *context, const void *n1_, const void *n2_) { - LocalAddressSpace::Range *n1 = (LocalAddressSpace::Range *)n1_; - LocalAddressSpace::Range *n2 = (LocalAddressSpace::Range *)n2_; + const LocalAddressSpace::Range *n1 = (const LocalAddressSpace::Range *)n1_; + const LocalAddressSpace::Range *n2 = (const LocalAddressSpace::Range *)n2_; if (n1-first_pc n2-first_pc) return -1; @@ -436,8 +436,8 @@ static int rangeCmp(void *context, const } static int rangeCmpKey(void *context, const void *n_, const void *pc_) { - LocalAddressSpace::Range *n = (LocalAddressSpace::Range *)n_; - LocalAddressSpace::pint_t *pc = (LocalAddressSpace::pint_t *)pc_; + const LocalAddressSpace::Range *n = (const LocalAddressSpace::Range *)n_; + const LocalAddressSpace::pint_t *pc = (const LocalAddressSpace::pint_t *)pc_; if (n-last_pc *pc) return -1; if (n-first_pc *pc) @@ -446,8 +446,8 @@ static int rangeCmpKey(void *context, co } static int dsoTableCmp(void *context, const void *n1_, const void *n2_) { - LocalAddressSpace::Range *n1 = (LocalAddressSpace::Range *)n1_; - LocalAddressSpace::Range *n2 = (LocalAddressSpace::Range *)n2_; + const LocalAddressSpace::Range *n1 = (const LocalAddressSpace::Range *)n1_; + const LocalAddressSpace::Range *n2 = (const LocalAddressSpace::Range *)n2_; if (n1-ehframe_base n2-ehframe_base) return -1; @@ -457,8 +457,8 @@ static int dsoTableCmp(void *context, co } static int dsoTableCmpKey(void *context, const void *n_, const void *ptr_) { - LocalAddressSpace::Range *n = (LocalAddressSpace::Range *)n_; - LocalAddressSpace::pint_t *ptr = (LocalAddressSpace::pint_t *)ptr_; + const LocalAddressSpace::Range *n = (const LocalAddressSpace::Range *)n_; + const LocalAddressSpace::pint_t *ptr = (const LocalAddressSpace::pint_t *)ptr_; if (n-ehframe_base *ptr) return -1; if (n-ehframe_base *ptr)
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Mar 12 22:50:59 UTC 2014 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Pass down data_base just in case something actually tries to use it. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.2 src/sys/lib/libunwind/AddressSpace.hpp:1.3 --- src/sys/lib/libunwind/AddressSpace.hpp:1.2 Wed Mar 12 15:31:55 2014 +++ src/sys/lib/libunwind/AddressSpace.hpp Wed Mar 12 22:50:59 2014 @@ -242,6 +242,7 @@ public: return false; if (n-hdr_start == 0) { fdeStart = n-hdr_base; + data_base = n-data_base; return true; } @@ -264,6 +265,7 @@ public: len = (len + 1) / 2; } fdeStart = base + (int32_t)get32(first + 4); +data_base = n-data_base; return true; }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Mar 13 00:28:20 UTC 2014 Modified Files: src/sys/lib/libunwind: libunwind.cxx unwind.h Log Message: Add _Unwind_GetIPInfo for libstdc++. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/libunwind.cxx cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/unwind.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.2 src/sys/lib/libunwind/libunwind.cxx:1.3 --- src/sys/lib/libunwind/libunwind.cxx:1.2 Wed Jan 29 06:59:53 2014 +++ src/sys/lib/libunwind/libunwind.cxx Thu Mar 13 00:28:20 2014 @@ -275,6 +275,12 @@ uintptr_t _Unwind_GetIP(struct _Unwind_C return cursor-getIP(); } +uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context, int *isSignalFrame) { + ThisUnwindCursor *cursor = (ThisUnwindCursor *)context; + *isSignalFrame = cursor-isSignalFrame() ? 1 : 0; + return cursor-getIP(); +} + void _Unwind_SetIP(struct _Unwind_Context *context, uintptr_t new_value) { ThisUnwindCursor *cursor = (ThisUnwindCursor *)context; cursor-setIP(new_value); Index: src/sys/lib/libunwind/unwind.h diff -u src/sys/lib/libunwind/unwind.h:1.1 src/sys/lib/libunwind/unwind.h:1.2 --- src/sys/lib/libunwind/unwind.h:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/unwind.h Thu Mar 13 00:28:20 2014 @@ -67,6 +67,7 @@ void _Unwind_DeleteException(struct _Unw uintptr_t _Unwind_GetGR(struct _Unwind_Context *, int); void _Unwind_SetGR(struct _Unwind_Context *, int, uintptr_t); uintptr_t _Unwind_GetIP(struct _Unwind_Context *); +uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *, int *); uintptr_t _Unwind_GetCFA(struct _Unwind_Context *); void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t); uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *);
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Mar 13 00:56:41 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: libstdc++ doesn't like me using cstdint without requesting C++11, so just do so. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.2 src/sys/lib/libunwind/Makefile.inc:1.3 --- src/sys/lib/libunwind/Makefile.inc:1.2 Fri Dec 20 12:46:42 2013 +++ src/sys/lib/libunwind/Makefile.inc Thu Mar 13 00:56:41 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.2 2013/12/20 12:46:42 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.3 2014/03/13 00:56:41 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -7,4 +7,5 @@ SRCS+= libunwind.cxx \ INCS+= unwind.h +COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == gcc:? -std=c++0x : -std=c++11 :} COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Thu Mar 13 01:50:50 UTC 2014 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: Kill one colon that shouldn't be. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.3 src/sys/lib/libunwind/Makefile.inc:1.4 --- src/sys/lib/libunwind/Makefile.inc:1.3 Thu Mar 13 00:56:41 2014 +++ src/sys/lib/libunwind/Makefile.inc Thu Mar 13 01:50:50 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.3 2014/03/13 00:56:41 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.4 2014/03/13 01:50:50 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -7,5 +7,5 @@ SRCS+= libunwind.cxx \ INCS+= unwind.h -COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == gcc:? -std=c++0x : -std=c++11 :} +COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == gcc:? -std=c++0x : -std=c++11 } COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Wed Mar 12 00:01:12 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp unwind_registers.S Log Message: Add a dummy element as explicit padding for PPC32. Fix DWARF enumeration to match the values created by GCC. Fix DWARFish - index conversion. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libunwind/Registers.hpp cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.3 src/sys/lib/libunwind/Registers.hpp:1.4 --- src/sys/lib/libunwind/Registers.hpp:1.3 Tue Mar 11 23:57:42 2014 +++ src/sys/lib/libunwind/Registers.hpp Wed Mar 12 00:01:12 2014 @@ -144,19 +144,18 @@ enum { DWARF_PPC32_R31 = 31, DWARF_PPC32_F0 = 32, DWARF_PPC32_F31 = 63, - DWARF_PPC32_V0 = 1124, - DWARF_PPC32_V31 = 1155, DWARF_PPC32_LR = 65, - DWARF_PPC32_CTR = 66, - DWARF_PPC32_XER = 76, + DWARF_PPC32_CR = 70, + DWARF_PPC32_V0 = 77, + DWARF_PPC32_V31 = 108, + REGNO_PPC32_R0 = 0, - REGNO_PPC32_R1 = 0, + REGNO_PPC32_R1 = 1, REGNO_PPC32_R31 = 31, - REGNO_PPC32_CR = 32, - REGNO_PPC32_LR = 33, - REGNO_PPC32_CTR = 34, - REGNO_PPC32_XER = 35, - REGNO_PPC32_SRR0 = 36, + REGNO_PPC32_LR = 32, + REGNO_PPC32_CR = 33, + REGNO_PPC32_SRR0 = 34, + REGNO_PPC32_F0 = REGNO_PPC32_SRR0 + 1, REGNO_PPC32_F31 = REGNO_PPC32_F0 + 31, REGNO_PPC32_V0 = REGNO_PPC32_F31 + 1, @@ -180,7 +179,14 @@ public: return REGNO_PPC32_F0 + (num - DWARF_PPC32_F0); if (num = DWARF_PPC32_V0 num = DWARF_PPC32_V31) return REGNO_PPC32_V0 + (num - DWARF_PPC32_V0); -return LAST_REGISTER + 1; +switch (num) { +case DWARF_PPC32_LR: + return REGNO_PPC32_LR; +case DWARF_PPC32_CR: + return REGNO_PPC32_CR; +default: + return LAST_REGISTER + 1; +} } bool validRegister(int num) const { @@ -225,6 +231,7 @@ private: uint64_t low, high; }; uint32_t reg[REGNO_PPC32_SRR0 + 1]; + uint32_t dummy; uint64_t fpreg[32]; vecreg_t vecreg[64]; }; Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.2 src/sys/lib/libunwind/unwind_registers.S:1.3 --- src/sys/lib/libunwind/unwind_registers.S:1.2 Wed Jan 29 06:59:53 2014 +++ src/sys/lib/libunwind/unwind_registers.S Wed Mar 12 00:01:12 2014 @@ -116,6 +116,7 @@ ENTRY(_ZNK7_Unwind16Registers_x86_646jum #ifdef __powerpc__ .hidden _ZN7_Unwind15Registers_ppc32C1Ev ENTRY(_ZN7_Unwind15Registers_ppc32C1Ev) + /* TODO: skip non-callee-safe registers */ stw %r0, 0(%r3) stw %r1, 4(%r3) stw %r2, 8(%r3) @@ -148,21 +149,82 @@ ENTRY(_ZN7_Unwind15Registers_ppc32C1Ev) stw %r29,116(%r3) stw %r30,120(%r3) stw %r31,124(%r3) - - mfcr %r0 - stw %r0, 128(%r3) /* CR */ mflr %r0 - stw %r0, 132(%r3) /* LR */ - stw %r0, 144(%r3) /* LR */ - mfctr %r0 - stw %r0, 136(%r3) /* CTR */ - mfxer %r0 - stw %r0, 140(%r3) /* XER */ + stw %r0, 136(%r3) /* SRR0 */ + mfcr %r0 + stw %r0, 132(%r3) /* CR */ + + stfd %f0, 144(%r3) + stfd %f1, 152(%r3) + stfd %f2, 160(%r3) + stfd %f3, 168(%r3) + stfd %f4, 176(%r3) + stfd %f5, 184(%r3) + stfd %f6, 192(%r3) + stfd %f7, 200(%r3) + stfd %f8, 208(%r3) + stfd %f9, 216(%r3) + stfd %f10, 224(%r3) + stfd %f11, 232(%r3) + stfd %f12, 240(%r3) + stfd %f13, 248(%r3) + stfd %f14, 256(%r3) + stfd %f15, 264(%r3) + stfd %f16, 272(%r3) + stfd %f17, 280(%r3) + stfd %f18, 288(%r3) + stfd %f19, 296(%r3) + stfd %f20, 304(%r3) + stfd %f21, 312(%r3) + stfd %f22, 320(%r3) + stfd %f23, 328(%r3) + stfd %f24, 336(%r3) + stfd %f25, 344(%r3) + stfd %f26, 352(%r3) + stfd %f27, 360(%r3) + stfd %f28, 368(%r3) + stfd %f29, 376(%r3) + stfd %f30, 384(%r3) + stfd %f31, 392(%r3) + /* LR is undefined */ blr .hidden _ZNK7_Unwind15Registers_ppc326jumptoEv ENTRY(_ZNK7_Unwind15Registers_ppc326jumptoEv) + lfd %f0, 144(%r3) + lfd %f1, 152(%r3) + lfd %f2, 160(%r3) + lfd %f3, 168(%r3) + lfd %f4, 176(%r3) + lfd %f5, 184(%r3) + lfd %f6, 192(%r3) + lfd %f7, 200(%r3) + lfd %f8, 208(%r3) + lfd %f9, 216(%r3) + lfd %f10, 224(%r3) + lfd %f11, 232(%r3) + lfd %f12, 240(%r3) + lfd %f13, 248(%r3) + lfd %f14, 256(%r3) + lfd %f15, 264(%r3) + lfd %f16, 272(%r3) + lfd %f17, 280(%r3) + lfd %f18, 288(%r3) + lfd %f19, 296(%r3) + lfd %f20, 304(%r3) + lfd %f21, 312(%r3) + lfd %f22, 320(%r3) + lfd %f23, 328(%r3) + lfd %f24, 336(%r3) + lfd %f25, 344(%r3) + lfd %f26, 352(%r3) + lfd %f27, 360(%r3) + lfd %f28, 368(%r3) + lfd %f29, 376(%r3) + lfd %f30, 384(%r3) + lfd %f31, 392(%r3) + lwz %r2, 8(%r3) /* skip r3 for now */ lwz %r4, 16(%r3) @@ -194,20 +256,16 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jump lwz %r30,120(%r3) lwz %r31,124(%r3) - lwz %r0, 128(%r3) /* CR */ - mtcr %r0 - lwz
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Mar 11 23:55:11 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfInstructions.hpp Log Message: GC unused enum. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/DwarfInstructions.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfInstructions.hpp diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.1 src/sys/lib/libunwind/DwarfInstructions.hpp:1.2 --- src/sys/lib/libunwind/DwarfInstructions.hpp:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/DwarfInstructions.hpp Tue Mar 11 23:55:11 2014 @@ -39,12 +39,6 @@ public: static step_result stepWithDwarf(A , pint_t, pint_t, R , unw_proc_info_t *); private: - // Pseudo-register used for return addresses. - enum { -DW_X86_RET_ADDR = 8, -DW_X86_64_RET_ADDR = 16, - }; - static pint_t evaluateExpression(pint_t, A , const R , pint_t); static pint_t getSavedRegister(A , const R , pint_t,
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Mar 11 23:52:17 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfParser.hpp Log Message: 0 is a valid LSDA encoding and can be seen in statically linked programs. Initialize lsdaEncoding to DW_EH_PE_omit and check for that value to decide whether a value should be decoded. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/DwarfParser.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfParser.hpp diff -u src/sys/lib/libunwind/DwarfParser.hpp:1.1 src/sys/lib/libunwind/DwarfParser.hpp:1.2 --- src/sys/lib/libunwind/DwarfParser.hpp:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/DwarfParser.hpp Tue Mar 11 23:52:17 2014 @@ -172,7 +172,7 @@ bool CFI_ParserA, R::decodeFDE(A addr if (cieInfo-fdesHaveAugmentationData) { uintptr_t augLen = addressSpace.getULEB128(p, nextCFI); pint_t endOfAug = p + augLen; -if (cieInfo-lsdaEncoding != 0) { +if (cieInfo-lsdaEncoding != DW_EH_PE_omit) { // Peek at value (without indirection). Zero means no LSDA. pint_t lsdaStart = p; if (addressSpace.getEncodedP(p, nextCFI, cieInfo-lsdaEncoding 0x0F, @@ -198,7 +198,7 @@ template typename A, typename R bool CFI_ParserA, R::parseCIE(A addressSpace, pint_t cie, CIE_Info *cieInfo) { cieInfo-pointerEncoding = 0; - cieInfo-lsdaEncoding = 0; + cieInfo-lsdaEncoding = DW_EH_PE_omit; cieInfo-personalityEncoding = 0; cieInfo-personalityOffsetInCIE = 0; cieInfo-personality = 0;
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Tue Mar 11 23:57:42 UTC 2014 Modified Files: src/sys/lib/libunwind: DwarfInstructions.hpp Registers.hpp Log Message: Rename IP_PSEUDO_REG to RETURN_REG. Fix PPC value. Sort. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libunwind/DwarfInstructions.hpp \ src/sys/lib/libunwind/Registers.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/DwarfInstructions.hpp diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.2 src/sys/lib/libunwind/DwarfInstructions.hpp:1.3 --- src/sys/lib/libunwind/DwarfInstructions.hpp:1.2 Tue Mar 11 23:55:11 2014 +++ src/sys/lib/libunwind/DwarfInstructions.hpp Tue Mar 11 23:57:42 2014 @@ -49,7 +49,7 @@ private: static int lastRestoreReg(const R ) { return R::LAST_RESTORE_REG; } static bool isReturnAddressRegister(int regno, const R ) { -return regno == R::IP_PSEUDO_REG; +return regno == R::RETURN_REG; } static pint_t getCFA(A addressSpace, Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.2 src/sys/lib/libunwind/Registers.hpp:1.3 --- src/sys/lib/libunwind/Registers.hpp:1.2 Wed Jan 29 06:59:53 2014 +++ src/sys/lib/libunwind/Registers.hpp Tue Mar 11 23:57:42 2014 @@ -32,9 +32,9 @@ enum { class Registers_x86 { public: enum { -LAST_RESTORE_REG = REGNO_X86_EIP, -IP_PSEUDO_REG = REGNO_X86_EIP, LAST_REGISTER = REGNO_X86_EIP, +LAST_RESTORE_REG = REGNO_X86_EIP, +RETURN_REG = REGNO_X86_EIP, }; __dso_hidden Registers_x86(); @@ -97,9 +97,9 @@ enum { class Registers_x86_64 { public: enum { -LAST_RESTORE_REG = REGNO_X86_64_RIP, -IP_PSEUDO_REG = REGNO_X86_64_RIP, LAST_REGISTER = REGNO_X86_64_RIP, +LAST_RESTORE_REG = REGNO_X86_64_RIP, +RETURN_REG = REGNO_X86_64_RIP, }; __dso_hidden Registers_x86_64(); @@ -166,9 +166,9 @@ enum { class Registers_ppc32 { public: enum { -LAST_RESTORE_REG = REGNO_PPC32_V31, -IP_PSEUDO_REG = REGNO_PPC32_SRR0, LAST_REGISTER = REGNO_PPC32_V31, +LAST_RESTORE_REG = REGNO_PPC32_V31, +RETURN_REG = REGNO_PPC32_LR, }; __dso_hidden Registers_ppc32(); @@ -246,9 +246,9 @@ enum { class Registers_arm32 { public: enum { -LAST_RESTORE_REG = REGNO_ARM32_SPSR, -IP_PSEUDO_REG = REGNO_ARM32_SPSR, LAST_REGISTER = REGNO_ARM32_D31, +LAST_RESTORE_REG = REGNO_ARM32_SPSR, +RETURN_REG = REGNO_ARM32_SPSR, }; __dso_hidden Registers_arm32();
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: matt Date: Wed Jan 29 06:59:53 UTC 2014 Modified Files: src/sys/lib/libunwind: Registers.hpp libunwind.cxx unwind_registers.S Log Message: Add support for non-EABI (DWARF) ARM exception handling. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/Registers.hpp \ src/sys/lib/libunwind/libunwind.cxx \ src/sys/lib/libunwind/unwind_registers.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Registers.hpp diff -u src/sys/lib/libunwind/Registers.hpp:1.1 src/sys/lib/libunwind/Registers.hpp:1.2 --- src/sys/lib/libunwind/Registers.hpp:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/Registers.hpp Wed Jan 29 06:59:53 2014 @@ -229,6 +229,78 @@ private: vecreg_t vecreg[64]; }; +enum { + DWARF_ARM32_R0 = 0, + DWARF_ARM32_R15 = 15, + DWARF_ARM32_SPSR = 128, + DWARF_ARM32_D0 = 256, // VFP-v3/Neon + DWARF_ARM32_D31 = 287, + REGNO_ARM32_R0 = 0, + REGNO_ARM32_SP = 13, + REGNO_ARM32_R15 = 15, + REGNO_ARM32_SPSR = 16, + REGNO_ARM32_D0 = 0, + REGNO_ARM32_D31 = 31, +}; + +class Registers_arm32 { +public: + enum { +LAST_RESTORE_REG = REGNO_ARM32_SPSR, +IP_PSEUDO_REG = REGNO_ARM32_SPSR, +LAST_REGISTER = REGNO_ARM32_D31, + }; + + __dso_hidden Registers_arm32(); + + static int dwarf2regno(int num) { +if (num = DWARF_ARM32_R0 num = DWARF_ARM32_R15) + return REGNO_ARM32_R0 + (num - DWARF_ARM32_R0); +if (num = DWARF_ARM32_D0 num = DWARF_ARM32_D31) + return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0); +if (num == DWARF_ARM32_SPSR) + return REGNO_ARM32_SPSR; +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_ARM32_R15]; } + + void setIP(uint64_t value) { reg[REGNO_ARM32_R15] = value; } + + uint64_t getSP() const { return reg[REGNO_ARM32_SP]; } + + void setSP(uint64_t value) { reg[REGNO_ARM32_SP] = value; } + + bool validFloatVectorRegister(int num) const { +return (num = REGNO_ARM32_D0 num = REGNO_ARM32_D31); + } + + void copyFloatVectorRegister(int num, uint64_t addr_) { +const void *addr = reinterpret_castconst void *(addr_); +memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0])); + } + + __dso_hidden void jumpto() const __dead; + +private: + uint32_t reg[REGNO_ARM32_SPSR + 1]; + uint64_t fpreg[32]; +}; + } // namespace _Unwind #endif // __REGISTERS_HPP__ Index: src/sys/lib/libunwind/libunwind.cxx diff -u src/sys/lib/libunwind/libunwind.cxx:1.1 src/sys/lib/libunwind/libunwind.cxx:1.2 --- src/sys/lib/libunwind/libunwind.cxx:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/libunwind.cxx Wed Jan 29 06:59:53 2014 @@ -23,6 +23,8 @@ typedef Registers_x86 ThisUnwindRegister typedef Registers_x86_64 ThisUnwindRegisters; #elif __powerpc__ typedef Registers_ppc32 ThisUnwindRegisters; +#elif __arm__ !defined(__ARM_EABI__) +typedef Registers_arm32 ThisUnwindRegisters; #else #error Unsupported architecture #endif Index: src/sys/lib/libunwind/unwind_registers.S diff -u src/sys/lib/libunwind/unwind_registers.S:1.1 src/sys/lib/libunwind/unwind_registers.S:1.2 --- src/sys/lib/libunwind/unwind_registers.S:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/unwind_registers.S Wed Jan 29 06:59:53 2014 @@ -210,3 +210,23 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jump lwz %r3,12(%r3) /* do r3 last */ bctr #endif + +#if defined(__arm__) !defined(__ARM_EABI__) + .hidden _ZN7_Unwind15Registers_arm32C1Ev +ENTRY(_ZN7_Unwind15Registers_arm32C1Ev) + stmia r0, {r0-r14} + + str lr, [r0, #60] /* PC */ + mrs r1, cpsr + str r1, [r0, #64] /* CPSR */ + + RET +END(_ZN7_Unwind15Registers_arm32C1Ev) + + .hidden _ZNK7_Unwind15Registers_arm326jumptoEv +ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv) + ldr r1, [r0, #64] + msr cpsr_sxc, r1 + ldmia r0, {r0-r15} +END(_ZNK7_Unwind15Registers_arm326jumptoEv) +#endif
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Fri Dec 20 12:46:42 UTC 2013 Modified Files: src/sys/lib/libunwind: Makefile.inc Log Message: Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libunwind/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/Makefile.inc diff -u src/sys/lib/libunwind/Makefile.inc:1.1 src/sys/lib/libunwind/Makefile.inc:1.2 --- src/sys/lib/libunwind/Makefile.inc:1.1 Mon Oct 14 01:14:57 2013 +++ src/sys/lib/libunwind/Makefile.inc Fri Dec 20 12:46:42 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.1 2013/10/14 01:14:57 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.2 2013/12/20 12:46:42 joerg Exp $ .PATH: ${NETBSDSRCDIR}/sys/lib/libunwind @@ -7,4 +7,4 @@ SRCS+= libunwind.cxx \ INCS+= unwind.h -COPTS.libuwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast +COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast