Skip to content

Commit 9d37418

Browse files
committed
Use consistent types throughout the runtime for the code page generators
1 parent c6e147e commit 9d37418

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

src/coreclr/inc/executableallocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class ExecutableAllocator
276276
// If templateInImage is not null, it will attempt to use it as the template, otherwise it will create an temporary in memory file to serve as the template
277277
// Some OS/Architectures may/may not be able to work with this, so this api is permitted to return NULL, and callers should have an alternate approach using
278278
// the codePageGenerator directly.
279-
void* CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size));
279+
void* CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size));
280280
};
281281

282282
#define ExecutableWriterHolder ExecutableWriterHolderNoLog

src/coreclr/inc/loaderheap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,10 @@ struct InterleavedLoaderHeapConfig
459459
{
460460
uint32_t StubSize;
461461
void* Template;
462-
void (*CodePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size);
462+
void (*CodePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size);
463463
};
464464

465-
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size));
465+
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size));
466466

467467
//===============================================================================
468468
// This is the base class for InterleavedLoaderHeap It's used as a simple

src/coreclr/utilcode/executableallocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ void ExecutableAllocator::FreeThunksFromTemplate(void *pThunks, size_t templateS
10311031
}
10321032
}
10331033

1034-
void* ExecutableAllocator::CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size))
1034+
void* ExecutableAllocator::CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size))
10351035
{
10361036
return VMToOSInterface::CreateTemplate(templateInImage, templateSize, codePageGenerator);
10371037
}

src/coreclr/utilcode/interleavedloaderheap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ void *UnlockedInterleavedLoaderHeap::UnlockedAllocStub(
544544
return pResult;
545545
}
546546

547-
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size))
547+
void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size))
548548
{
549549
pConfig->StubSize = (uint32_t)stubSize;
550550
pConfig->Template = ExecutableAllocator::Instance()->CreateTemplate(templateInImage, GetStubCodePageSize(), codePageGenerator);

src/coreclr/vm/callcounting.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void CallCountingStub::StaticInitialize()
333333

334334
#endif // DACCESS_COMPILE
335335

336-
void CallCountingStub::GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T pageSize)
336+
void CallCountingStub::GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t pageSize)
337337
{
338338
#ifdef TARGET_X86
339339
int totalCodeSize = (pageSize / CallCountingStub::CodeSize) * CallCountingStub::CodeSize;
@@ -344,13 +344,13 @@ void CallCountingStub::GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T
344344

345345
// Set absolute addresses of the slots in the stub
346346
BYTE* pCounterSlot = pageBaseRX + i + pageSize + offsetof(CallCountingStubData, RemainingCallCountCell);
347-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_RemainingCallCountCell_Offset)) = pCounterSlot;
347+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_RemainingCallCountCell_Offset)) = pCounterSlot;
348348

349349
BYTE* pTargetSlot = pageBaseRX + i + pageSize + offsetof(CallCountingStubData, TargetForMethod);
350-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_TargetForMethod_Offset)) = pTargetSlot;
350+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_TargetForMethod_Offset)) = pTargetSlot;
351351

352352
BYTE* pCountReachedZeroSlot = pageBaseRX + i + pageSize + offsetof(CallCountingStubData, TargetForThresholdReached);
353-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_TargetForThresholdReached_Offset)) = pCountReachedZeroSlot;
353+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(CallCountingStubCode_TargetForThresholdReached_Offset)) = pCountReachedZeroSlot;
354354
}
355355
#else // TARGET_X86
356356
FillStubCodePage(pageBase, (const void*)PCODEToPINSTR((PCODE)CallCountingStubCode), CallCountingStub::CodeSize, pageSize);

src/coreclr/vm/callcounting.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class CallCountingStub
150150
static void StaticInitialize();
151151
#endif // !DACCESS_COMPILE
152152

153-
static void GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size);
153+
static void GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size);
154154

155155
PTR_CallCount GetRemainingCallCountCell() const;
156156
PCODE GetTargetForMethod() const;

src/coreclr/vm/precode.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -545,19 +545,19 @@ void StubPrecode::StaticInitialize()
545545
InitializeLoaderHeapConfig(&s_stubPrecodeHeapConfig, StubPrecode::CodeSize, (void*)StubPrecodeCodeTemplate, StubPrecode::GenerateCodePage);
546546
}
547547

