* Eric Kohl
* Philip Susi
* Casper Hornstrup
- * Hartmut Birr
* Eric Kohl
* Ge van Geldorp
* Royce Mitchell III
#define NDEBUG
#include <internal/debug.h>
+#if defined (ALLOC_PRAGMA)
+#pragma alloc_text(INIT, MmInitMemoryAreas)
+#endif
+
/* #define VALIDATE_MEMORY_AREAS */
/* FUNCTIONS *****************************************************************/
}
/**
- * @name MmIterateFirstNode
+ * @name MmIterateLastNode
*
* @param Node
* Head node of the MEMORY_AREA tree.
}
/**
- * @name MmIterateNextNode
+ * @name MmIteratePreviousNode
*
* @param Node
* Current node in the tree.
Node != NULL;
Node = MmIterateNextNode(Node))
{
- DbgPrint("Start %p End %p Attributes %x\n",
+ DbgPrint("Start %p End %p Protect %x Flags %x\n",
Node->StartingAddress, Node->EndingAddress,
- Node->Attributes);
+ Node->Protect, Node->Flags);
}
DbgPrint("Finished MmDumpMemoryAreas()\n");
* Initialize the memory area list implementation.
*/
-NTSTATUS INIT_FUNCTION
+NTSTATUS
+INIT_FUNCTION
+NTAPI
MmInitMemoryAreas(VOID)
{
DPRINT("MmInitMemoryAreas()\n",0);
PMEMORY_AREA *ParentReplace;
ULONG_PTR Address;
PVOID EndAddress;
- PEPROCESS CurrentProcess = PsGetCurrentProcess();
+ PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
if (AddressSpace->Process != NULL &&
AddressSpace->Process != CurrentProcess)
}
else
{
- BOOL Dirty = FALSE;
+ BOOLEAN Dirty = FALSE;
SWAPENTRY SwapEntry = 0;
PFN_TYPE Page = 0;
*/
NTSTATUS STDCALL
-MmCreateMemoryArea(PEPROCESS Process,
- PMADDRESS_SPACE AddressSpace,
+MmCreateMemoryArea(PMADDRESS_SPACE AddressSpace,
ULONG Type,
PVOID *BaseAddress,
ULONG_PTR Length,
- ULONG Attributes,
+ ULONG Protect,
PMEMORY_AREA *Result,
BOOLEAN FixedAddress,
- BOOLEAN TopDown,
+ ULONG AllocationFlags,
PHYSICAL_ADDRESS BoundaryAddressMultiple)
{
PVOID EndAddress;
*BaseAddress = MmFindGap(AddressSpace,
tmpLength,
Granularity,
- TopDown != 0);
+ (AllocationFlags & MEM_TOP_DOWN) == MEM_TOP_DOWN);
if ((*BaseAddress) == 0)
{
DPRINT("No suitable gap\n");
*BaseAddress = MM_ROUND_DOWN(*BaseAddress, Granularity);
if (AddressSpace->LowestAddress == MmSystemRangeStart &&
- *BaseAddress < (PVOID)KERNEL_BASE)
+ *BaseAddress < MmSystemRangeStart)
{
CHECKPOINT;
return STATUS_ACCESS_VIOLATION;
MemoryArea->Type = Type;
MemoryArea->StartingAddress = *BaseAddress;
MemoryArea->EndingAddress = (PVOID)((ULONG_PTR)*BaseAddress + tmpLength);
- MemoryArea->Attributes = Attributes;
+ MemoryArea->Protect = Protect;
+ MemoryArea->Flags = AllocationFlags;
MemoryArea->LockCount = 0;
MemoryArea->PageOpCount = 0;
MemoryArea->DeleteInProgress = FALSE;
VOID STDCALL
-MmReleaseMemoryAreaIfDecommitted(PEPROCESS Process,
+MmReleaseMemoryAreaIfDecommitted(PROS_EPROCESS Process,
PMADDRESS_SPACE AddressSpace,
PVOID BaseAddress)
{