未验证 提交 0241bc15 编写于 作者: M Mike McLaughlin 提交者: GitHub

Fix arm64/arm32 cross-DAC (#91425)

The precode code was incorrectly using the HOST_ARM64, HOST_ARM, etc. defines instead
of the TARGET_ ones. This means the cross-DAC was using the wrong architectures
*Precode::Type codes.
上级 a8d5e7db
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define PRECODE_ALIGNMENT sizeof(void*) #define PRECODE_ALIGNMENT sizeof(void*)
#if defined(HOST_AMD64) #if defined(TARGET_AMD64)
#define OFFSETOF_PRECODE_TYPE 0 #define OFFSETOF_PRECODE_TYPE 0
#define OFFSETOF_PRECODE_TYPE_CALL_OR_JMP 5 #define OFFSETOF_PRECODE_TYPE_CALL_OR_JMP 5
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define SIZEOF_PRECODE_BASE 16 #define SIZEOF_PRECODE_BASE 16
#elif defined(HOST_X86) #elif defined(TARGET_X86)
EXTERN_C VOID STDCALL PrecodeRemotingThunk(); EXTERN_C VOID STDCALL PrecodeRemotingThunk();
...@@ -29,27 +29,27 @@ EXTERN_C VOID STDCALL PrecodeRemotingThunk(); ...@@ -29,27 +29,27 @@ EXTERN_C VOID STDCALL PrecodeRemotingThunk();
#define SIZEOF_PRECODE_BASE 8 #define SIZEOF_PRECODE_BASE 8
#elif defined(HOST_ARM64) #elif defined(TARGET_ARM64)
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN #define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0 #define OFFSETOF_PRECODE_TYPE 0
#elif defined(HOST_ARM) #elif defined(TARGET_ARM)
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN #define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 3 #define OFFSETOF_PRECODE_TYPE 3
#elif defined(HOST_LOONGARCH64) #elif defined(TARGET_LOONGARCH64)
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN #define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0 #define OFFSETOF_PRECODE_TYPE 0
#elif defined(HOST_RISCV64) #elif defined(TARGET_RISCV64)
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN #define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 0 #define OFFSETOF_PRECODE_TYPE 0
#endif // HOST_AMD64 #endif // TARGET_AMD64
#ifndef DACCESS_COMPILE #ifndef DACCESS_COMPILE
// Given an address in a slot, figure out if the prestub will be called // Given an address in a slot, figure out if the prestub will be called
...@@ -61,14 +61,14 @@ BOOL DoesSlotCallPrestub(PCODE pCode); ...@@ -61,14 +61,14 @@ BOOL DoesSlotCallPrestub(PCODE pCode);
// Invalid precode type // Invalid precode type
struct InvalidPrecode struct InvalidPrecode
{ {
#if defined(HOST_AMD64) || defined(HOST_X86) #if defined(TARGET_AMD64) || defined(TARGET_X86)
// int3 // int3
static const int Type = 0xCC; static const int Type = 0xCC;
#elif defined(HOST_ARM64) || defined(HOST_ARM) #elif defined(TARGET_ARM64) || defined(TARGET_ARM)
static const int Type = 0; static const int Type = 0;
#elif defined(HOST_LOONGARCH64) #elif defined(TARGET_LOONGARCH64)
static const int Type = 0xff; static const int Type = 0xff;
#elif defined(HOST_RISCV64) #elif defined(TARGET_RISCV64)
static const int Type = 0xff; static const int Type = 0xff;
#endif #endif
}; };
...@@ -90,25 +90,25 @@ extern "C" void StubPrecodeCode_End(); ...@@ -90,25 +90,25 @@ extern "C" void StubPrecodeCode_End();
// Regular precode // Regular precode
struct StubPrecode struct StubPrecode
{ {
#if defined(HOST_AMD64) #if defined(TARGET_AMD64)
static const BYTE Type = 0x4C; static const BYTE Type = 0x4C;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
#elif defined(HOST_X86) #elif defined(TARGET_X86)
static const BYTE Type = 0xA1; static const BYTE Type = 0xA1;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
#elif defined(HOST_ARM64) #elif defined(TARGET_ARM64)
static const int Type = 0x4A; static const int Type = 0x4A;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
#elif defined(HOST_ARM) #elif defined(TARGET_ARM)
static const int Type = 0xCF; static const int Type = 0xCF;
static const SIZE_T CodeSize = 12; static const SIZE_T CodeSize = 12;
#elif defined(HOST_LOONGARCH64) #elif defined(TARGET_LOONGARCH64)
static const int Type = 0x4; static const int Type = 0x4;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
#elif defined(HOST_RISCV64) #elif defined(TARGET_RISCV64)
static const int Type = 0x17; static const int Type = 0x17;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
#endif // HOST_AMD64 #endif // TARGET_AMD64
BYTE m_code[CodeSize]; BYTE m_code[CodeSize];
...@@ -224,31 +224,31 @@ extern "C" void FixupPrecodeCode_End(); ...@@ -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. // The fixup precode is simple jump once patched. It does not have the two instruction overhead of regular precode.
struct FixupPrecode struct FixupPrecode
{ {
#if defined(HOST_AMD64) #if defined(TARGET_AMD64)
static const int Type = 0xFF; static const int Type = 0xFF;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 6; static const int FixupCodeOffset = 6;
#elif defined(HOST_X86) #elif defined(TARGET_X86)
static const int Type = 0xFF; static const int Type = 0xFF;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 6; static const int FixupCodeOffset = 6;
#elif defined(HOST_ARM64) #elif defined(TARGET_ARM64)
static const int Type = 0x0B; static const int Type = 0x0B;
static const SIZE_T CodeSize = 24; static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 8; static const int FixupCodeOffset = 8;
#elif defined(HOST_ARM) #elif defined(TARGET_ARM)
static const int Type = 0xFF; static const int Type = 0xFF;
static const SIZE_T CodeSize = 12; static const SIZE_T CodeSize = 12;
static const int FixupCodeOffset = 4 + THUMB_CODE; static const int FixupCodeOffset = 4 + THUMB_CODE;
#elif defined(HOST_LOONGARCH64) #elif defined(TARGET_LOONGARCH64)
static const int Type = 0x3; static const int Type = 0x3;
static const SIZE_T CodeSize = 32; static const SIZE_T CodeSize = 32;
static const int FixupCodeOffset = 12; static const int FixupCodeOffset = 12;
#elif defined(HOST_RISCV64) #elif defined(TARGET_RISCV64)
static const int Type = 0x97; static const int Type = 0x97;
static const SIZE_T CodeSize = 32; static const SIZE_T CodeSize = 32;
static const int FixupCodeOffset = 10; static const int FixupCodeOffset = 10;
#endif // HOST_AMD64 #endif // TARGET_AMD64
BYTE m_code[CodeSize]; BYTE m_code[CodeSize];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册