[ros-diffs] [ros-arm-bringup] 41509: - Introduce a new MEMORY_AREA flag, MEMORY_AREA_STATIC: - MEMORY_AREA structures are typically allocated from nonpaged pool, under the assumption it exists. - However, nonpaged pool itself is described by a MEMORY_AREA. Right now, this MEMORY_AREA is created after nonpaged pool has been initialized (it is a miracle this works). - This new flag allows MEMORY_AREA structures to be allocated statically, allowing the description of certain system address space components, themselves prerequisites to nonpaged pool creation, as well as the nonpaged pool component itself, before nonpaged pool has been initialized. - This is not yet used.
ros-arm-bringup at svn.reactos.org
ros-arm-bringup at svn.reactos.org
Sun Jun 21 07:46:51 CEST 2009
- Previous message: [ros-diffs] [ros-arm-bringup] 41508: - Define a new consumer: MC_SYSTEM: - Right now, it is only used for allocating new page tables for kernel-mode mappings. - This consumer's pages are never zeroed automatically (this is a more endemic ReactOS problem -- kernel pages are zeroed when they shouldn't be). - New page tables, however, should indeed be zeroed, so now they are zeroed manually with RtlZeroMemory. - The page zero function is not called anymore, and a useless zero-space hyperspace mapping is thus saved each time this happens. - Because of this, zero-space hyperspace mappings are required much later in the Memory Manager's initialization steps than before.
- Next message: [ros-diffs] [ros-arm-bringup] 41510: - Nonpaged pool MEMORY_AREA is now initialized during nonpaged pool initialization (and it is now a static MEMORY_AREA). - Paged pool MEMORY_AREA is now initialized during paged pool initialization. - Remaining MEMORY_AREAs (KPCR and KUSER_SHARED_DATA) are now created in MiInitSystemMemoryAreas (and they are also static) instead of MmInitVirtualMemory, since this is really what the function was doing. - The page table and hyperspace MEMORY_AREAs are still initialized the same, but are also now static. - The creation of these core/system memory areas is now done much earlier. For example, hyperspace memory area is now created before hyperspace is mapped. - Nonpaged pool, paged pool, and working set initialization is now done outside MiInitSystemMemoryAreas and roughly at the same time as before. - Removed MmInitVirtualMemory as it had become a kitchen sink of random Memory Manager initialization code. - I/O and Local APIC MEMORY_AREAs are not created anymore, since that should be done by the HAL, not the kernel.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: ros-arm-bringup
Date: Sun Jun 21 09:46:50 2009
New Revision: 41509
URL: http://svn.reactos.org/svn/reactos?rev=41509&view=rev
Log:
- Introduce a new MEMORY_AREA flag, MEMORY_AREA_STATIC:
- MEMORY_AREA structures are typically allocated from nonpaged pool, under the assumption it exists.
- However, nonpaged pool itself is described by a MEMORY_AREA. Right now, this MEMORY_AREA is created after nonpaged pool has been initialized (it is a miracle this works).
- This new flag allows MEMORY_AREA structures to be allocated statically, allowing the description of certain system address space components, themselves prerequisites to nonpaged pool creation, as well as the nonpaged pool component itself, before nonpaged pool has been initialized.
- This is not yet used.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/marea.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=41509&r1=41508&r2=41509&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 09:46:50 2009
@@ -28,6 +28,8 @@
struct _MM_PAGEOP;
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)
@@ -43,6 +45,7 @@
#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)
Modified: trunk/reactos/ntoskrnl/mm/marea.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=41509&r1=41508&r2=41509&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] Sun Jun 21 09:46:50 2009
@@ -49,6 +49,9 @@
#pragma alloc_text(INIT, MmInitMemoryAreas)
#endif
+MEMORY_AREA MiStaticMemoryAreas[MI_STATIC_MEMORY_AREAS];
+ULONG MiStaticMemoryAreaCount;
+
/* #define VALIDATE_MEMORY_AREAS */
/* FUNCTIONS *****************************************************************/
@@ -986,9 +989,28 @@
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;
- Previous message: [ros-diffs] [ros-arm-bringup] 41508: - Define a new consumer: MC_SYSTEM: - Right now, it is only used for allocating new page tables for kernel-mode mappings. - This consumer's pages are never zeroed automatically (this is a more endemic ReactOS problem -- kernel pages are zeroed when they shouldn't be). - New page tables, however, should indeed be zeroed, so now they are zeroed manually with RtlZeroMemory. - The page zero function is not called anymore, and a useless zero-space hyperspace mapping is thus saved each time this happens. - Because of this, zero-space hyperspace mappings are required much later in the Memory Manager's initialization steps than before.
- Next message: [ros-diffs] [ros-arm-bringup] 41510: - Nonpaged pool MEMORY_AREA is now initialized during nonpaged pool initialization (and it is now a static MEMORY_AREA). - Paged pool MEMORY_AREA is now initialized during paged pool initialization. - Remaining MEMORY_AREAs (KPCR and KUSER_SHARED_DATA) are now created in MiInitSystemMemoryAreas (and they are also static) instead of MmInitVirtualMemory, since this is really what the function was doing. - The page table and hyperspace MEMORY_AREAs are still initialized the same, but are also now static. - The creation of these core/system memory areas is now done much earlier. For example, hyperspace memory area is now created before hyperspace is mapped. - Nonpaged pool, paged pool, and working set initialization is now done outside MiInitSystemMemoryAreas and roughly at the same time as before. - Removed MmInitVirtualMemory as it had become a kitchen sink of random Memory Manager initialization code. - I/O and Local APIC MEMORY_AREAs are not created anymore, since that should be done by the HAL, not the kernel.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list