39 WARN(
"MmAllocateMemory() called for 0 bytes. Returning NULL.\n");
54 ERR(
"Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n",
MemorySize);
61 if (FirstFreePageFromEnd == 0)
63 ERR(
"Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n",
MemorySize);
71 MemPointer = (
PVOID)((
ULONG_PTR)FirstFreePageFromEnd * MM_PAGE_SIZE);
73 TRACE(
"Allocated %d bytes (%d pages) of memory (type %ld) starting at page 0x%lx.\n",
74 MemorySize, PagesNeeded, MemoryType, FirstFreePageFromEnd);
75 TRACE(
"Memory allocation pointer: 0x%x\n", MemPointer);
93 WARN(
"MmAllocateMemoryAtAddress() called for 0 bytes. Returning NULL.\n");
94 UiMessageBoxCritical(
"Memory allocation failed: MmAllocateMemoryAtAddress() called for 0 bytes.");
109 ERR(
"Memory allocation failed in MmAllocateMemoryAtAddress(). "
110 "Not enough free memory to allocate %d bytes (requesting %d pages but have only %d). "
118 WARN(
"Memory allocation failed in MmAllocateMemoryAtAddress(). "
119 "Not enough free memory to allocate %d bytes at address %p.\n",
133 TRACE(
"Allocated %d bytes (%d pages) of memory starting at page %d.\n",
MemorySize, PagesNeeded, StartPageNumber);
134 TRACE(
"Memory allocation pointer: 0x%x\n", MemPointer);
169 WARN(
"MmAllocateHighestMemoryBelowAddress() called for 0 bytes. Returning NULL.\n");
170 UiMessageBoxCritical(
"Memory allocation failed: MmAllocateHighestMemoryBelowAddress() called for 0 bytes.");
179 DesiredAddressPageNumber = (
ULONG_PTR)DesiredAddress / MM_PAGE_SIZE;
185 ERR(
"Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n",
MemorySize);
192 if (FirstFreePageFromEnd == 0)
194 ERR(
"Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n",
MemorySize);
202 MemPointer = (
PVOID)((
ULONG_PTR)FirstFreePageFromEnd * MM_PAGE_SIZE);
204 TRACE(
"Allocated %d bytes (%d pages) of memory starting at page %d.\n",
MemorySize, PagesNeeded, FirstFreePageFromEnd);
205 TRACE(
"Memory allocation pointer: 0x%x\n", MemPointer);
226 DbgPrint(
"----------- Memory Allocation Bitmap -----------\n");
233 DbgPrint(
"%08x:\t", (Idx * MM_PAGE_SIZE));
235 else if ((Idx % 4) == 0)
240 switch (RealPageLookupTable[Idx].PageAllocated)
303 return RealPageLookupTable;
#define DBG_DEFAULT_CHANNEL(ch)
PVOID PageLookupTableAddress
struct PAGE_LOOKUP_TABLE_ITEM * PPAGE_LOOKUP_TABLE_ITEM
PFN_NUMBER TotalPagesInLookupTable
PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address)
PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, BOOLEAN FromEnd)
PFN_NUMBER FreePagesInLookupTable
PFN_NUMBER MmFindAvailablePagesBeforePage(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, PFN_NUMBER LastPage)
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY MemoryType)
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PVOID PageAddress, PFN_NUMBER PageCount)
VOID UiMessageBoxCritical(_In_ PCSTR MessageText)
#define ROUND_UP(n, align)
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
VOID MmFreeMemory(PVOID MemoryPointer)
VOID MmSetMemoryType(PVOID MemoryAddress, SIZE_T MemorySize, TYPE_OF_MEMORY NewType)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
PFN_NUMBER LoaderPagesSpanned
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(PFN_NUMBER *NoEntries)
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
@ LoaderFirmwareTemporary
@ LoaderFirmwarePermanent
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
static CONST DWORD MemorySize[]
VOID DumpMemoryAllocMap(VOID)