summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2014-04-13 19:04:01 +0000
committerjoerg <joerg@NetBSD.org>2014-04-13 19:04:01 +0000
commita6ecde39f558d63aa77db6fe07f29018f9b93abe (patch)
treeb2ade6a74123b272193f0f9bd10ed1302be4cf2e /sys/lib
parent0a2767e4d8f08368a8acd3b0844a03ca1213fe90 (diff)
Move definition of what the native register layout is into
Registers.hpp.
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libunwind/Registers.hpp15
-rw-r--r--sys/lib/libunwind/libunwind.cxx32
2 files changed, 22 insertions, 25 deletions
diff --git a/sys/lib/libunwind/Registers.hpp b/sys/lib/libunwind/Registers.hpp
index eb0a6b6aa9d..597d635580a 100644
--- a/sys/lib/libunwind/Registers.hpp
+++ b/sys/lib/libunwind/Registers.hpp
@@ -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__
diff --git a/sys/lib/libunwind/libunwind.cxx b/sys/lib/libunwind/libunwind.cxx
index 776ac5a677e..8cdb86371b5 100644
--- a/sys/lib/libunwind/libunwind.cxx
+++ b/sys/lib/libunwind/libunwind.cxx
@@ -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_Parser<LocalAddressSpace, ThisUnwindRegisters> MyCFIParser;
+typedef CFI_Parser<LocalAddressSpace, NativeUnwindRegisters> MyCFIParser;
// Internal object representing the address space of this process.
static LocalAddressSpace sThisAddressSpace(MyCFIParser::findPCRange);
-typedef UnwindCursor<LocalAddressSpace, ThisUnwindRegisters> ThisUnwindCursor;
+typedef UnwindCursor<LocalAddressSpace, NativeUnwindRegisters> ThisUnwindCursor;
static _Unwind_Reason_Code unwind_phase1(ThisUnwindCursor &cursor,
struct _Unwind_Exception *exc) {
@@ -205,7 +187,7 @@ static _Unwind_Reason_Code unwind_phase2_forced(ThisUnwindCursor &cursor,
}
_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_RaiseException(struct _Unwind_Exception *exc) {
_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(struct _Unwind_Exception *exc,
}
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_GetLanguageSpecificData(struct _Unwind_Context *context) {
}
_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_Context *context) {
}
void *_Unwind_FindEnclosingFunction(void *pc) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor(registers, sThisAddressSpace);
unw_proc_info_t info;