diff options
author | Steve MacLean <sdmaclea@qti.qualcomm.com> | 2017-02-17 13:25:37 -0500 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-02-17 19:25:37 +0100 |
commit | 9baa44aa334cf6f032e4abeae10dc1b960aaeb57 (patch) | |
tree | 9db49209ed0728eab25458e22f7416a0d31e0690 /src/unwinder | |
parent | 9f4aae6ac42f846473e6f70f2ac19e8910c97ccc (diff) | |
download | coreclr-9baa44aa334cf6f032e4abeae10dc1b960aaeb57.tar.gz coreclr-9baa44aa334cf6f032e4abeae10dc1b960aaeb57.tar.bz2 coreclr-9baa44aa334cf6f032e4abeae10dc1b960aaeb57.zip |
[ARM64/Unix] (#9500)
* [Arm64/Unix] Update arm64 *.S files to match *.asm
* [Arm64/Unix] Fix CONTEXTToNativeContext()
* [Arm64/Unix] ThrowExceptionFromContextInternal
* [Arm64/Unix] Preserve x8 argument register
* [ARM64/Unix] Add CFI directives
Add native unwind info
* [Arm64/Unix] Fix RtlRestoreContext
* [Arm64/Unix] Restore FP from CurrentContextPointers
* [Arm64/Unix] fix pointer math
* [Arm64/Unix] Fix CallDescrWorkerInternal personality
* [Arm64/Unix] More Fp fixups
* [Arm64/Unix] CallEHFunclet machine state
Restore non-volatile machine state in CallEHFunclet
* [Arm64/Unix] CallDescrWorkerInternal
Use empty stack slot to save argument
* [Arm64/Unix] RtlVirtualUnwind update pointers
* [Arm64] LazyMachState fixes
* [Arm64/Unix] disable USE_REDIRECT_FOR_GCSTRESS
When FEATURE_PAL is enableds USE_REDIRECT_FOR_GCSTRESS
is not supported
* [Arm64] ClearRegDisplayArgumentAndScratchRegisters()
* [Arm64] Remove unnecesary copy in TransitionFrame
* [Arm64/Unix] Fix comment per review
* [Arm64/Unix] move constants per review
* [Arm64/Unix] Use ldp per review
Also fix indentation
* [Arm64/Unix] Fix indentation per review
* [Arm64/Unix] Remove m_Unwound per review comments
* [Arm64/Unix] Use PREPARE_EXTERNAL_VAR to access globals
* [Arm64/Unix] Fix more whitespace per earlier review comments
Diffstat (limited to 'src/unwinder')
-rw-r--r-- | src/unwinder/arm64/unwinder_arm64.cpp | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/src/unwinder/arm64/unwinder_arm64.cpp b/src/unwinder/arm64/unwinder_arm64.cpp index e13c7b917d..36f7de1aad 100644 --- a/src/unwinder/arm64/unwinder_arm64.cpp +++ b/src/unwinder/arm64/unwinder_arm64.cpp @@ -109,16 +109,37 @@ typedef struct _ARM64_VFP_STATE typedef struct _ARM64_UNWIND_PARAMS { - ULONG_PTR ControlPc; - PULONG_PTR LowLimit; - PULONG_PTR HighLimit; PKNONVOLATILE_CONTEXT_POINTERS ContextPointers; } ARM64_UNWIND_PARAMS, *PARM64_UNWIND_PARAMS; #define UNWIND_PARAMS_SET_TRAP_FRAME(Params, Address, Size) -#define UPDATE_CONTEXT_POINTERS(Params, RegisterNumber, Address) -#define UPDATE_FP_CONTEXT_POINTERS(Params, RegisterNumber, Address) +#define UPDATE_CONTEXT_POINTERS(Params, RegisterNumber, Address) \ +do { \ + if (ARGUMENT_PRESENT(Params)) { \ + PKNONVOLATILE_CONTEXT_POINTERS ContextPointers = (Params)->ContextPointers; \ + if (ARGUMENT_PRESENT(ContextPointers)) { \ + if (RegisterNumber >= 19 && RegisterNumber <= 30) { \ + (&ContextPointers->X19)[RegisterNumber - 19] = (PDWORD64)Address; \ + } \ + } \ + } \ +} while (0) + + +#define UPDATE_FP_CONTEXT_POINTERS(Params, RegisterNumber, Address) \ +do { \ + if (ARGUMENT_PRESENT(Params)) { \ + PKNONVOLATILE_CONTEXT_POINTERS ContextPointers = (Params)->ContextPointers; \ + if (ARGUMENT_PRESENT(ContextPointers) && \ + (RegisterNumber >= 8) && \ + (RegisterNumber <= 15)) { \ + \ + (&ContextPointers->D8)[RegisterNumber - 8] = (PDWORD64)Address; \ + } \ + } \ +} while (0) + #define VALIDATE_STACK_ADDRESS_EX(Params, Context, Address, DataSize, Alignment, OutStatus) #define VALIDATE_STACK_ADDRESS(Params, Context, DataSize, Alignment, OutStatus) @@ -215,7 +236,7 @@ Return Value: for (RegIndex = 0; RegIndex < 18; RegIndex++) { UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress); #ifdef __clang__ - *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, SourceAddress); + *(&ContextRecord->X0 + RegIndex) = MEMORY_READ_QWORD(UnwindParams, SourceAddress); #else ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress); #endif @@ -295,7 +316,7 @@ Return Value: for (RegIndex = 0; RegIndex < 29; RegIndex++) { UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress); #ifdef __clang__ - *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, SourceAddress); + *(&ContextRecord->X0 + RegIndex) = MEMORY_READ_QWORD(UnwindParams, SourceAddress); #else ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress); #endif @@ -479,9 +500,9 @@ Return Value: // for (RegIndex = 0; RegIndex < RegisterCount; RegIndex++) { - UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, CurAddress); + UPDATE_CONTEXT_POINTERS(UnwindParams, FirstRegister + RegIndex, CurAddress); #ifdef __clang__ - *(&ContextRecord->X0 + (RegIndex * sizeof(void*))) = MEMORY_READ_QWORD(UnwindParams, CurAddress); + *(&ContextRecord->X0 + FirstRegister + RegIndex) = MEMORY_READ_QWORD(UnwindParams, CurAddress); #else ContextRecord->X[FirstRegister + RegIndex] = MEMORY_READ_QWORD(UnwindParams, CurAddress); #endif @@ -555,7 +576,7 @@ Return Value: // for (RegIndex = 0; RegIndex < RegisterCount; RegIndex++) { - UPDATE_FP_CONTEXT_POINTERS(UnwindParams, RegIndex, CurAddress); + UPDATE_FP_CONTEXT_POINTERS(UnwindParams, FirstRegister + RegIndex, CurAddress); ContextRecord->V[FirstRegister + RegIndex].Low = MEMORY_READ_QWORD(UnwindParams, CurAddress); CurAddress += 8; } @@ -1591,7 +1612,6 @@ BOOL DacUnwindStackFrame(T_CONTEXT *pContext, T_KNONVOLATILE_CONTEXT_POINTERS* p } #if defined(FEATURE_PAL) -//TODO: Fix the context pointers PEXCEPTION_ROUTINE RtlVirtualUnwind( IN ULONG HandlerType, @@ -1615,6 +1635,9 @@ RtlVirtualUnwind( rfe.BeginAddress = FunctionEntry->BeginAddress; rfe.UnwindData = FunctionEntry->UnwindData; + ARM64_UNWIND_PARAMS unwindParams; + unwindParams.ContextPointers = ContextPointers; + if ((rfe.UnwindData & 3) != 0) { hr = RtlpUnwindFunctionCompact(ControlPc - ImageBase, @@ -1623,7 +1646,7 @@ RtlVirtualUnwind( EstablisherFrame, &handlerRoutine, HandlerData, - NULL); + &unwindParams); } else @@ -1635,7 +1658,7 @@ RtlVirtualUnwind( EstablisherFrame, &handlerRoutine, HandlerData, - NULL); + &unwindParams); } _ASSERTE(SUCCEEDED(hr)); |