summaryrefslogtreecommitdiff
path: root/src/pal/src/exception/seh-unwind.cpp
diff options
context:
space:
mode:
authorBen Pye <ben@curlybracket.co.uk>2015-07-01 15:10:09 +0100
committerBen Pye <ben@curlybracket.co.uk>2015-07-24 16:45:35 +0100
commit9cd8273572260317c6acc126333e5a6e56aaeb06 (patch)
treef125e83a6908151322aa20940b63c64c621c1169 /src/pal/src/exception/seh-unwind.cpp
parentacca43b33dcd97d1dc5d92147a3047a3bdfaf1ce (diff)
downloadcoreclr-9cd8273572260317c6acc126333e5a6e56aaeb06.tar.gz
coreclr-9cd8273572260317c6acc126333e5a6e56aaeb06.tar.bz2
coreclr-9cd8273572260317c6acc126333e5a6e56aaeb06.zip
Add ARM target for CoreCLR on Linux.
c_runtime/vprintf/test1 is disabled as casting NULL to va_list is against the C specification. Fix SetFilePointer tests on 32 bit platforms. Define _FILE_OFFSET_BITS=64 so that we have long file support on 32 bit platforms. Implement context capture/restore for ARM. Link libgcc_s before libunwind on ARM so C++ exceptions work. Translate armasm to gas syntax. Specify Thumb, VFPv3, ARMv7 for the ARM target. Add ARM configuration to mscorlib build Implement GetLogicalProcessorCacheSizeFromOS in PAL. Set UNWIND_CONTEXT_IS_UCONTEXT_T from configure check.
Diffstat (limited to 'src/pal/src/exception/seh-unwind.cpp')
-rw-r--r--src/pal/src/exception/seh-unwind.cpp51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 2e77814b9b..9dd025c51d 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -49,10 +49,10 @@ Abstract:
ASSIGN_REG(R12) \
ASSIGN_REG(R13) \
ASSIGN_REG(R14) \
- ASSIGN_REG(R15)
-#else // _AMD64_
+ ASSIGN_REG(R15)
+#else
#error unsupported architecture
-#endif // _AMD64_
+#endif
static void WinContextToUnwindContext(CONTEXT *winContext, unw_context_t *unwContext)
{
@@ -72,8 +72,18 @@ static void WinContextToUnwindCursor(CONTEXT *winContext, unw_cursor_t *cursor)
unw_set_reg(cursor, UNW_X86_64_R13, winContext->R13);
unw_set_reg(cursor, UNW_X86_64_R14, winContext->R14);
unw_set_reg(cursor, UNW_X86_64_R15, winContext->R15);
-#else
-#error unsupported architecture
+#elif defined(_ARM_)
+ unw_set_reg(cursor, UNW_REG_IP, winContext->Pc);
+ unw_set_reg(cursor, UNW_REG_SP, winContext->Sp);
+ unw_set_reg(cursor, UNW_ARM_R14, winContext->Lr);
+ unw_set_reg(cursor, UNW_ARM_R4, winContext->R4);
+ unw_set_reg(cursor, UNW_ARM_R5, winContext->R5);
+ unw_set_reg(cursor, UNW_ARM_R6, winContext->R6);
+ unw_set_reg(cursor, UNW_ARM_R7, winContext->R7);
+ unw_set_reg(cursor, UNW_ARM_R8, winContext->R8);
+ unw_set_reg(cursor, UNW_ARM_R9, winContext->R9);
+ unw_set_reg(cursor, UNW_ARM_R10, winContext->R10);
+ unw_set_reg(cursor, UNW_ARM_R11, winContext->R11);
#endif
}
#endif
@@ -89,12 +99,24 @@ static void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext)
unw_get_reg(cursor, UNW_X86_64_R13, (unw_word_t *) &winContext->R13);
unw_get_reg(cursor, UNW_X86_64_R14, (unw_word_t *) &winContext->R14);
unw_get_reg(cursor, UNW_X86_64_R15, (unw_word_t *) &winContext->R15);
+#elif defined(_ARM_)
+ unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->Pc);
+ unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->Sp);
+ unw_get_reg(cursor, UNW_ARM_R14, (unw_word_t *) &winContext->Lr);
+ unw_get_reg(cursor, UNW_ARM_R4, (unw_word_t *) &winContext->R4);
+ unw_get_reg(cursor, UNW_ARM_R5, (unw_word_t *) &winContext->R5);
+ unw_get_reg(cursor, UNW_ARM_R6, (unw_word_t *) &winContext->R6);
+ unw_get_reg(cursor, UNW_ARM_R7, (unw_word_t *) &winContext->R7);
+ unw_get_reg(cursor, UNW_ARM_R8, (unw_word_t *) &winContext->R8);
+ unw_get_reg(cursor, UNW_ARM_R9, (unw_word_t *) &winContext->R9);
+ unw_get_reg(cursor, UNW_ARM_R10, (unw_word_t *) &winContext->R10);
+ unw_get_reg(cursor, UNW_ARM_R11, (unw_word_t *) &winContext->R11);
#else
#error unsupported architecture
#endif
}
-static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, int reg, PDWORD64 *contextPointer)
+static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, int reg, SIZE_T **contextPointer)
{
#if defined(__APPLE__)
// Returning NULL indicates that we don't have context pointers available
@@ -104,10 +126,10 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
unw_get_save_loc(cursor, reg, &saveLoc);
if (saveLoc.type == UNW_SLT_MEMORY)
{
- PDWORD64 pLoc = (PDWORD64)saveLoc.u.addr;
+ SIZE_T *pLoc = (SIZE_T *)saveLoc.u.addr;
// Filter out fake save locations that point to unwContext
- if ((pLoc < (PDWORD64)unwContext) || ((PDWORD64)(unwContext + 1) <= pLoc))
- *contextPointer = (PDWORD64)saveLoc.u.addr;
+ if ((pLoc < (SIZE_T *)unwContext) || ((SIZE_T *)(unwContext + 1) <= pLoc))
+ *contextPointer = (SIZE_T *)saveLoc.u.addr;
}
#endif
}
@@ -121,6 +143,15 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
+#elif defined(_ARM_)
+ GetContextPointer(cursor, unwContext, UNW_ARM_R4, &contextPointers->R4);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R5, &contextPointers->R5);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R6, &contextPointers->R6);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R7, &contextPointers->R7);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R8, &contextPointers->R8);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R9, &contextPointers->R9);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
+ GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#else
#error unsupported architecture
#endif
@@ -226,6 +257,8 @@ static void RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord)
ExceptionRecord->ExceptionAddress = (void *) ContextRecord.Eip;
#elif defined(_AMD64_)
ExceptionRecord->ExceptionAddress = (void *) ContextRecord.Rip;
+#elif defined(_ARM_)
+ ExceptionRecord->ExceptionAddress = (void *) ContextRecord.Pc;
#else
#error unsupported architecture
#endif