typedef ULONG SWAPENTRY;
typedef ULONG PFN_TYPE, *PPFN_TYPE;
+#define MI_STATIC_MEMORY_AREAS (1)
+
#define MEMORY_AREA_INVALID (0)
#define MEMORY_AREA_SECTION_VIEW (1)
#define MEMORY_AREA_CONTINUOUS_MEMORY (2)
#define MEMORY_AREA_PAGED_POOL (12)
#define MEMORY_AREA_NO_ACCESS (13)
#define MEMORY_AREA_PEB_OR_TEB (14)
+#define MEMORY_AREA_STATIC (0x80000000)
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
#pragma alloc_text(INIT, MmInitMemoryAreas)
#endif
+MEMORY_AREA MiStaticMemoryAreas[MI_STATIC_MEMORY_AREAS];
+ULONG MiStaticMemoryAreaCount;
+
/* #define VALIDATE_MEMORY_AREAS */
/* FUNCTIONS *****************************************************************/
return STATUS_CONFLICTING_ADDRESSES;
}
}
-
- MemoryArea = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
- TAG_MAREA);
+
+ //
+ // Is this a static memory area?
+ //
+ if (Type & MEMORY_AREA_STATIC)
+ {
+ //
+ // Use the static array instead of the pool
+ //
+ ASSERT(MiStaticMemoryAreaCount < MI_STATIC_MEMORY_AREAS);
+ MemoryArea = &MiStaticMemoryAreas[MiStaticMemoryAreaCount++];
+ }
+ else
+ {
+ //
+ // Allocate the memory area from nonpaged pool
+ //
+ MemoryArea = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(MEMORY_AREA),
+ TAG_MAREA);
+ }
+
RtlZeroMemory(MemoryArea, sizeof(MEMORY_AREA));
MemoryArea->Type = Type;
MemoryArea->StartingAddress = *BaseAddress;