mirror of
https://github.com/reactos/reactos.git
synced 2024-09-15 23:28:15 +00:00
[FREELDR]
Fix a bug in the new heap code and re-enable it. The previous problems seem to be gone. Thanks to Amine for testing. svn path=/trunk/; revision=55597
This commit is contained in:
parent
f1886c94fc
commit
ff85135725
|
@ -54,7 +54,7 @@ list(APPEND FREELDR_COMMON_SOURCE
|
|||
inifile/parse.c
|
||||
mm/meminit.c
|
||||
mm/mm.c
|
||||
mm/heap.c
|
||||
mm/heap_new.c
|
||||
reactos/registry.c
|
||||
reactos/arcname.c
|
||||
reactos/archwsup.c
|
||||
|
@ -155,7 +155,6 @@ endif()
|
|||
list(APPEND FREELDR_BASE_SOURCE
|
||||
bootmgr.c # This file is compiled with custom definitions
|
||||
freeldr.c
|
||||
rtl/bget.c
|
||||
rtl/libsupp.c)
|
||||
|
||||
if (NOT MSVC)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<file>parse.c</file>
|
||||
</directory>
|
||||
<directory name="mm">
|
||||
<file>heap.c</file>
|
||||
<file>heap_new.c</file>
|
||||
<file>meminit.c</file>
|
||||
<file>mm.c</file>
|
||||
</directory>
|
||||
|
@ -51,7 +51,6 @@
|
|||
<file>binhive.c</file>
|
||||
</directory>
|
||||
<directory name="rtl">
|
||||
<file>bget.c</file>
|
||||
<file>libsupp.c</file>
|
||||
</directory>
|
||||
<directory name="ui">
|
||||
|
|
|
@ -168,7 +168,7 @@ HeapRelease(
|
|||
if (Block->Size == 0)
|
||||
{
|
||||
/* Align the end address up to cover the end of the heap */
|
||||
EndAddress = ALIGN_DOWN_POINTER_BY(Block->Data, PAGE_SIZE);
|
||||
EndAddress = ALIGN_UP_POINTER_BY(Block->Data, PAGE_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -176,14 +176,19 @@ HeapRelease(
|
|||
EndAddress = ALIGN_DOWN_POINTER_BY(Block->Data, PAGE_SIZE);
|
||||
}
|
||||
|
||||
FreePages = (PFN_COUNT)((EndAddress - StartAddress) / MM_PAGE_SIZE);
|
||||
AllFreePages += FreePages;
|
||||
/* Check if we have free pages */
|
||||
if (EndAddress > StartAddress)
|
||||
{
|
||||
/* Calculate the size of the free region in pages */
|
||||
FreePages = (PFN_COUNT)((EndAddress - StartAddress) / MM_PAGE_SIZE);
|
||||
AllFreePages += FreePages;
|
||||
|
||||
/* Now mark the pages free */
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress,
|
||||
(ULONG_PTR)StartAddress / MM_PAGE_SIZE,
|
||||
FreePages,
|
||||
LoaderFree);
|
||||
/* Now mark the pages free */
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress,
|
||||
(ULONG_PTR)StartAddress / MM_PAGE_SIZE,
|
||||
FreePages,
|
||||
LoaderFree);
|
||||
}
|
||||
|
||||
/* bail out, if it was the last block */
|
||||
if (Block->Size == 0) break;
|
||||
|
@ -460,8 +465,6 @@ MmHeapFree(PVOID MemoryPointer)
|
|||
HeapFree(FrLdrDefaultHeap, MemoryPointer, 'pHmM');
|
||||
}
|
||||
|
||||
|
||||
#undef ExAllocatePoolWithTag
|
||||
PVOID
|
||||
NTAPI
|
||||
ExAllocatePoolWithTag(
|
||||
|
@ -481,7 +484,6 @@ ExAllocatePool(
|
|||
return HeapAllocate(FrLdrDefaultHeap, NumberOfBytes, 0);
|
||||
}
|
||||
|
||||
#undef ExFreePool
|
||||
VOID
|
||||
NTAPI
|
||||
ExFreePool(
|
||||
|
@ -490,7 +492,6 @@ ExFreePool(
|
|||
HeapFree(FrLdrDefaultHeap, P, 0);
|
||||
}
|
||||
|
||||
#undef ExFreePoolWithTag
|
||||
VOID
|
||||
NTAPI
|
||||
ExFreePoolWithTag(
|
||||
|
|
|
@ -203,7 +203,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
//BOOLEAN Status;
|
||||
|
||||
/* Cleanup heap */
|
||||
//HeapCleanupAll();
|
||||
HeapCleanupAll();
|
||||
|
||||
//
|
||||
// Creating a suitable memory map for Windows can be tricky, so let's
|
||||
|
|
Loading…
Reference in a new issue