From: Serge Gautherie Date: Mon, 30 Jan 2017 09:47:38 +0100 Subject: [FREELDR] lib/mm/: *Reuse DUMP_MEM_MAP_ON_VERIFY definition, remnant since r32031. *MmFreeMemory(): Add "UNIMPLEMENTED;" and related FIXME comment. CORE-12724 diff --git a/reactos/boot/freeldr/freeldr/include/mm.h b/reactos/boot/freeldr/freeldr/include/mm.h index d9ada75..e8d6687 100644 --- a/reactos/boot/freeldr/freeldr/include/mm.h +++ b/reactos/boot/freeldr/freeldr/include/mm.h @@ -78,12 +78,14 @@ typedef struct } PAGE_LOOKUP_TABLE_ITEM, *PPAGE_LOOKUP_TABLE_ITEM; #include +#if DBG // -// Define this to 1 if you want the entire contents +// Define this if you want the entire content // of the memory allocation bitmap displayed // when a chunk is allocated or freed // -#define DUMP_MEM_MAP_ON_VERIFY 0 +// #define DUMP_MEM_MAP_ON_ALLOC_FREE +#endif extern PVOID PageLookupTableAddress; extern PFN_NUMBER TotalPagesInLookupTable; diff --git a/reactos/boot/freeldr/freeldr/lib/mm/mm.c b/reactos/boot/freeldr/freeldr/lib/mm/mm.c index a2b49b3..fb2364c 100644 --- a/reactos/boot/freeldr/freeldr/lib/mm/mm.c +++ b/reactos/boot/freeldr/freeldr/lib/mm/mm.c @@ -73,6 +73,9 @@ PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType) TRACE("Allocated %d bytes (%d pages) of memory (type %ld) starting at page 0x%lx.\n", MemorySize, PagesNeeded, MemoryType, FirstFreePageFromEnd); TRACE("Memory allocation pointer: 0x%x\n", MemPointer); +#if DBG && defined(DUMP_MEM_MAP_ON_ALLOC_FREE) + DumpMemoryAllocMap(); +#endif // Update LoaderPagesSpanned count if ((((ULONG_PTR)MemPointer + MemorySize + PAGE_SIZE - 1) >> PAGE_SHIFT) > LoaderPagesSpanned) @@ -132,6 +135,9 @@ PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF TRACE("Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, StartPageNumber); TRACE("Memory allocation pointer: 0x%x\n", MemPointer); +#if DBG && defined(DUMP_MEM_MAP_ON_ALLOC_FREE) + DumpMemoryAllocMap(); +#endif // Update LoaderPagesSpanned count if ((((ULONG_PTR)MemPointer + MemorySize + PAGE_SIZE - 1) >> PAGE_SHIFT) > LoaderPagesSpanned) @@ -203,6 +209,9 @@ PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddres TRACE("Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd); TRACE("Memory allocation pointer: 0x%x\n", MemPointer); +#if DBG && defined(DUMP_MEM_MAP_ON_ALLOC_FREE) + DumpMemoryAllocMap(); +#endif // Update LoaderPagesSpanned count if ((((ULONG_PTR)MemPointer + MemorySize) >> PAGE_SHIFT) > LoaderPagesSpanned) @@ -214,6 +223,15 @@ PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddres VOID MmFreeMemory(PVOID MemoryPointer) { + // FIXME: Actual code was removed in r32031. (See CORE-12725.) + UNIMPLEMENTED; + +// Disabled, until memory is actually freed. +#if 0 +#if DBG && defined(DUMP_MEM_MAP_ON_ALLOC_FREE) + DumpMemoryAllocMap(); +#endif +#endif } #if DBG