Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] Fix arm64/arm32 cross-DAC #91438

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions src/coreclr/vm/precode.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

#define PRECODE_ALIGNMENT sizeof(void*)

#if defined(HOST_AMD64)
#if defined(TARGET_AMD64)

#define OFFSETOF_PRECODE_TYPE 0
#define OFFSETOF_PRECODE_TYPE_CALL_OR_JMP 5
#define OFFSETOF_PRECODE_TYPE_MOV_R10 10

#define SIZEOF_PRECODE_BASE 16

#elif defined(HOST_X86)
#elif defined(TARGET_X86)

EXTERN_C VOID STDCALL PrecodeRemotingThunk();

Expand All @@ -29,27 +29,27 @@ EXTERN_C VOID STDCALL PrecodeRemotingThunk();

#define SIZEOF_PRECODE_BASE 8

#elif defined(HOST_ARM64)
#elif defined(TARGET_ARM64)

#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0

#elif defined(HOST_ARM)
#elif defined(TARGET_ARM)

#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 3

#elif defined(HOST_LOONGARCH64)
#elif defined(TARGET_LOONGARCH64)

#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0

#elif defined(HOST_RISCV64)
#elif defined(TARGET_RISCV64)

#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0

#endif // HOST_AMD64
#endif // TARGET_AMD64

#ifndef DACCESS_COMPILE
// Given an address in a slot, figure out if the prestub will be called
Expand All @@ -61,14 +61,14 @@ BOOL DoesSlotCallPrestub(PCODE pCode);
// Invalid precode type
struct InvalidPrecode
{
#if defined(HOST_AMD64) || defined(HOST_X86)
#if defined(TARGET_AMD64) || defined(TARGET_X86)
// int3
static const int Type = 0xCC;
#elif defined(HOST_ARM64) || defined(HOST_ARM)
#elif defined(TARGET_ARM64) || defined(TARGET_ARM)
static const int Type = 0;
#elif defined(HOST_LOONGARCH64)
#elif defined(TARGET_LOONGARCH64)
static const int Type = 0xff;
#elif defined(HOST_RISCV64)
#elif defined(TARGET_RISCV64)
static const int Type = 0xff;
#endif
};
Expand All @@ -90,25 +90,25 @@ extern "C" void StubPrecodeCode_End();
// Regular precode
struct StubPrecode
{
#if defined(HOST_AMD64)
#if defined(TARGET_AMD64)
static const BYTE Type = 0x4C;
static const SIZE_T CodeSize = 24;
#elif defined(HOST_X86)
#elif defined(TARGET_X86)
static const BYTE Type = 0xA1;
static const SIZE_T CodeSize = 24;
#elif defined(HOST_ARM64)
#elif defined(TARGET_ARM64)
static const int Type = 0x4A;
static const SIZE_T CodeSize = 24;
#elif defined(HOST_ARM)
#elif defined(TARGET_ARM)
static const int Type = 0xCF;
static const SIZE_T CodeSize = 12;
#elif defined(HOST_LOONGARCH64)
#elif defined(TARGET_LOONGARCH64)
static const int Type = 0x4;
static const SIZE_T CodeSize = 24;
#elif defined(HOST_RISCV64)
#elif defined(TARGET_RISCV64)
static const int Type = 0x17;
static const SIZE_T CodeSize = 24;
#endif // HOST_AMD64
#endif // TARGET_AMD64

BYTE m_code[CodeSize];

Expand Down Expand Up @@ -224,31 +224,31 @@ extern "C" void FixupPrecodeCode_End();
// The fixup precode is simple jump once patched. It does not have the two instruction overhead of regular precode.
struct FixupPrecode
{
#if defined(HOST_AMD64)
#if defined(TARGET_AMD64)
static const int Type = 0xFF;
static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 6;
#elif defined(HOST_X86)
#elif defined(TARGET_X86)
static const int Type = 0xFF;
static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 6;
#elif defined(HOST_ARM64)
#elif defined(TARGET_ARM64)
static const int Type = 0x0B;
static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 8;
#elif defined(HOST_ARM)
#elif defined(TARGET_ARM)
static const int Type = 0xFF;
static const SIZE_T CodeSize = 12;
static const int FixupCodeOffset = 4 + THUMB_CODE;
#elif defined(HOST_LOONGARCH64)
#elif defined(TARGET_LOONGARCH64)
static const int Type = 0x3;
static const SIZE_T CodeSize = 32;
static const int FixupCodeOffset = 12;
#elif defined(HOST_RISCV64)
#elif defined(TARGET_RISCV64)
static const int Type = 0x97;
static const SIZE_T CodeSize = 32;
static const int FixupCodeOffset = 10;
#endif // HOST_AMD64
#endif // TARGET_AMD64

BYTE m_code[CodeSize];

Expand Down