- Merge from trunk up to r45543
[reactos.git] / boot / freeldr / freeldr / mm / meminit.c
index e3e62c8..f59a43f 100644 (file)
@@ -102,8 +102,11 @@ VOID MmInitializeHeap(PVOID PageLookupTable)
 {
        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 @@ VOID MmInitializeHeap(PVOID PageLookupTable)
        HeapStart = MmFindAvailablePages(PageLookupTable, TotalPagesInLookupTable, PagesNeeded, FALSE);
 
        // Unapply the hack
-       MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderFree);
+       MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, Type);
 
        if (HeapStart == 0)
        {