diff options
author | Rahul Kumar <rahku@microsoft.com> | 2016-04-20 16:27:04 -0700 |
---|---|---|
committer | Rahul Kumar <rahku@microsoft.com> | 2016-04-28 15:47:17 -0700 |
commit | ef161ab2bb87207f52c7db9472fd5a027dbe5f12 (patch) | |
tree | d97273f3d0800b33e0a8e9461f0f1287ce2a38ca /src/zap/zapimport.cpp | |
parent | e9bc870cbba0178ae30c3cfdf65ba2ef2bdd229e (diff) | |
download | coreclr-ef161ab2bb87207f52c7db9472fd5a027dbe5f12.tar.gz coreclr-ef161ab2bb87207f52c7db9472fd5a027dbe5f12.tar.bz2 coreclr-ef161ab2bb87207f52c7db9472fd5a027dbe5f12.zip |
Enable ReadyToRun feature for arm64
Diffstat (limited to 'src/zap/zapimport.cpp')
-rw-r--r-- | src/zap/zapimport.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/zap/zapimport.cpp b/src/zap/zapimport.cpp index 4e7b151d74..98e7afee6a 100644 --- a/src/zap/zapimport.cpp +++ b/src/zap/zapimport.cpp @@ -2082,6 +2082,72 @@ DWORD ZapIndirectHelperThunk::SaveWorker(ZapWriter * pZapWriter) // bx r12 *(WORD *)p = 0x4760; p += 2; +#elif defined(_TARGET_ARM64_) + if (IsDelayLoadHelper()) + { + if (IsVSD()) + { + // x11 contains indirection cell + // Do nothing x11 contains our first param + } + else + { + // mov x11, x12 + *(DWORD*)p = 0xaa0c03eb; + p += 4; + } + + // movz x8, #index + DWORD index = GetSectionIndex(); + _ASSERTE(index <= 0x7F); + *(DWORD*)p = 0xd2800008 | (index << 5); + p += 4; + + // move Module* -> x9 + // ldr x9, [PC+0x14] + *(DWORD*)p = 0x58000289; + p += 4; + + //ldr x9, [x9] + *(DWORD*)p = 0xf9400129; + p += 4; + } + else + if (IsLazyHelper()) + { + // Move Module* -> x1 + // ldr x1, [PC+0x14] + *(DWORD*)p = 0x58000289; + p += 4; + + // ldr x1, [x1] + *(DWORD*)p = 0xf9400021; + p += 4; + } + + // branch to helper + + // mov x12, [helper] + // ldr x12, [PC+0x14] + *(DWORD*)p = 0x58000289; + p += 4; + + // ldr x12, [x12] + *(DWORD *)p = 0xf940018c; + p += 4; + + // br x12 + *(DWORD *)p = 0xd61f0180; + p += 4; + + // [Module*] + if (pImage != NULL) + pImage->WriteReloc(buffer, (int)(p - buffer), pImage->GetImportTable()->GetHelperImport(READYTORUN_HELPER_Module), 0, IMAGE_REL_BASED_PTR); + p += 8; + // [helper] + if (pImage != NULL) + pImage->WriteReloc(buffer, (int)(p - buffer), pImage->GetImportTable()->GetHelperImport(GetReadyToRunHelper()), 0, IMAGE_REL_BASED_PTR); + p += 8; #else PORTABILITY_ASSERT("ZapIndirectHelperThunk::SaveWorker"); #endif |