- NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL...
[reactos.git] / reactos / ntoskrnl / mm / marea.c
index 87fabbd..a031f64 100644 (file)
@@ -26,7 +26,6 @@
  *                  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 *****************************************************************/
@@ -105,7 +108,7 @@ static PMEMORY_AREA MmIterateNextNode(PMEMORY_AREA Node)
 }
 
 /**
- * @name MmIterateFirstNode
+ * @name MmIterateLastNode
  *
  * @param Node
  *        Head node of the MEMORY_AREA tree.
@@ -123,7 +126,7 @@ static PMEMORY_AREA MmIterateLastNode(PMEMORY_AREA Node)
 }
 
 /**
- * @name MmIterateNextNode
+ * @name MmIteratePreviousNode
  *
  * @param Node
  *        Current node in the tree.
@@ -200,9 +203,9 @@ MmDumpMemoryAreas(PMADDRESS_SPACE AddressSpace)
         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");
@@ -705,7 +708,9 @@ MmFindGapAtAddress(
  * Initialize the memory area list implementation.
  */
 
-NTSTATUS INIT_FUNCTION
+NTSTATUS
+INIT_FUNCTION
+NTAPI
 MmInitMemoryAreas(VOID)
 {
    DPRINT("MmInitMemoryAreas()\n",0);
@@ -742,7 +747,7 @@ MmFreeMemoryArea(
    PMEMORY_AREA *ParentReplace;
    ULONG_PTR Address;
    PVOID EndAddress;
-   PEPROCESS CurrentProcess = PsGetCurrentProcess();
+   PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
 
    if (AddressSpace->Process != NULL &&
        AddressSpace->Process != CurrentProcess)
@@ -761,7 +766,7 @@ MmFreeMemoryArea(
       }
       else
       {
-         BOOL Dirty = FALSE;
+         BOOLEAN Dirty = FALSE;
          SWAPENTRY SwapEntry = 0;
          PFN_TYPE Page = 0;
 
@@ -926,15 +931,14 @@ MmFreeMemoryAreaByPtr(
  */
 
 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;
@@ -957,7 +961,7 @@ MmCreateMemoryArea(PEPROCESS Process,
       *BaseAddress = MmFindGap(AddressSpace,
                                tmpLength,
                                Granularity,
-                               TopDown != 0);
+                               (AllocationFlags & MEM_TOP_DOWN) == MEM_TOP_DOWN);
       if ((*BaseAddress) == 0)
       {
          DPRINT("No suitable gap\n");
@@ -1005,7 +1009,8 @@ MmCreateMemoryArea(PEPROCESS Process,
    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;
@@ -1020,7 +1025,7 @@ MmCreateMemoryArea(PEPROCESS Process,
 
 
 VOID STDCALL
-MmReleaseMemoryAreaIfDecommitted(PEPROCESS Process,
+MmReleaseMemoryAreaIfDecommitted(PROS_EPROCESS Process,
                                  PMADDRESS_SPACE AddressSpace,
                                  PVOID BaseAddress)
 {