From cb837e18a15959465b217103bde9da119ce42327 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 4 Feb 2012 21:53:09 +0000 Subject: [PATCH] [FREELDR] - Don't map the low 1 MB into kernel space, it's pointless and leads to inconsistencies between reported memory type and what is found in the page tables. On x86 it works, because it uses an overcomplicated pfn initialization wih redundent checks. Anyway this memory, containing freeldr and real mode code, was simply wasted. - Silence some debug prints - Fix warnings svn path=/trunk/; revision=55421 --- reactos/boot/freeldr/freeldr/arch/amd64/winldr.c | 6 +++--- reactos/boot/freeldr/freeldr/windows/winldr.c | 3 ++- reactos/boot/freeldr/freeldr/windows/wlmemory.c | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/winldr.c b/reactos/boot/freeldr/freeldr/arch/amd64/winldr.c index 299a491223b..14b4a2e062c 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/winldr.c +++ b/reactos/boot/freeldr/freeldr/arch/amd64/winldr.c @@ -236,7 +236,7 @@ WinLdrpMapApic() BOOLEAN WinLdrMapSpecialPages() { - PHARDWARE_PTE PpeBase, PdeBase, PteBase; + PHARDWARE_PTE PpeBase, PdeBase; /* Map the PCR page */ if (!MempMapSinglePage(KIP0PCRADDRESS, PcrBasePage * PAGE_SIZE)) @@ -308,7 +308,7 @@ Amd64SetupGdt(PVOID GdtBase, ULONG64 TssBase) /* Set the new Gdt */ __lgdt(&GdtDesc.Limit); - DbgPrint("Gdtr.Base = %p, num = %ld\n", GdtDesc.Base, NUM_GDT); + TRACE("Gdtr.Base = %p, num = %ld\n", GdtDesc.Base, NUM_GDT); } @@ -329,7 +329,7 @@ Amd64SetupIdt(PVOID IdtBase) /* Set the new IDT */ __lidt(&IdtDesc.Limit); - DbgPrint("Idtr.Base = %p\n", IdtDesc.Base); + TRACE("Idtr.Base = %p\n", IdtDesc.Base); } diff --git a/reactos/boot/freeldr/freeldr/windows/winldr.c b/reactos/boot/freeldr/freeldr/windows/winldr.c index 3218e1bcf6d..d13f28db468 100644 --- a/reactos/boot/freeldr/freeldr/windows/winldr.c +++ b/reactos/boot/freeldr/freeldr/windows/winldr.c @@ -91,7 +91,8 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock, CHAR HalPath[] = "\\"; CHAR ArcBoot[256]; CHAR MiscFiles[256]; - ULONG i, PathSeparator; + ULONG i; + ULONG_PTR PathSeparator; PLOADER_PARAMETER_EXTENSION Extension; /* Construct SystemRoot and ArcBoot from SystemPath */ diff --git a/reactos/boot/freeldr/freeldr/windows/wlmemory.c b/reactos/boot/freeldr/freeldr/windows/wlmemory.c index 1ae96bcc397..d5492a8376d 100644 --- a/reactos/boot/freeldr/freeldr/windows/wlmemory.c +++ b/reactos/boot/freeldr/freeldr/windows/wlmemory.c @@ -200,7 +200,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock) PPAGE_LOOKUP_TABLE_ITEM MemoryMap; ULONG NoEntries; //PKTSS Tss; - BOOLEAN Status; + //BOOLEAN Status; // // Creating a suitable memory map for the Windows can be tricky, so let's @@ -241,7 +241,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock) MemoryMapSizeInPages = (NoEntries * sizeof(PAGE_LOOKUP_TABLE_ITEM) + MM_PAGE_SIZE - 1) / MM_PAGE_SIZE; TRACE("Got memory map with %d entries\n", NoEntries); - +#if 0 // Always contiguously map low 1Mb of memory Status = MempSetupPaging(0, 0x100, FALSE); if (!Status) @@ -249,7 +249,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock) ERR("Error during MempSetupPaging of low 1Mb\n"); return FALSE; } - +#endif // Construct a good memory map from what we've got, // but mark entries which the memory allocation bitmap takes // as free entries (this is done in order to have the ability @@ -412,4 +412,3 @@ WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, return; } -