Skip to content

Commit

Permalink
[x86/Linux] Port StubLinkerCPU::EmitSetup (dotnet/coreclr#8494)
Browse files Browse the repository at this point in the history
This commit ports StubLinkerCPU::EmitSetup to x86/Linux.

Commit migrated from dotnet/coreclr@375948e
  • Loading branch information
parjong authored and jkotas committed Dec 7, 2016
1 parent 5fba556 commit 6d3378e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/coreclr/src/vm/i386/stublinkerx86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2866,7 +2866,6 @@ VOID StubLinkerCPU::EmitSetup(CodeLabel *pForwardRef)
{
STANDARD_VM_CONTRACT;

#ifndef FEATURE_PAL
#ifdef FEATURE_IMPLICIT_TLS
DWORD idx = 0;
TLSACCESSMODE mode = TLSACCESS_GENERIC;
Expand All @@ -2889,13 +2888,17 @@ VOID StubLinkerCPU::EmitSetup(CodeLabel *pForwardRef)
switch (mode)
{
case TLSACCESS_WNT:
#ifndef FEATURE_PAL
{
unsigned __int32 tlsofs = offsetof(TEB, TlsSlots) + (idx * sizeof(void*));

static const BYTE code[] = {0x64,0x8b,0x1d}; // mov ebx, dword ptr fs:[IMM32]
EmitBytes(code, sizeof(code));
Emit32(tlsofs);
}
#else // !FEATURE_PAL
_ASSERTE("TLSACCESS_WNT mode is not supported");
#endif // !FEATURE_PAL
break;

case TLSACCESS_GENERIC:
Expand Down Expand Up @@ -2926,10 +2929,6 @@ VOID StubLinkerCPU::EmitSetup(CodeLabel *pForwardRef)
X86EmitDebugTrashReg(kECX);
X86EmitDebugTrashReg(kEDX);
#endif

#else // FEATURE_PAL
PORTABILITY_ASSERT("StubLinkerCPU::EmitSetup");
#endif // FEATURE_PAL
}

VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow)
Expand Down

0 comments on commit 6d3378e

Please sign in to comment.