Skip to content

Commit 5c9a351

Browse files
committed
set thumb mode after building xdata
1 parent d07045f commit 5c9a351

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/Backend/Encoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ Encoder::Encode()
323323
m_func->GetThreadContextInfo()->GetProcessHandle());
324324
#elif _M_ARM
325325
m_func->m_unwindInfo.EmitUnwindInfo(m_func->GetJITOutput(), alloc);
326-
m_func->GetJITOutput()->SetCodeAddress(m_func->GetJITOutput()->GetCodeAddress() | 0x1); // Set thumb mode
327-
328326
if (m_func->IsOOPJIT())
329327
{
330328
size_t allocSize = XDataAllocator::GetAllocSize(alloc->allocation->xdata.pdataCount, alloc->allocation->xdata.xdataSize);
@@ -337,6 +335,8 @@ Encoder::Encode()
337335
XDataAllocator::Register(&alloc->allocation->xdata, m_func->GetJITOutput()->GetCodeAddress(), m_func->GetJITOutput()->GetCodeSize());
338336
m_func->GetInProcJITEntryPointInfo()->SetXDataInfo(&alloc->allocation->xdata);
339337
}
338+
339+
m_func->GetJITOutput()->SetCodeAddress(m_func->GetJITOutput()->GetCodeAddress() | 0x1); // Set thumb mode
340340
#endif
341341
const bool isSimpleJit = m_func->IsSimpleJit();
342342

lib/Backend/NativeCodeGenerator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
10681068
#endif
10691069

10701070

1071-
#if defined(_M_ARM32_OR_ARM64)
1071+
#if defined(_M_ARM)
10721072
// for in-proc jit we do registration in encoder
10731073
if (JITManager::GetJITManager()->IsOOPJITEnabled())
10741074
{
@@ -1083,7 +1083,8 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
10831083
{
10841084
xdataInfo->address = nullptr;
10851085
}
1086-
XDataAllocator::Register(xdataInfo, jitWriteData.codeAddress, jitWriteData.codeSize);
1086+
// unmask thumb mode from code address
1087+
XDataAllocator::Register(xdataInfo, jitWriteData.codeAddress & ~0x1, jitWriteData.codeSize);
10871088
epInfo->SetXDataInfo(xdataInfo);
10881089
}
10891090
#endif

0 commit comments

Comments
 (0)