summaryrefslogtreecommitdiff
path: root/src/unwinder
diff options
context:
space:
mode:
authorGeoff Norton <grompf@gmail.com>2015-07-25 14:48:20 +0900
committerGeoff Norton <grompf@gmail.com>2015-07-27 21:12:04 -0700
commit16c43e35d1a9a858374757ccf0484a50afdb0b69 (patch)
tree1e8977500a18b28c00716d5378a1d5f0afa3b7a3 /src/unwinder
parent0a83c2fc30146b335a24c85de2a5ba33a72bdbdd (diff)
downloadcoreclr-16c43e35d1a9a858374757ccf0484a50afdb0b69.tar.gz
coreclr-16c43e35d1a9a858374757ccf0484a50afdb0b69.tar.bz2
coreclr-16c43e35d1a9a858374757ccf0484a50afdb0b69.zip
[aarch64] Initial aarch64/linux bring up
Diffstat (limited to 'src/unwinder')
-rw-r--r--src/unwinder/CMakeLists.txt10
-rw-r--r--src/unwinder/arm64/unwinder_arm64.cpp74
-rw-r--r--src/unwinder/dac/CMakeLists.txt8
3 files changed, 85 insertions, 7 deletions
diff --git a/src/unwinder/CMakeLists.txt b/src/unwinder/CMakeLists.txt
index 27e613cd3c..86c935a578 100644
--- a/src/unwinder/CMakeLists.txt
+++ b/src/unwinder/CMakeLists.txt
@@ -23,8 +23,14 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
list(APPEND UNWINDER_SOURCES
arm/unwinder_arm.cpp
)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ include_directories(arm64)
+
+ list(APPEND UNWINDER_SOURCES
+ arm64/unwinder_arm64.cpp
+ )
else()
- message(FATAL_ERROR "Only ARM and AMD64 is supported")
+ message(FATAL_ERROR "Only ARM, ARM64 and AMD64 is supported")
endif()
convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES})
@@ -37,4 +43,4 @@ if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(wks)
endif(CLR_CMAKE_PLATFORM_UNIX)
-add_subdirectory(dac) \ No newline at end of file
+add_subdirectory(dac)
diff --git a/src/unwinder/arm64/unwinder_arm64.cpp b/src/unwinder/arm64/unwinder_arm64.cpp
index a56e42469e..a5177887ab 100644
--- a/src/unwinder/arm64/unwinder_arm64.cpp
+++ b/src/unwinder/arm64/unwinder_arm64.cpp
@@ -215,7 +215,11 @@ Return Value:
SourceAddress = StartingSp + FIELD_OFFSET(ARM64_KTRAP_FRAME, X);
for (RegIndex = 0; RegIndex < 18; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress);
+#ifdef __clang__
+ *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
+#else
ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
+#endif
SourceAddress += sizeof(ULONG_PTR);
}
@@ -288,10 +292,14 @@ Return Value:
// Restore X0-X28, and D0-D31
//
- SourceAddress = StartingSp + FIELD_OFFSET(T_CONTEXT, X);
+ SourceAddress = StartingSp + FIELD_OFFSET(T_CONTEXT, X0);
for (RegIndex = 0; RegIndex < 29; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress);
+#ifdef __clang__
+ *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
+#else
ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
+#endif
SourceAddress += sizeof(ULONG_PTR);
}
@@ -473,7 +481,11 @@ Return Value:
for (RegIndex = 0; RegIndex < RegisterCount; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, CurAddress);
+#ifdef __clang__
+ *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, CurAddress);
+#else
ContextRecord->X[FirstRegister + RegIndex] = MEMORY_READ_QWORD(UnwindParams, CurAddress);
+#endif
CurAddress += 8;
}
if (SpOffset < 0) {
@@ -1534,7 +1546,7 @@ BOOL OOPStackUnwinderArm64::Unwind(T_CONTEXT * pContext)
if ((Rfe.UnwindData & 3) != 0)
{
- hr = RtlpUnwindFunctionCompact(pContext->Pc - (ULONG)ImageBase,
+ hr = RtlpUnwindFunctionCompact(pContext->Pc - ImageBase,
&Rfe,
pContext,
&DummyEstablisherFrame,
@@ -1545,8 +1557,8 @@ BOOL OOPStackUnwinderArm64::Unwind(T_CONTEXT * pContext)
}
else
{
- hr = RtlpUnwindFunctionFull(pContext->Pc - (ULONG)ImageBase,
- (ULONG)ImageBase,
+ hr = RtlpUnwindFunctionFull(pContext->Pc - ImageBase,
+ ImageBase,
&Rfe,
pContext,
&DummyEstablisherFrame,
@@ -1578,3 +1590,57 @@ BOOL DacUnwindStackFrame(T_CONTEXT *pContext, T_KNONVOLATILE_CONTEXT_POINTERS* p
return res;
}
+
+#if defined(FEATURE_PAL)
+//TODO: Fix the context pointers
+PEXCEPTION_ROUTINE
+RtlVirtualUnwind(
+ IN ULONG HandlerType,
+ IN ULONG64 ImageBase,
+ IN ULONG64 ControlPc,
+ IN PRUNTIME_FUNCTION FunctionEntry,
+ IN OUT PCONTEXT ContextRecord,
+ OUT PVOID *HandlerData,
+ OUT PULONG64 EstablisherFrame,
+ IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
+ )
+{
+ PEXCEPTION_ROUTINE handlerRoutine;
+ HRESULT hr;
+
+ DWORD64 startingPc = ControlPc;
+ DWORD64 startingSp = ContextRecord->Sp;
+
+ T_RUNTIME_FUNCTION Rfe;
+
+ Rfe.BeginAddress = FunctionEntry->BeginAddress;
+ Rfe.UnwindData = FunctionEntry->UnwindData;
+
+ if ((Rfe.UnwindData & 3) != 0)
+ {
+ hr = RtlpUnwindFunctionCompact(ControlPc - ImageBase,
+ &Rfe,
+ ContextRecord,
+ EstablisherFrame,
+ &handlerRoutine,
+ HandlerData,
+ NULL);
+
+ }
+ else
+ {
+ hr = RtlpUnwindFunctionFull(ControlPc - ImageBase,
+ ImageBase,
+ &Rfe,
+ ContextRecord,
+ EstablisherFrame,
+ &handlerRoutine,
+ HandlerData,
+ NULL);
+ }
+
+ _ASSERTE(SUCCEEDED(hr));
+
+ return handlerRoutine;
+}
+#endif
diff --git a/src/unwinder/dac/CMakeLists.txt b/src/unwinder/dac/CMakeLists.txt
index 12163af12a..75d7050c6f 100644
--- a/src/unwinder/dac/CMakeLists.txt
+++ b/src/unwinder/dac/CMakeLists.txt
@@ -14,8 +14,14 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
add_definitions(-DDBG_TARGET_ARM=1)
add_definitions(-DDBG_TARGET_WIN32=1)
add_definitions(-D_WIN32=1)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ add_definitions(-D_TARGET_ARM64_=1)
+ add_definitions(-DDBG_TARGET_64BIT=1)
+ add_definitions(-DDBG_TARGET_ARM64=1)
+ add_definitions(-DDBG_TARGET_WIN64=1)
+ add_definitions(-D_WIN64=1)
else()
- message(FATAL_ERROR "Only ARM and AMD64 is supported")
+ message(FATAL_ERROR "Only ARM, ARM64 and AMD64 is supported")
endif()
add_library(unwinder_dac ${UNWINDER_SOURCES})