Skip to content

Commit f7a7b2b

Browse files
tommcdonjanvorli
andauthored
Update FixupPrecode and StubPrecode types for ARM (#92030)
* Update FixupPrecode and StubPrecode types for ARM Co-authored-by: Jan Vorlicek <[email protected]> * Update ThisPtrRetBufPrecode and NDirectImportPrecode types for arm Co-authored-by: Jan Vorlicek <[email protected]> * Addressing PR feedback - remove unnecessary #ifdef's --------- Co-authored-by: Jan Vorlicek <[email protected]>
1 parent 1bd6220 commit f7a7b2b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/coreclr/vm/arm/cgencpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ inline BOOL ClrFlushInstructionCache(LPCVOID pCodeAddr, size_t sizeOfCode, bool
10231023
// Precode to shuffle this and retbuf for closed delegates over static methods with return buffer
10241024
struct ThisPtrRetBufPrecode {
10251025

1026-
static const int Type = 0x46;
1026+
static const int Type = 0x01;
10271027

10281028
// mov r12, r0
10291029
// mov r0, r1

src/coreclr/vm/precode.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ EXTERN_C VOID STDCALL PrecodeRemotingThunk();
3636

3737
#elif defined(TARGET_ARM)
3838

39-
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
40-
#define OFFSETOF_PRECODE_TYPE 3
39+
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN * 2
40+
#define OFFSETOF_PRECODE_TYPE 7
4141

4242
#elif defined(TARGET_LOONGARCH64)
4343

@@ -100,7 +100,7 @@ struct StubPrecode
100100
static const int Type = 0x4A;
101101
static const SIZE_T CodeSize = 24;
102102
#elif defined(TARGET_ARM)
103-
static const int Type = 0xCF;
103+
static const int Type = 0xFF;
104104
static const SIZE_T CodeSize = 12;
105105
#elif defined(TARGET_LOONGARCH64)
106106
static const int Type = 0x4;
@@ -189,7 +189,7 @@ typedef DPTR(StubPrecode) PTR_StubPrecode;
189189
// (This is fake precode. VTable slot does not point to it.)
190190
struct NDirectImportPrecode : StubPrecode
191191
{
192-
static const int Type = 0x01;
192+
static const int Type = 0x02;
193193

194194
void Init(NDirectImportPrecode* pPrecodeRX, MethodDesc* pMD, LoaderAllocator *pLoaderAllocator);
195195

@@ -237,7 +237,7 @@ struct FixupPrecode
237237
static const SIZE_T CodeSize = 24;
238238
static const int FixupCodeOffset = 8;
239239
#elif defined(TARGET_ARM)
240-
static const int Type = 0xFF;
240+
static const int Type = 0xCF;
241241
static const SIZE_T CodeSize = 12;
242242
static const int FixupCodeOffset = 4 + THUMB_CODE;
243243
#elif defined(TARGET_LOONGARCH64)
@@ -614,4 +614,8 @@ static_assert_no_msg(FixupPrecode::Type != NDirectImportPrecode::Type);
614614
static_assert_no_msg(FixupPrecode::Type != ThisPtrRetBufPrecode::Type);
615615
static_assert_no_msg(NDirectImportPrecode::Type != ThisPtrRetBufPrecode::Type);
616616

617+
// Verify that the base type for each precode fits into each specific precode type
618+
static_assert_no_msg(sizeof(Precode) <= sizeof(NDirectImportPrecode));
619+
static_assert_no_msg(sizeof(Precode) <= sizeof(FixupPrecode));
620+
static_assert_no_msg(sizeof(Precode) <= sizeof(ThisPtrRetBufPrecode));
617621
#endif // __PRECODE_H__

0 commit comments

Comments
 (0)