[FREELDR][NDK][X64] Remove KIP0PCRADDRESS definition and mapping

It is not used by either ReactOS or Windows.
This commit is contained in:
Timo Kreuzer 2023-05-24 14:16:23 +03:00
parent 4e5e72fa12
commit bed8b2a0a6
3 changed files with 10 additions and 32 deletions

View file

@ -22,10 +22,6 @@
#pragma once #pragma once
#endif #endif
// This is needed because headers define wrong one for ReactOS
#undef KIP0PCRADDRESS
#define KIP0PCRADDRESS 0xFFFFF78000001000ULL /* FIXME!!! */
#define VA_MASK 0x0000FFFFFFFFFFFFUL #define VA_MASK 0x0000FFFFFFFFFFFFUL
#define PtrToPfn(p) \ #define PtrToPfn(p) \

View file

@ -24,7 +24,7 @@ PHARDWARE_PTE PxeBase;
//PHARDWARE_PTE HalPageTable; //PHARDWARE_PTE HalPageTable;
PVOID GdtIdt; PVOID GdtIdt;
ULONG_PTR PcrBasePage; PFN_NUMBER SharedUserDataPfn;
ULONG_PTR TssBasePage; ULONG_PTR TssBasePage;
/* FUNCTIONS **************************************************************/ /* FUNCTIONS **************************************************************/
@ -246,15 +246,8 @@ WinLdrMapSpecialPages(VOID)
{ {
PHARDWARE_PTE PpeBase, PdeBase; PHARDWARE_PTE PpeBase, PdeBase;
/* Map the PCR page */
if (!MempMapSinglePage(KIP0PCRADDRESS, PcrBasePage * PAGE_SIZE))
{
ERR("Could not map PCR @ %lx\n", PcrBasePage);
return FALSE;
}
/* Map KI_USER_SHARED_DATA */ /* Map KI_USER_SHARED_DATA */
if (!MempMapSinglePage(KI_USER_SHARED_DATA, (PcrBasePage+1) * PAGE_SIZE)) if (!MempMapSinglePage(KI_USER_SHARED_DATA, SharedUserDataPfn * PAGE_SIZE))
{ {
ERR("Could not map KI_USER_SHARED_DATA\n"); ERR("Could not map KI_USER_SHARED_DATA\n");
return FALSE; return FALSE;
@ -380,22 +373,22 @@ WinLdrSetProcessorContext(
void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock) void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
{ {
ULONG_PTR Pcr = 0; PVOID SharedUserDataAddress = NULL;
ULONG_PTR Tss = 0; ULONG_PTR Tss = 0;
ULONG BlockSize, NumPages; ULONG BlockSize, NumPages;
LoaderBlock->u.I386.CommonDataArea = (PVOID)DbgPrint; // HACK LoaderBlock->u.I386.CommonDataArea = (PVOID)DbgPrint; // HACK
LoaderBlock->u.I386.MachineType = MACHINE_TYPE_ISA; LoaderBlock->u.I386.MachineType = MACHINE_TYPE_ISA;
/* Allocate 2 pages for PCR */ /* Allocate 1 page for SharedUserData */
Pcr = (ULONG_PTR)MmAllocateMemoryWithType(2 * MM_PAGE_SIZE, LoaderStartupPcrPage); SharedUserDataAddress = MmAllocateMemoryWithType(MM_PAGE_SIZE, LoaderStartupPcrPage);
PcrBasePage = Pcr >> MM_PAGE_SHIFT; SharedUserDataPfn = (ULONG_PTR)SharedUserDataAddress >> MM_PAGE_SHIFT;
if (Pcr == 0) if (SharedUserDataAddress == NULL)
{ {
UiMessageBox("Can't allocate PCR."); UiMessageBox("Can't allocate SharedUserData page.");
return; return;
} }
RtlZeroMemory((PVOID)Pcr, 2 * MM_PAGE_SIZE); RtlZeroMemory(SharedUserDataAddress, MM_PAGE_SIZE);
/* Allocate TSS */ /* Allocate TSS */
BlockSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1); BlockSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1);
@ -422,7 +415,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
// FIXME: bugcheck // FIXME: bugcheck
} }
/* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */ /* Map KI_USER_SHARED_DATA, Apic and HAL space */
WinLdrMapSpecialPages(); WinLdrMapSpecialPages();
} }

View file

@ -80,17 +80,6 @@ Author:
#define KF_FPU_LEAKAGE_BIT 41 // From ksamd64.inc (0x29 -> 0x20000000000) #define KF_FPU_LEAKAGE_BIT 41 // From ksamd64.inc (0x29 -> 0x20000000000)
#define KF_CAT_BIT 44 // From ksamd64.inc (0x2C -> 0x100000000000) #define KF_CAT_BIT 44 // From ksamd64.inc (0x2C -> 0x100000000000)
//
// KPCR Access for non-IA64 builds
//
//#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
//#define PCR ((volatile KPCR * const)K0IPCR)
#define PCR ((volatile KPCR * const)__readgsqword(FIELD_OFFSET(KPCR, Self)))
//#if defined(CONFIG_SMP) || defined(NT_BUILD)
//#undef KeGetPcr
//#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
//#endif
// //
// Double fault stack size // Double fault stack size
// //