https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bed8b2a0a6ebab75d678b…
commit bed8b2a0a6ebab75d678be9a5e59c15b427f159a
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Wed May 24 14:16:23 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Oct 17 18:31:32 2024 +0300
[FREELDR][NDK][X64] Remove KIP0PCRADDRESS definition and mapping
It is not used by either ReactOS or Windows.
---
boot/freeldr/freeldr/include/arch/amd64/amd64.h | 4 ----
boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c | 27 +++++++++----------------
sdk/include/ndk/amd64/ketypes.h | 11 ----------
3 files changed, 10 insertions(+), 32 deletions(-)
diff --git a/boot/freeldr/freeldr/include/arch/amd64/amd64.h
b/boot/freeldr/freeldr/include/arch/amd64/amd64.h
index 17d6214c1a8..c3ffa40856b 100644
--- a/boot/freeldr/freeldr/include/arch/amd64/amd64.h
+++ b/boot/freeldr/freeldr/include/arch/amd64/amd64.h
@@ -22,10 +22,6 @@
#pragma once
#endif
-// This is needed because headers define wrong one for ReactOS
-#undef KIP0PCRADDRESS
-#define KIP0PCRADDRESS 0xFFFFF78000001000ULL /* FIXME!!! */
-
#define VA_MASK 0x0000FFFFFFFFFFFFUL
#define PtrToPfn(p) \
diff --git a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c
b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c
index a5fc5a0fc53..174bacd62a9 100644
--- a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c
+++ b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c
@@ -24,7 +24,7 @@ PHARDWARE_PTE PxeBase;
//PHARDWARE_PTE HalPageTable;
PVOID GdtIdt;
-ULONG_PTR PcrBasePage;
+PFN_NUMBER SharedUserDataPfn;
ULONG_PTR TssBasePage;
/* FUNCTIONS **************************************************************/
@@ -246,15 +246,8 @@ WinLdrMapSpecialPages(VOID)
{
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 */
- 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");
return FALSE;
@@ -380,22 +373,22 @@ WinLdrSetProcessorContext(
void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- ULONG_PTR Pcr = 0;
+ PVOID SharedUserDataAddress = NULL;
ULONG_PTR Tss = 0;
ULONG BlockSize, NumPages;
LoaderBlock->u.I386.CommonDataArea = (PVOID)DbgPrint; // HACK
LoaderBlock->u.I386.MachineType = MACHINE_TYPE_ISA;
- /* Allocate 2 pages for PCR */
- Pcr = (ULONG_PTR)MmAllocateMemoryWithType(2 * MM_PAGE_SIZE, LoaderStartupPcrPage);
- PcrBasePage = Pcr >> MM_PAGE_SHIFT;
- if (Pcr == 0)
+ /* Allocate 1 page for SharedUserData */
+ SharedUserDataAddress = MmAllocateMemoryWithType(MM_PAGE_SIZE,
LoaderStartupPcrPage);
+ SharedUserDataPfn = (ULONG_PTR)SharedUserDataAddress >> MM_PAGE_SHIFT;
+ if (SharedUserDataAddress == NULL)
{
- UiMessageBox("Can't allocate PCR.");
+ UiMessageBox("Can't allocate SharedUserData page.");
return;
}
- RtlZeroMemory((PVOID)Pcr, 2 * MM_PAGE_SIZE);
+ RtlZeroMemory(SharedUserDataAddress, MM_PAGE_SIZE);
/* Allocate TSS */
BlockSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1);
@@ -422,7 +415,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
// FIXME: bugcheck
}
- /* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */
+ /* Map KI_USER_SHARED_DATA, Apic and HAL space */
WinLdrMapSpecialPages();
}
diff --git a/sdk/include/ndk/amd64/ketypes.h b/sdk/include/ndk/amd64/ketypes.h
index 7cdc94fb32e..410e0b55cb0 100644
--- a/sdk/include/ndk/amd64/ketypes.h
+++ b/sdk/include/ndk/amd64/ketypes.h
@@ -80,17 +80,6 @@ Author:
#define KF_FPU_LEAKAGE_BIT 41 // From ksamd64.inc (0x29 ->
0x20000000000)
#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
//