26 #define FREELDR_SECTION_COUNT 2
29 #define FREELDR_SECTION_COUNT 3
34#define FREELDR_SECTION_COUNT 4
37#define FREELDR_SECTION_COUNT 3
49#if defined(__i386__) || defined(_PPC_) || defined(_MIPS_) || defined(_ARM_)
51#define MM_PAGE_SIZE 4096
52#define MM_PAGE_MASK 0xFFF
53#define MM_PAGE_SHIFT 12
55#define MM_MAX_PAGE 0x3FFFFFF
57#define MM_MAX_PAGE 0xFFFFF
59#define MM_MAX_PAGE_LOADER 0xFFFFF
61#define MM_SIZE_TO_PAGES(a) \
62 ( ((a) >> MM_PAGE_SHIFT) + ((a) & MM_PAGE_MASK ? 1 : 0) )
68#define MM_PAGE_SIZE 4096
69#define MM_PAGE_MASK 0xFFF
70#define MM_PAGE_SHIFT 12
71#define MM_MAX_PAGE 0xFFFFFFFFF
72#define MM_MAX_PAGE_LOADER 0x3FFFF
74#define MM_SIZE_TO_PAGES(a) \
75 ( ((a) >> MM_PAGE_SHIFT) + ((a) & MM_PAGE_MASK ? 1 : 0) )
80#define HEAP_PAGES 0x400
81#define STACK_PAGES 0x00
96#define DUMP_MEM_MAP_ON_VERIFY 0
133#define DEFAULT_HEAP_SIZE (1024 * 1024)
134#define TEMP_HEAP_SIZE (32 * 1024 * 1024)
PVOID PageLookupTableAddress
VOID FrLdrHeapDestroy(PVOID HeapHandle)
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
struct _FREELDR_MEMORY_DESCRIPTOR * PFREELDR_MEMORY_DESCRIPTOR
PVOID MmAllocateMemory(SIZE_T MemorySize)
PFN_NUMBER MmGetAddressablePageCountIncludingHoles(VOID)
VOID MmFreeMemory(PVOID MemoryPointer)
VOID FrLdrHeapFreeEx(PVOID HeapHandle, PVOID Pointer, ULONG Tag)
VOID MmSetMemoryType(PVOID MemoryAddress, SIZE_T MemorySize, TYPE_OF_MEMORY NewType)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
struct PAGE_LOOKUP_TABLE_ITEM * PPAGE_LOOKUP_TABLE_ITEM
PFN_NUMBER TotalPagesInLookupTable
PVOID FrLdrHeapAllocateEx(PVOID HeapHandle, SIZE_T ByteSize, ULONG Tag)
PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address)
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY PageAllocated)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, BOOLEAN FromEnd)
BOOLEAN MmInitializeMemoryManager(VOID)
VOID MmInitPageLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
PFN_NUMBER MmCountFreePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
VOID MmInitializeHeap(PVOID PageLookupTable)
VOID FrLdrHeapRelease(PVOID HeapHandle)
PFN_NUMBER FreePagesInLookupTable
PFN_NUMBER MmFindAvailablePagesBeforePage(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, PFN_NUMBER LastPage)
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount)
PFN_NUMBER LastFreePageHint
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(PFN_NUMBER *NoEntries)
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
PVOID FrLdrHeapCreate(SIZE_T MaximumSize, TYPE_OF_MEMORY MemoryType)
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 FrLdrHeapVerify(PVOID HeapHandle)
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
VOID FrLdrHeapCleanupAll(VOID)
struct _FREELDR_MEMORY_DESCRIPTOR FREELDR_MEMORY_DESCRIPTOR
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
PFN_NUMBER PageAllocationLength
TYPE_OF_MEMORY PageAllocated
TYPE_OF_MEMORY MemoryType
static CONST DWORD MemorySize[]
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
int WINAPI StartPage(_In_ HDC)
_Must_inspect_result_ _In_ SIZE_T _In_ PVOID PageAddress
_IRQL_requires_same_ _In_ CLONG ByteSize