[NTOS]: Reimplement MmCreateProcessAddressSpace in ARM3. Basically the same as before...
[reactos.git] / reactos / ntoskrnl / mm / i386 / pagepae.c
index 5e13e78..e05f7ed 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id: page.c 32364 2008-02-14 20:30:31Z ros-arm-bringup $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/i386/page.c
@@ -12,7 +11,7 @@
 
 #include <ntoskrnl.h>
 #define NDEBUG
-#include <internal/debug.h>
+#include <debug.h>
 
 #if defined (ALLOC_PRAGMA)
 #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory)
@@ -79,11 +78,11 @@ ULONG_PTR
 NTAPI
 MiFlushTlbIpiRoutine(ULONG_PTR Address)
 {
-   if (Address == (ULONG_PTR)-1)
+   if (Address == (ULONGLONG)-1)
    {
       KeFlushCurrentTb();
    }
-   else if (Address == (ULONG_PTR)-2)
+   else if (Address == (ULONGLONG)-2)
    {
       KeFlushCurrentTb();
    }
@@ -146,7 +145,7 @@ ProtectToPTE(ULONG flProtect)
    else
    {
       DPRINT1("Unknown main protection type.\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Ke386NoExecute &&
        !(flProtect & PAGE_IS_EXECUTABLE))
@@ -342,14 +341,14 @@ MmInitializeHandBuiltProcess(IN PEPROCESS Process,
 }
 
 BOOLEAN
-STDCALL
+NTAPI
 MmCreateProcessAddressSpace(IN ULONG MinWs,
                             IN PEPROCESS Process,
                             IN PLARGE_INTEGER DirectoryTableBase)
 {
    NTSTATUS Status;
    ULONG i, j;
-   PFN_TYPE Pfn[7];
+   PFN_NUMBER Pfn[7];
    ULONG Count;
 
    DPRINT("MmCopyMmInfo(Src %x, Dest %x)\n", MinWs, Process);
@@ -445,7 +444,7 @@ MmDeletePageTable(PEPROCESS Process, PVOID Address)
    }
    if (Address >= MmSystemRangeStart)
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
       //       MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
    }
    if (Process != NULL && Process != CurrentProcess)
@@ -460,7 +459,7 @@ MmFreePageTable(PEPROCESS Process, PVOID Address)
 {
    PEPROCESS CurrentProcess = PsGetCurrentProcess();
    ULONG i;
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
 
    DPRINT("ProcessId %d, Address %x\n", Process->UniqueProcessId, Address);
    if (Process != NULL && Process != CurrentProcess)
@@ -478,7 +477,7 @@ MmFreePageTable(PEPROCESS Process, PVOID Address)
          {
             DbgPrint("Page table entry not clear at %x/%x (is %I64x)\n",
                      ((ULONG)Address / (4*1024*1024)), i, PageTable[i]);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
       }
       Pfn = PAE_PTE_TO_PFN(*(PAE_ADDR_TO_PDE(Address)));
@@ -495,7 +494,7 @@ MmFreePageTable(PEPROCESS Process, PVOID Address)
          {
             DbgPrint("Page table entry not clear at %x/%x (is %x)\n",
                      ((ULONG)Address / (4*1024*1024)), i, PageTable[i]);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
       }
       Pfn = PTE_TO_PFN(*(ADDR_TO_PDE(Address)));
@@ -506,7 +505,7 @@ MmFreePageTable(PEPROCESS Process, PVOID Address)
    if (Address >= MmSystemRangeStart)
    {
       //    MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    else
    {
@@ -522,7 +521,7 @@ static PULONGLONG
 MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
 {
    NTSTATUS Status;
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
    ULONGLONG Entry;
    ULONGLONG ZeroEntry = 0LL;
    PULONGLONG Pt;
@@ -533,20 +532,20 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
           Process, Address, Create);
    if (Address >= (PVOID)PAGETABLE_MAP && Address < (PVOID)((ULONG_PTR)PAGETABLE_MAP + 0x800000))
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
    {
       PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
       if (PageDirTable == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       PageDir = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(PageDirTable[PAE_ADDR_TO_PDTE_OFFSET(Address)]));
       MmDeleteHyperspaceMapping(PageDirTable);
       if (PageDir == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       PageDir += PAE_ADDR_TO_PDE_PAGE_OFFSET(Address);
       Entry = ExfInterlockedCompareExchange64UL(PageDir, &ZeroEntry, &ZeroEntry);
@@ -560,7 +559,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
          Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
         if (!NT_SUCCESS(Status))
         {
-           KEBUGCHECK(0);
+           ASSERT(FALSE);
         }
          Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER;
         Entry = ExfInterlockedCompareExchange64UL(PageDir, &Entry, &ZeroEntry);
@@ -578,7 +577,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
       Pt = MmCreateHyperspaceMapping(Pfn);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       return Pt + PAE_ADDR_TO_PTE_OFFSET(Address);
    }
@@ -596,7 +595,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
             Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
            if (!NT_SUCCESS(Status))
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
            Entry = PAE_PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE;
             if (Ke386GlobalPagesEnabled)
@@ -619,7 +618,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
          Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
         if (!NT_SUCCESS(Status))
         {
-           KEBUGCHECK(0);
+           ASSERT(FALSE);
         }
         Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER;
          Entry = ExfInterlockedCompareExchange64UL(PageDir, &Entry, &ZeroEntry);
@@ -637,7 +636,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
 {
    ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address);
    NTSTATUS Status;
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
    ULONG Entry;
    PULONG Pt, PageDir;
 
@@ -646,7 +645,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
       PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.LowPart));
       if (PageDir == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       if (0 == InterlockedCompareExchangeUL(&PageDir[PdeOffset], 0, 0))
       {
@@ -658,7 +657,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
          Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
         if (!NT_SUCCESS(Status) || Pfn == 0)
         {
-           KEBUGCHECK(0);
+           ASSERT(FALSE);
         }
          Entry = InterlockedCompareExchangeUL(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
         if (Entry != 0)
@@ -675,7 +674,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
       Pt = MmCreateHyperspaceMapping(Pfn);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       return Pt + ADDR_TO_PTE_OFFSET(Address);
    }
@@ -693,7 +692,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
             Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
            if (!NT_SUCCESS(Status) || Pfn == 0)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
            Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE;
             if (Ke386GlobalPagesEnabled)
@@ -716,7 +715,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
          Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
         if (!NT_SUCCESS(Status) || Pfn == 0)
         {
-           KEBUGCHECK(0);
+           ASSERT(FALSE);
         }
          Entry = InterlockedCompareExchangeUL(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
         if (Entry != 0)
@@ -781,7 +780,7 @@ static ULONG MmGetPageEntryForProcess(PEPROCESS Process, PVOID Address)
    return 0;
 }
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmGetPfnForProcess(PEPROCESS Process,
                    PVOID Address)
@@ -811,7 +810,7 @@ MmGetPfnForProcess(PEPROCESS Process,
 
 VOID
 NTAPI
-MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
+MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_NUMBER Page)
 /*
  * FUNCTION: Delete a virtual mapping
  */
@@ -826,7 +825,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
       Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       /*
        * Atomically disable the present bit and get the old value.
@@ -841,7 +840,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
       WasValid = PAE_PAGE_MASK(Pte) != 0LL ? TRUE : FALSE;
       if (!WasValid)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       /*
@@ -864,7 +863,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
       Pt = MmGetPageTableForProcess(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       /*
        * Atomically disable the present bit and get the old value.
@@ -878,7 +877,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
       WasValid = (PAGE_MASK(Pte) != 0);
       if (!WasValid)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       /*
@@ -932,13 +931,13 @@ MmRawDeleteVirtualMapping(PVOID Address)
 VOID
 NTAPI
 MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage,
-                       BOOLEAN* WasDirty, PPFN_TYPE Page)
+                       BOOLEAN* WasDirty, PPFN_NUMBER Page)
 /*
  * FUNCTION: Delete a virtual mapping
  */
 {
    BOOLEAN WasValid = FALSE;
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
 
    DPRINT("MmDeleteVirtualMapping(%x, %x, %d, %x, %x)\n",
           Process, Address, FreePage, WasDirty, Page);
@@ -1233,7 +1232,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
    if (Address < MmSystemRangeStart && Process == NULL)
    {
       DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Ke386Pae)
    {
@@ -1244,7 +1243,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1272,7 +1271,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcess(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1300,7 +1299,7 @@ MmSetCleanPage(PEPROCESS Process, PVOID Address)
    if (Address < MmSystemRangeStart && Process == NULL)
    {
       DPRINT1("MmSetCleanPage is called for user space without a process.\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Ke386Pae)
    {
@@ -1312,7 +1311,7 @@ MmSetCleanPage(PEPROCESS Process, PVOID Address)
 
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1339,7 +1338,7 @@ MmSetCleanPage(PEPROCESS Process, PVOID Address)
 
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1365,7 +1364,7 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address)
    if (Address < MmSystemRangeStart && Process == NULL)
    {
       DPRINT1("MmSetDirtyPage is called for user space without a process.\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Ke386Pae)
    {
@@ -1376,7 +1375,7 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1401,7 +1400,7 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcess(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1432,7 +1431,7 @@ MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1457,7 +1456,7 @@ MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
       Pt = MmGetPageTableForProcess(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
 
       do
@@ -1511,7 +1510,7 @@ NTSTATUS
 NTAPI
 MmCreateVirtualMappingForKernel(PVOID Address,
                                 ULONG flProtect,
-                                PPFN_TYPE Pages,
+                                PPFN_NUMBER Pages,
                                ULONG PageCount)
 {
    ULONG Attributes;
@@ -1526,7 +1525,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
    if (Address < MmSystemRangeStart)
    {
       DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
 
    Attributes = ProtectToPTE(flProtect);
@@ -1555,7 +1554,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
             DPRINT1("Setting physical address but not allowing access at address "
                     "0x%.8X with attributes %x/%x.\n",
                     Addr, Attributes, flProtect);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
 
          PdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr);
@@ -1564,7 +1563,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
             Pt = MmGetPageTableForProcessForPAE(NULL, Addr, TRUE);
            if (Pt == NULL)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
          else
@@ -1581,7 +1580,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
          Pte = ExfpInterlockedExchange64UL(Pt, &Pte);
          if (Pte != 0LL)
          {
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
       }
    }
@@ -1594,7 +1593,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
       Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       Pt--;
 
@@ -1605,7 +1604,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
             DPRINT1("Setting physical address but not allowing access at address "
                     "0x%.8X with attributes %x/%x.\n",
                     Addr, Attributes, flProtect);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
 
          PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
@@ -1614,7 +1613,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
             Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
            if (Pt == NULL)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
          else
@@ -1626,7 +1625,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
          Pte = *Pt;
          if (Pte != 0)
          {
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
          (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes);
       }
@@ -1644,16 +1643,16 @@ MmCreatePageFileMapping(PEPROCESS Process,
    if (Process == NULL && Address < MmSystemRangeStart)
    {
       DPRINT1("No process\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Process != NULL && Address >= MmSystemRangeStart)
    {
       DPRINT1("Setting kernel address with process context\n");
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (SwapEntry & (1 << 31))
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
 
    if (Ke386Pae)
@@ -1665,7 +1664,7 @@ MmCreatePageFileMapping(PEPROCESS Process,
       Pt = MmGetPageTableForProcessForPAE(Process, Address, TRUE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       tmpPte = SwapEntry << 1;
       Pte = ExfpInterlockedExchange64UL(Pt, &tmpPte);
@@ -1691,7 +1690,7 @@ MmCreatePageFileMapping(PEPROCESS Process,
       Pt = MmGetPageTableForProcess(Process, Address, TRUE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       Pte = *Pt;
       if (PAGE_MASK((Pte)) != 0)
@@ -1728,7 +1727,7 @@ NTAPI
 MmCreateVirtualMappingUnsafe(PEPROCESS Process,
                              PVOID Address,
                              ULONG flProtect,
-                             PPFN_TYPE Pages,
+                             PPFN_NUMBER Pages,
                              ULONG PageCount)
 {
    ULONG Attributes;
@@ -1745,13 +1744,13 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
       if (Address < MmSystemRangeStart)
       {
          DPRINT1("No process\n");
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       if (PageCount > 0x10000 ||
          (ULONG_PTR) Address / PAGE_SIZE + PageCount > 0x100000)
       {
          DPRINT1("Page count to large\n");
-        KEBUGCHECK(0);
+        ASSERT(FALSE);
       }
    }
    else
@@ -1759,14 +1758,14 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
       if (Address >= MmSystemRangeStart)
       {
          DPRINT1("Setting kernel address with process context\n");
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       if (PageCount > (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE ||
          (ULONG_PTR) Address / PAGE_SIZE + PageCount >
          (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE)
       {
          DPRINT1("Page Count to large\n");
-        KEBUGCHECK(0);
+        ASSERT(FALSE);
       }
    }
 
@@ -1804,7 +1803,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
             DPRINT1("Setting physical address but not allowing access at address "
                     "0x%.8X with attributes %x/%x.\n",
                     Addr, Attributes, flProtect);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
          PdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr);
          if (oldPdeOffset != PdeOffset)
@@ -1813,7 +1812,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
            Pt = MmGetPageTableForProcessForPAE(Process, Addr, TRUE);
            if (Pt == NULL)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
          else
@@ -1831,7 +1830,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
          Pte = ExfpInterlockedExchange64UL(Pt, &tmpPte);
          if (PAE_PAGE_MASK((Pte)) != 0LL && !((Pte) & PA_PRESENT))
          {
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
          if (PAE_PAGE_MASK((Pte)) != 0LL)
          {
@@ -1873,7 +1872,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
             DPRINT1("Setting physical address but not allowing access at address "
                     "0x%.8X with attributes %x/%x.\n",
                     Addr, Attributes, flProtect);
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
          PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
          if (oldPdeOffset != PdeOffset)
@@ -1882,7 +1881,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
            Pt = MmGetPageTableForProcess(Process, Addr, TRUE);
            if (Pt == NULL)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
          else
@@ -1895,7 +1894,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
          MmMarkPageMapped(Pages[i]);
          if (PAGE_MASK((Pte)) != 0 && !((Pte) & PA_PRESENT))
          {
-            KEBUGCHECK(0);
+            ASSERT(FALSE);
          }
          if (PAGE_MASK((Pte)) != 0)
          {
@@ -1934,7 +1933,7 @@ NTAPI
 MmCreateVirtualMapping(PEPROCESS Process,
                        PVOID Address,
                        ULONG flProtect,
-                       PPFN_TYPE Pages,
+                       PPFN_NUMBER Pages,
                        ULONG PageCount)
 {
    ULONG i;
@@ -1944,7 +1943,7 @@ MmCreateVirtualMapping(PEPROCESS Process,
       if (!MmIsPageInUse(Pages[i]))
       {
          DPRINT1("Page at address %x not in use\n", PFN_TO_PTE(Pages[i]));
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
    }
 
@@ -2038,7 +2037,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
       if (Pt == NULL)
       {
          DPRINT1("Address %x\n", Address);
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       do
       {
@@ -2063,7 +2062,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
       Pt = MmGetPageTableForProcess(Process, Address, FALSE);
       if (Pt == NULL)
       {
-         KEBUGCHECK(0);
+         ASSERT(FALSE);
       }
       InterlockedExchange((PLONG)Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY)));
       MiFlushTlb(Pt, Address);
@@ -2073,7 +2072,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
 /*
  * @implemented
  */
-PHYSICAL_ADDRESS STDCALL
+PHYSICAL_ADDRESS NTAPI
 MmGetPhysicalAddress(PVOID vaddr)
 /*
  * FUNCTION: Returns the physical address corresponding to a virtual address
@@ -2115,7 +2114,7 @@ MmGetPhysicalAddress(PVOID vaddr)
 
 PVOID
 NTAPI
-MmCreateHyperspaceMapping(PFN_TYPE Page)
+MmCreateHyperspaceMapping(PFN_NUMBER Page)
 {
    PVOID Address;
    ULONG i;
@@ -2150,7 +2149,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
            }
            if (i >= Page % 1024)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
       }
@@ -2175,7 +2174,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
            }
            if (i <= Page % 1024)
            {
-              KEBUGCHECK(0);
+              ASSERT(FALSE);
            }
          }
       }
@@ -2207,7 +2206,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
             }
             if (i >= Page % 1024)
             {
-               KEBUGCHECK(0);
+               ASSERT(FALSE);
             }
          }
       }
@@ -2232,7 +2231,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
             }
             if (i <= Page % 1024)
             {
-               KEBUGCHECK(0);
+               ASSERT(FALSE);
             }
          }
       }
@@ -2242,11 +2241,11 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
    return Address;
 }
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
-MmChangeHyperspaceMapping(PVOID Address, PFN_TYPE NewPage)
+MmChangeHyperspaceMapping(PVOID Address, PFN_NUMBER NewPage)
 {
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
    ASSERT (IS_HYPERSPACE(Address));
    if (Ke386Pae)
    {
@@ -2264,11 +2263,11 @@ MmChangeHyperspaceMapping(PVOID Address, PFN_TYPE NewPage)
    return Pfn;
 }
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmDeleteHyperspaceMapping(PVOID Address)
 {
-   PFN_TYPE Pfn;
+   PFN_NUMBER Pfn;
    ASSERT (IS_HYPERSPACE(Address));
    if (Ke386Pae)
    {
@@ -2294,7 +2293,7 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
 
    if (Address < MmSystemRangeStart)
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    if (Ke386Pae)
    {
@@ -2451,7 +2450,7 @@ MiInitPageDirectoryMap(VOID)
                                BoundaryAddressMultiple);
    if (!NT_SUCCESS(Status))
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
    BaseAddress = (PVOID)HYPERSPACE;
    Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
@@ -2465,7 +2464,7 @@ MiInitPageDirectoryMap(VOID)
                                BoundaryAddressMultiple);
    if (!NT_SUCCESS(Status))
    {
-      KEBUGCHECK(0);
+      ASSERT(FALSE);
    }
 }