Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-06-17 17:13:34 +0300
committerGitHub <noreply@github.com>2018-06-17 17:13:34 +0300
commit40e96e0cfb5f0f9e1fbb694d959e22f6dd0ee541 (patch)
treeb1472ea2f470ebd2525052e1da3de74d77cb5761 /src/Native
parentfa35c23209a7ee81a1257f9c0e271feaab54d395 (diff)
parent75b6df17098d438ee16bd2f17e21cd7ac1589116 (diff)
Merge pull request #5948 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/Runtime/RHCodeMan.cpp51
-rw-r--r--src/Native/Runtime/arm64/GcProbe.asm8
2 files changed, 19 insertions, 40 deletions
diff --git a/src/Native/Runtime/RHCodeMan.cpp b/src/Native/Runtime/RHCodeMan.cpp
index 627b586ae..082b32d79 100644
--- a/src/Native/Runtime/RHCodeMan.cpp
+++ b/src/Native/Runtime/RHCodeMan.cpp
@@ -1200,37 +1200,24 @@ PTR_PTR_VOID EECodeManager::GetReturnAddressLocationForHijack(
}
#ifdef _ARM_
- // We cannot get the return address unless LR has
- // be saved in the prolog.
+ // We cannot get the return address unless LR has been saved in the prolog.
if (!pHeader->IsRegSaved(CSR_MASK_LR))
return NULL;
#elif defined(_ARM64_)
- // We can get return address if LR was saved either with FP or on its own:
- bool ebpFrame = pHeader->HasFramePointer();
- if (!ebpFrame && !pHeader->IsRegSaved(CSR_MASK_LR)) {
+ // We can get return address if LR was saved either with FP or on its own.
+ if (!pHeader->HasFramePointer() && !pHeader->IsRegSaved(CSR_MASK_LR))
return NULL;
- }
#endif // _ARM_
- void ** ppvResult;
-
UInt32 epilogOffset = 0;
UInt32 epilogSize = 0;
if (GetEpilogOffset(pGCInfoHeader, cbMethodCodeSize, pbEpilogTable, codeOffset, &epilogOffset, &epilogSize))
{
-#ifdef _ARM_
- // Disable hijacking from epilogs on ARM until we implement GetReturnAddressLocationFromEpilog.
- return NULL;
-#elif defined(_ARM64_)
- // Disable hijacking from epilogs on ARM64:
+#if defined(_ARM_) || defined(_ARM64_)
+ // Disable hijacking from epilogs until we implement GetReturnAddressLocationFromEpilog.
return NULL;
#else
- ppvResult = GetReturnAddressLocationFromEpilog(pHeader, pContext, epilogOffset, epilogSize);
- // Early out if GetReturnAddressLocationFromEpilog indicates a non-hijackable epilog (e.g. exception
- // throw epilog or tail call).
- if (ppvResult == NULL)
- return NULL;
- goto Finished;
+ return GetReturnAddressLocationFromEpilog(pHeader, pContext, epilogOffset, epilogSize);
#endif
}
@@ -1238,11 +1225,7 @@ PTR_PTR_VOID EECodeManager::GetReturnAddressLocationForHijack(
// ARM always sets up R11 as an OS frame chain pointer to enable fast ETW stack walking (except in the
// case where LR is not pushed, but that was handled above). The protocol specifies that the return
// address is pushed at [r11, #4].
- ppvResult = (void **)((*pContext->pR11) + sizeof(void *));
- goto Finished;
-#elif _ARM64_
- ppvResult = (void **)(pContext->pLR);
- goto Finished;
+ return (void **)((*pContext->pR11) + sizeof(void *));
#else
// We are in the body of the method, so just find the return address using the unwind info.
@@ -1254,8 +1237,7 @@ PTR_PTR_VOID EECodeManager::GetReturnAddressLocationForHijack(
// In this case, we have the normal EBP frame pointer, but also an EBX frame pointer. Use the EBX
// one, because the return address associated with that frame pointer is the one we're actually
// going to return to. The other one (next to EBP) is only for EBP-chain-walking.
- ppvResult = (void **)((*pContext->pRbx) + sizeof(void *));
- goto Finished;
+ return (void **)((*pContext->pRbx) + sizeof(void *));
}
#endif
@@ -1263,25 +1245,24 @@ PTR_PTR_VOID EECodeManager::GetReturnAddressLocationForHijack(
#ifdef _AMD64_
framePointerOffset = pHeader->GetFramePointerOffset();
#endif
- ppvResult = (void **)((*pContext->pRbp) + sizeof(void *) - framePointerOffset);
- goto Finished;
+ return (void **)(pContext->GetFP() + sizeof(void *) - framePointerOffset);
}
{
// We do not have a frame pointer, but we are also not in the prolog or epilog
- UInt8 * RSP = (UInt8 *)pContext->GetSP();
- RSP += pHeader->GetFrameSize();
+ UIntNative RSP = pContext->GetSP() + pHeader->GetFrameSize();
+#if _ARM64_
+ // LR is saved at the bottom of the preserved registers area
+ ASSERT(pHeader->IsRegSaved(CSR_MASK_LR));
+#else
RSP += pHeader->GetPreservedRegsSaveSize();
+#endif
// RSP should point to the return address now.
- ppvResult = (void**)RSP;
+ return (void**)RSP;
}
- goto Finished;
#endif
-
- Finished:
- return ppvResult;
}
#endif
diff --git a/src/Native/Runtime/arm64/GcProbe.asm b/src/Native/Runtime/arm64/GcProbe.asm
index f83141684..caa400ce4 100644
--- a/src/Native/Runtime/arm64/GcProbe.asm
+++ b/src/Native/Runtime/arm64/GcProbe.asm
@@ -321,7 +321,7 @@ EXTRA_SAVE_SIZE equ (32*16)
tst w2, #TSF_SuppressGcStress__OR__TSF_DoNotTriggerGC
bne %ft0
- ldr x2, [x4, #OFFSETOF__Thread__m_pHackPInvokeTunnel]
+ ldr x9, [x4, #OFFSETOF__Thread__m_pHackPInvokeTunnel]
bl RhpWaitForGCNoAbort
0
MEND
@@ -393,7 +393,6 @@ EXTRA_SAVE_SIZE equ (32*16)
#endif ;; FEATURE_GC_STRESS
LEAF_ENTRY RhpGcProbe
- brk 0xf000 ;; TODO: remove after debugging/testing stub
ldr x3, =RhpTrapThreads
ldr w3, [x3]
tbnz x3, #TrapThreadsFlags_TrapThreads_Bit, RhpGcProbeRare
@@ -403,7 +402,6 @@ EXTRA_SAVE_SIZE equ (32*16)
EXTERN RhpThrowHwEx
NESTED_ENTRY RhpGcProbeRare
- brk 0xf000 ;; TODO: remove after debugging/testing stub
PROLOG_PROBE_FRAME x2, x3, x12,
mov x4, x2
@@ -835,7 +833,7 @@ Success
NoGcStress
#endif ;; FEATURE_GC_STRESS
- add x2, sp, xzr ; sp is address of PInvokeTransitionFrame
+ mov x9, sp ; sp is address of PInvokeTransitionFrame
bl RhpWaitForGCNoAbort
DoneWaitingForGc
@@ -956,7 +954,7 @@ Abort
SkipGcStress
#endif ;; FEATURE_GC_STRESS
- add x9, sp, xzr ; sp is address of PInvokeTransitionFrame
+ mov x9, sp ; sp is address of PInvokeTransitionFrame
bl RhpWaitForGCNoAbort
DoNotTriggerGC