Author: sir_richard
Date: Tue Feb 9 03:26:46 2010
New Revision: 45519
URL: http://svn.reactos.org/svn/reactos?rev=45519&view=rev
Log:
[FREELDR]: The WinLDR code forgot to update the File Path of boot driver entries from PA to VA as well, not just the registry path. It also tried to touch the PA LoaderBlock right after enabling the MMU. It should touch the VA LoaderBlock instead, since there is no guarantee that the address has been identity mapped (and hence the PA address interpreted as a VA address by the MMU is bogus).
Modified:
trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Tue Feb 9 03:26:46 2010
@@ -316,6 +316,7 @@
// Convert the RegistryPath and DTE addresses to VA since we are not going to use it anymore
BootDriver->RegistryPath.Buffer = PaToVa(BootDriver->RegistryPath.Buffer);
+ BootDriver->FilePath.Buffer = PaToVa(BootDriver->FilePath.Buffer);
BootDriver->LdrEntry = PaToVa(BootDriver->LdrEntry);
NextBd = BootDriver->Link.Flink;
@@ -584,7 +585,7 @@
WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
/* Save final value of LoaderPagesSpanned */
- LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
+ LoaderBlockVA->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
KiSystemStartup, LoaderBlockVA);
Author: sir_richard
Date: Tue Feb 9 03:22:08 2010
New Revision: 45517
URL: http://svn.reactos.org/svn/reactos?rev=45517&view=rev
Log:
[FREELDR]: The hack to set pages from 0x100 to 0x1FF as busy so that the heap allocator wouldn't use them always restored the pages back to Free (since they usually were free on x86). However, if the pages were already being used in the first place, this made them appear free and corrupted existing memory. Fixed the hack so that it restores the previous state of the memory pages.
Modified:
trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/me…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1] Tue Feb 9 03:22:08 2010
@@ -102,8 +102,11 @@
{
ULONG PagesNeeded;
ULONG HeapStart;
-
+ MEMORY_TYPE Type;
+ PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
+
// HACK: Make it so it doesn't overlap kernel space
+ Type = RealPageLookupTable[0x100].PageAllocated;
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderSystemCode);
// Find contigious memory block for HEAP:STACK
@@ -111,7 +114,7 @@
HeapStart = MmFindAvailablePages(PageLookupTable, TotalPagesInLookupTable, PagesNeeded, FALSE);
// Unapply the hack
- MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderFree);
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, Type);
if (HeapStart == 0)
{