Author: ros-arm-bringup
Date: Thu Feb 14 06:08:20 2008
New Revision: 32352
URL:
http://svn.reactos.org/svn/reactos?rev=32352&view=rev
Log:
[FORMATTING] Remove dead code (#if 0) and re-organize the file to match kernel standard
layout/style.
Get rid of old debugging hacks introduced by ion (rmapready, pageopready, pagingready).
Modified:
trunk/reactos/ntoskrnl/mm/mminit.c
trunk/reactos/ntoskrnl/mm/pagefile.c
trunk/reactos/ntoskrnl/mm/pageop.c
trunk/reactos/ntoskrnl/mm/rmap.c
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c Thu Feb 14 06:08:20 2008
@@ -1,81 +1,71 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top directory
- * PROJECT: ReactOS kernel
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/mm/mminit.c
- * PURPOSE: Kernel memory managment initialization functions
- *
- * PROGRAMMERS: David Welch (welch(a)cwcom.net)
+ * PURPOSE: Memory Manager Initialization
+ * PROGRAMMERS:
*/
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
-/* GLOBALS *****************************************************************/
-
-/*
- * Compiler defined symbols
- */
-#if 0
-extern unsigned int _image_base__;
-extern unsigned int _text_start__;
-extern unsigned int _text_end__;
-
-extern unsigned int _init_start__;
-extern unsigned int _init_end__;
-
-extern unsigned int _bss_end__;
-#endif
-
-static BOOLEAN IsThisAnNtAsSystem = FALSE;
+/* GLOBALS *******************************************************************/
+
+PCHAR
+MemType[] =
+{
+ "ExceptionBlock ",
+ "SystemBlock ",
+ "Free ",
+ "Bad ",
+ "LoadedProgram ",
+ "FirmwareTemporary ",
+ "FirmwarePermanent ",
+ "OsloaderHeap ",
+ "OsloaderStack ",
+ "SystemCode ",
+ "HalCode ",
+ "BootDriver ",
+ "ConsoleInDriver ",
+ "ConsoleOutDriver ",
+ "StartupDpcStack ",
+ "StartupKernelStack",
+ "StartupPanicStack ",
+ "StartupPcrPage ",
+ "StartupPdrPage ",
+ "RegistryData ",
+ "MemoryData ",
+ "NlsData ",
+ "SpecialMemory ",
+ "BBTMemory ",
+ "LoaderReserve "
+};
+
+BOOLEAN IsThisAnNtAsSystem = FALSE;
MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
-
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
-
PVOID MiNonPagedPoolStart;
ULONG MiNonPagedPoolLength;
-
ULONG MmNumberOfPhysicalPages;
-
-VOID INIT_FUNCTION NTAPI MmInitVirtualMemory(ULONG_PTR LastKernelAddress, ULONG
KernelLength);
-
-/* FUNCTIONS ****************************************************************/
-
-/*
- * @implemented
- */
-BOOLEAN STDCALL MmIsThisAnNtAsSystem(VOID)
-{
- return(IsThisAnNtAsSystem);
-}
-
-/*
- * @implemented
- */
-MM_SYSTEMSIZE STDCALL MmQuerySystemSize(VOID)
-{
- return(MmSystemSize);
-}
+extern KMUTANT MmSystemLoadLock;
+
+/* PRIVATE FUNCTIONS *********************************************************/
VOID
NTAPI
MiShutdownMemoryManager(VOID)
-{}
+{
+
+}
VOID
INIT_FUNCTION
NTAPI
MmInitVirtualMemory(ULONG_PTR LastKernelAddress,
ULONG KernelLength)
-/*
- * FUNCTION: Intialize the memory areas list
- * ARGUMENTS:
- * bp = Pointer to the boot parameters
- * kernel_len = Length of the kernel
- */
{
PVOID BaseAddress;
ULONG Length;
@@ -233,35 +223,6 @@
return TotalPages;
}
-
-PCHAR
-MemType[] = {
- "ExceptionBlock ", // ?
- "SystemBlock ", // ?
- "Free ",
- "Bad ", // used
- "LoadedProgram ", // == Free
- "FirmwareTemporary ", // == Free
- "FirmwarePermanent ", // == Bad
- "OsloaderHeap ", // used
- "OsloaderStack ", // == Free
- "SystemCode ",
- "HalCode ",
- "BootDriver ", // not used
- "ConsoleInDriver ", // ?
- "ConsoleOutDriver ", // ?
- "StartupDpcStack ", // ?
- "StartupKernelStack", // ?
- "StartupPanicStack ", // ?
- "StartupPcrPage ", // ?
- "StartupPdrPage ", // ?
- "RegistryData ", // used
- "MemoryData ", // not used
- "NlsData ", // used
- "SpecialMemory ", // == Bad
- "BBTMemory ",
- "LoaderReserve "// == Bad
-};
VOID
INIT_FUNCTION
@@ -413,24 +374,7 @@
/*
* Unmap low memory
*/
-#ifdef CONFIG_SMP
- /* In SMP mode we unmap the low memory pagetable in MmInit3.
- The APIC needs the mapping of the first pages
- while the processors are starting up.
- We unmap all pages except page 2 and 3. */
- for (MappingAddress = 0;
- MappingAddress < 1024 * PAGE_SIZE;
- MappingAddress += PAGE_SIZE)
- {
- if (MappingAddress != 2 * PAGE_SIZE &&
- MappingAddress != 3 * PAGE_SIZE)
- {
- MmRawDeleteVirtualMapping((PVOID)MappingAddress);
- }
- }
-#else
MmDeletePageTable(NULL, 0);
-#endif
DPRINT("Invalidating between %x and %x\n",
LastKernelAddress, KSEG0_BASE + 0x00600000);
@@ -450,9 +394,6 @@
MmInitializeMdlImplementation();
}
-BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
-extern KMUTANT MmSystemLoadLock;
-
BOOLEAN
NTAPI
MmInitSystem(IN ULONG Phase,
@@ -483,13 +424,9 @@
else if (Phase == 1)
{
MmInitializeRmapList();
- RmapReady = TRUE;
MmInitializePageOp();
- PageOpReady = TRUE;
MmInitSectionImplementation();
- SectionsReady = TRUE;
MmInitPagingFile();
- PagingReady = TRUE;
MmCreatePhysicalMemorySection();
/* Setup shared user data settings that NT does as well */
@@ -521,29 +458,25 @@
return TRUE;
}
-#if 0
-
-VOID static
-MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
- PFN_TYPE Page, SWAPENTRY SwapEntry,
- BOOLEAN Dirty)
-{
- ASSERT(SwapEntry == 0);
- if (Page != 0)
- {
- MmReleasePageMemoryConsumer(MC_NPPOOL, Page);
- }
-}
-
-VOID
-NTAPI
-MiFreeInitMemory(VOID)
-{
- MmLockAddressSpace(MmGetKernelAddressSpace());
- MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(),
- (PVOID)&_init_start__,
- MiFreeInitMemoryPage,
- NULL);
- MmUnlockAddressSpace(MmGetKernelAddressSpace());
-}
-#endif
+
+/* PUBLIC FUNCTIONS **********************************************************/
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+MmIsThisAnNtAsSystem(VOID)
+{
+ return IsThisAnNtAsSystem;
+}
+
+/*
+ * @implemented
+ */
+MM_SYSTEMSIZE
+NTAPI
+MmQuerySystemSize(VOID)
+{
+ return MmSystemSize;
+}
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pagefile.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pagefile.c (original)
+++ trunk/reactos/ntoskrnl/mm/pagefile.c Thu Feb 14 06:08:20 2008
@@ -322,8 +322,6 @@
return(Status);
}
-extern BOOLEAN PagingReady;
-
VOID
INIT_FUNCTION
NTAPI
@@ -367,11 +365,6 @@
KIRQL oldIrql;
ULONG MiAvailSwapPages;
- if (!PagingReady)
- {
- DPRINT1("PAGING USED TOO SOON!!!\n");
- while (TRUE);
- }
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
MiAvailSwapPages =
(MiFreeSwapPages * MM_PAGEFILE_COMMIT_RATIO) + MM_PAGEFILE_COMMIT_GRACE;
@@ -391,11 +384,6 @@
{
KIRQL oldIrql;
- if (!PagingReady)
- {
- DPRINT1("PAGING USED TOO SOON!!!\n");
- while (TRUE);
- }
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
MiReservedSwapPages = MiReservedSwapPages - Nr;
KeReleaseSpinLock(&PagingFileListLock, oldIrql);
@@ -407,11 +395,6 @@
KIRQL oldIrql;
ULONG i, j;
- if (!PagingReady)
- {
- DPRINT1("PAGING USED TOO SOON!!!\n");
- while (TRUE);
- }
KeAcquireSpinLock(&PagingFile->AllocMapLock, &oldIrql);
for (i = 0; i < PagingFile->AllocMapSize; i++)
@@ -441,11 +424,6 @@
ULONG off;
KIRQL oldIrql;
- if (!PagingReady)
- {
- DPRINT1("PAGING USED TOO SOON!!!\n");
- while (TRUE);
- }
i = FILE_FROM_ENTRY(Entry);
off = OFFSET_FROM_ENTRY(Entry);
@@ -490,11 +468,6 @@
ULONG off;
SWAPENTRY entry;
- if (!PagingReady)
- {
- DPRINT1("PAGING USED TOO SOON!!!\n");
- while (TRUE);
- }
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
if (MiFreeSwapPages == 0)
Modified: trunk/reactos/ntoskrnl/mm/pageop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pageop.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pageop.c (original)
+++ trunk/reactos/ntoskrnl/mm/pageop.c Thu Feb 14 06:08:20 2008
@@ -133,8 +133,6 @@
return(NULL);
}
-extern BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
-
PMM_PAGEOP
NTAPI
MmGetPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
@@ -148,12 +146,6 @@
ULONG_PTR Hash;
KIRQL oldIrql;
PMM_PAGEOP PageOp;
-
- if (!PageOpReady)
- {
- DPRINT1("PAGEOPS USED TOO SOON!!!\n");
- while (TRUE);
- }
/*
* Calcuate the hash value for pageop structure
Modified: trunk/reactos/ntoskrnl/mm/rmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rmap.c?rev=323…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/rmap.c (original)
+++ trunk/reactos/ntoskrnl/mm/rmap.c Thu Feb 14 06:08:20 2008
@@ -379,8 +379,6 @@
return(FALSE);
}
-extern BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
-
VOID
NTAPI
MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
@@ -389,12 +387,6 @@
PMM_RMAP_ENTRY current_entry;
PMM_RMAP_ENTRY new_entry;
ULONG PrevSize;
-
- if (!RmapReady)
- {
- DPRINT1("RMAPS USED TOO SOON!!!\n");
- while (TRUE);
- }
Address = (PVOID)PAGE_ROUND_DOWN(Address);
@@ -467,12 +459,6 @@
PMM_RMAP_ENTRY previous_entry;
PEPROCESS Process;
- if (!RmapReady)
- {
- DPRINT1("RMAPS USED TOO SOON!!!\n");
- while (TRUE);
- }
-
ExAcquireFastMutex(&RmapListLock);
current_entry = MmGetRmapListHeadPage(Page);
if (current_entry == NULL)
@@ -510,12 +496,6 @@
PVOID Address)
{
PMM_RMAP_ENTRY current_entry, previous_entry;
-
- if (!RmapReady)
- {
- DPRINT1("RMAPS USED TOO SOON!!!\n");
- while (TRUE);
- }
ExAcquireFastMutex(&RmapListLock);
previous_entry = NULL;