[NTOS]: Read almost all the Memory Management variables into the system configuration vector. These includes pool limits, percentages, debugging flags, behavioral changes, and others.

[NTOS]: Minimal stubbed support for some large page functionality in case it gets implemented later and these things would've been ignored. One critical change is that now the MmProcessList is initialized, and the system process is added to it. Other processes should be added later.
[NTOS]: Add stubbed support for parsing the registry list of drivers that should have large pages enabled.
[NTOS]: Initialize the loaded module list before working set work.
[NTOS]: Reload the boot drivers much earlier, as part of ARM3 initialization.
[NTOS]: Start doing some minor MmResidentAvailablePages accounting during bootup.
[NTOS]: Start doing the math required for computing the appropriate MmSystemCacheWsMinimum on the booting system (based on RAM).
[NTOS]: Now that we use the HAL heap, add the code to scan it for I/O mappings. These are dangerous because we need to sync up caching attributes (not yet used in ReactOS, so not a problem for now).
[NTOS]: Add more header definitions, and helper definitions such as PDE_MAPPED_VA instead of doing the math by hand.
[NTOS]: Move MmPageEntireDriver and MmResetDriverPaging to sysldr.c since drvmgmt.c is more for Driver Verifier-style functionality.

svn path=/trunk/; revision=46971
This commit is contained in:
Sir Richard 2010-04-20 22:47:51 +00:00
parent 34b02b74ca
commit f90e9cc903
14 changed files with 465 additions and 160 deletions

View file

@ -42,6 +42,9 @@
#define _1KB (1024)
#define _1MB (1024 * _1KB)
/* Are mapped by a PDE */
#define PDE_MAPPED_VA (PTE_COUNT * PAGE_SIZE)
/* Size of a PDE directory, and size of a page table */
#define PDE_SIZE (PDE_COUNT * sizeof(MMPDE))
#define PT_SIZE (PTE_COUNT * sizeof(MMPTE))
@ -59,6 +62,40 @@
#error Define these please!
#endif
#ifdef _M_IX86
#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_I386
#elif _M_ARM
#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARM
#elif _M_AMD64
#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_AMD64
#else
#error Define these please!
#endif
//
// Protection Bits part of the internal memory manager Protection Mask
// Taken from http://www.reactos.org/wiki/Techwiki:Memory_management_in_the_Windows_XP_kernel
// and public assertions.
//
#define MM_ZERO_ACCESS 0
#define MM_READONLY 1
#define MM_EXECUTE 2
#define MM_EXECUTE_READ 3
#define MM_READWRITE 4
#define MM_WRITECOPY 5
#define MM_EXECUTE_READWRITE 6
#define MM_EXECUTE_WRITECOPY 7
#define MM_NOCACHE 8
#define MM_DECOMMIT 0x10
#define MM_NOACCESS (MM_DECOMMIT | MM_NOCACHE)
//
// Special values for LoadedImports
//
#define MM_SYSLDR_NO_IMPORTS (PVOID)0xFFFFFFFE
#define MM_SYSLDR_BOOT_LOADED (PVOID)0xFFFFFFFF
#define MM_SYSLDR_SINGLE_ENTRY 0x1
//
// PFN List Sentinel
//
@ -168,10 +205,34 @@ typedef struct _MMCOLOR_TABLES
PFN_NUMBER Count;
} MMCOLOR_TABLES, *PMMCOLOR_TABLES;
typedef struct _MI_LARGE_PAGE_RANGES
{
PFN_NUMBER StartFrame;
PFN_NUMBER LastFrame;
} MI_LARGE_PAGE_RANGES, *PMI_LARGE_PAGE_RANGES;
extern MMPTE HyperTemplatePte;
extern MMPTE ValidKernelPde;
extern MMPTE ValidKernelPte;
extern BOOLEAN MmLargeSystemCache;
extern BOOLEAN MmZeroPageFile;
extern BOOLEAN MmProtectFreedNonPagedPool;
extern BOOLEAN MmTrackLockedPages;
extern BOOLEAN MmTrackPtes;
extern BOOLEAN MmDynamicPfn;
extern BOOLEAN MmMirroring;
extern BOOLEAN MmMakeLowMemory;
extern BOOLEAN MmEnforceWriteProtection;
extern ULONG MmAllocationFragment;
extern ULONG MmConsumedPoolPercentage;
extern ULONG MmVerifyDriverBufferType;
extern ULONG MmVerifyDriverLevel;
extern WCHAR MmVerifyDriverBuffer[512];
extern WCHAR MmLargePageDriverBuffer[512];
extern LIST_ENTRY MiLargePageDriverList;
extern BOOLEAN MiLargePageAllDrivers;
extern ULONG MmVerifyDriverBufferLength;
extern ULONG MmLargePageDriverBufferLength;
extern ULONG MmSizeOfNonPagedPoolInBytes;
extern ULONG MmMaximumNonPagedPoolInBytes;
extern PFN_NUMBER MmMaximumNonPagedPoolInPages;
@ -243,11 +304,32 @@ extern PFN_NUMBER MmMinimumFreePages;
extern PFN_NUMBER MmPlentyFreePages;
extern PFN_NUMBER MiExpansionPoolPagesInitialCharge;
extern PFN_NUMBER MmResidentAvailablePages;
extern PFN_NUMBER MmResidentAvailablePagesAtInit;
extern PFN_NUMBER MmResidentAvailableAtInit;
extern ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes];
extern PFN_NUMBER MmTotalSystemDriverPages;
extern PVOID MiSessionImageStart;
extern PVOID MiSessionImageEnd;
#define MI_PFN_TO_PFNENTRY(x) (&MmPfnDatabase[1][x])
#define MI_PFNENTRY_TO_PFN(x) (x - MmPfnDatabase[1])
#define MI_IS_SESSION_IMAGE_ADDRESS(Address) \
(((Address) >= MiSessionImageStart) && ((Address) < MiSessionImageEnd))
#define MI_IS_SESSION_ADDRESS(Address) \
(((Address) >= MmSessionBase) && ((Address) < MiSessionSpaceEnd))
FORCEINLINE
BOOLEAN
MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
{
PMMPDE PointerPde;
/* Large pages are never paged out, always physically resident */
PointerPde = MiAddressToPde(Address);
return ((PointerPde->u.Hard.LargePage) && (PointerPde->u.Hard.Valid));
}
NTSTATUS
NTAPI
MmArmInitSystem(
@ -457,4 +539,28 @@ MiInsertPageInFreeList(
IN PFN_NUMBER PageFrameIndex
);
PLDR_DATA_TABLE_ENTRY
NTAPI
MiLookupDataTableEntry(
IN PVOID Address
);
VOID
NTAPI
MiInitializeDriverLargePageList(
VOID
);
VOID
NTAPI
MiInitializeLargePageSupport(
VOID
);
VOID
NTAPI
MiSyncCachedRanges(
VOID
);
/* EOF */