548-
void StubPrecode::GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T pageSize)
548+
void StubPrecode::GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t pageSize)
549549
{
550550
#ifdef TARGET_X86
551551
int totalCodeSize = (pageSize / StubPrecode::CodeSize) * StubPrecode::CodeSize;
552552
for (int i = 0; i < totalCodeSize; i += StubPrecode::CodeSize)
553553
{
554-
memcpy(pageBase + i, (const void*)StubPrecodeCode, (BYTE*)StubPrecodeCode_End - (BYTE*)StubPrecodeCode);
554+
memcpy(pageBase + i, (const void*)StubPrecodeCode, (uint8_t*)StubPrecodeCode_End - (uint8_t*)StubPrecodeCode);
555555

556-
BYTE* pTargetSlot = pageBaseRX + i + pageSize + offsetof(StubPrecodeData, Target);
557-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(StubPrecodeCode_Target_Offset)) = pTargetSlot;
556+
uint8_t* pTargetSlot = pageBaseRX + i + pageSize + offsetof(StubPrecodeData, Target);
557+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(StubPrecodeCode_Target_Offset)) = pTargetSlot;
558558

559559
BYTE* pMethodDescSlot = pageBaseRX + i + pageSize + offsetof(StubPrecodeData, SecretParam);
560-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(StubPrecodeCode_MethodDesc_Offset)) = pMethodDescSlot;
560+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(StubPrecodeCode_MethodDesc_Offset)) = pMethodDescSlot;
561561
}
562562
#else // TARGET_X86
563563
FillStubCodePage(pageBase, (const void*)PCODEToPINSTR((PCODE)StubPrecodeCode), StubPrecode::CodeSize, pageSize);
@@ -690,22 +690,22 @@ void FixupPrecode::StaticInitialize()
690690
InitializeLoaderHeapConfig(&s_fixupStubPrecodeHeapConfig, FixupPrecode::CodeSize, (void*)FixupPrecodeCodeTemplate, FixupPrecode::GenerateCodePage);
691691
}
692692

693-
void FixupPrecode::GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T pageSize)
693+
void FixupPrecode::GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t pageSize)
694694
{
695695
#ifdef TARGET_X86
696696
int totalCodeSize = (pageSize / FixupPrecode::CodeSize) * FixupPrecode::CodeSize;
697697

698698
for (int i = 0; i < totalCodeSize; i += FixupPrecode::CodeSize)
699699
{
700700
memcpy(pageBase + i, (const void*)FixupPrecodeCode, FixupPrecode::CodeSize);
701-
BYTE* pTargetSlot = pageBaseRX + i + pageSize + offsetof(FixupPrecodeData, Target);
702-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_Target_Offset)) = pTargetSlot;
701+
uint8_t* pTargetSlot = pageBaseRX + i + pageSize + offsetof(FixupPrecodeData, Target);
702+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_Target_Offset)) = pTargetSlot;
703703

704704
BYTE* pMethodDescSlot = pageBaseRX + i + pageSize + offsetof(FixupPrecodeData, MethodDesc);
705-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_MethodDesc_Offset)) = pMethodDescSlot;
705+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_MethodDesc_Offset)) = pMethodDescSlot;
706706

707707
BYTE* pPrecodeFixupThunkSlot = pageBaseRX + i + pageSize + offsetof(FixupPrecodeData, PrecodeFixupThunk);
708-
*(BYTE**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_PrecodeFixupThunk_Offset)) = pPrecodeFixupThunkSlot;
708+
*(uint8_t**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_PrecodeFixupThunk_Offset)) = pPrecodeFixupThunkSlot;
709709
}
710710
#else // TARGET_X86
711711
FillStubCodePage(pageBase, (const void*)PCODEToPINSTR((PCODE)FixupPrecodeCode), FixupPrecode::CodeSize, pageSize);

src/coreclr/vm/precode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct StubPrecode
225225
pData->Target = (PCODE)target;
226226
}
227227

228-
static void GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size);
228+
static void GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size);
229229

230230
#endif // !DACCESS_COMPILE
231231
};
@@ -428,7 +428,7 @@ struct FixupPrecode
428428

429429
static void StaticInitialize();
430430

431-
static void GenerateCodePage(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size);
431+
static void GenerateCodePage(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size);
432432

433433
PTR_FixupPrecodeData GetData() const
434434
{

0 commit comments

Comments
 (0)