diff options
author | dotnet bot <dotnet-bot@dotnetfoundation.org> | 2017-12-15 03:51:07 +0300 |
---|---|---|
committer | Ahson Khan <ahkha@microsoft.com> | 2017-12-15 03:51:07 +0300 |
commit | d6c2c0869740b1a15553b222d634b1f99cf9caeb (patch) | |
tree | d1c0b302c367b09fc49ab7cf03b4d027617d025e /src/Native/Runtime/MiscHelpers.cpp | |
parent | bcb053d3260b03ba086258b73bb6728463296b1e (diff) |
[tfs-changeset: 1683889] (#5116)
Diffstat (limited to 'src/Native/Runtime/MiscHelpers.cpp')
-rw-r--r-- | src/Native/Runtime/MiscHelpers.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/Native/Runtime/MiscHelpers.cpp b/src/Native/Runtime/MiscHelpers.cpp index b2c694c5c..ee178cb79 100644 --- a/src/Native/Runtime/MiscHelpers.cpp +++ b/src/Native/Runtime/MiscHelpers.cpp @@ -467,7 +467,7 @@ COOP_PINVOKE_HELPER(UInt8 *, RhGetCodeTarget, (UInt8 * pCodeOrg)) // is this an unboxing stub followed by a relative jump? else if (unboxingStub && pCode[0] == 0xe9) { - // relatie jump - dist is relative to the point *after* the instruction + // relative jump - dist is relative to the point *after* the instruction Int32 distToTarget = *(Int32 *)&pCode[1]; UInt8 * target = pCode + 5 + distToTarget; return target; @@ -494,7 +494,7 @@ COOP_PINVOKE_HELPER(UInt8 *, RhGetCodeTarget, (UInt8 * pCodeOrg)) // is this an unboxing stub followed by a relative jump? else if (unboxingStub && pCode[0] == 0xe9) { - // relatie jump - dist is relative to the point *after* the instruction + // relative jump - dist is relative to the point *after* the instruction Int32 distToTarget = *(Int32 *)&pCode[1]; UInt8 * pTarget = pCode + 5 + distToTarget; return pTarget; @@ -537,8 +537,27 @@ COOP_PINVOKE_HELPER(UInt8 *, RhGetCodeTarget, (UInt8 * pCodeOrg)) } #elif _TARGET_ARM64_ - UNREFERENCED_PARAMETER(unboxingStub); - PORTABILITY_ASSERT("@TODO: FIXME:ARM64"); + UInt32 * pCode = (UInt32 *)pCodeOrg; + // is this "add x0,x0,#8"? + if (pCode[0] == 0x91002000) + { + // unboxing sequence + unboxingStub = true; + pCode++; + } + // is this an indirect jump? + if (/* ARM64TODO */ false) + { + // ARM64TODO + } + // is this an unboxing stub followed by a relative jump? + else if (unboxingStub && (pCode[0] >> 26) == 0x5) + { + // relative jump - dist is relative to the instruction + // offset = SignExtend(imm26:'00', 64); + Int64 distToTarget = ((Int64)pCode[0] << 38) >> 36; + return (UInt8 *)pCode + distToTarget; + } #else UNREFERENCED_PARAMETER(unboxingStub); PORTABILITY_ASSERT("RhGetCodeTarget"); |