Author: sir_richard Date: Mon Oct 4 18:34:41 2010 New Revision: 48977
URL: http://svn.reactos.org/svn/reactos?rev=48977&view=rev Log: [NTOS]: Define MI_MAKE_PROTOTYPE_PTE macro to make a real prototype PTE from a PTE. Define counter-part MiProtoPteToPte to recover the true PTE from a given Prototype PTE. [NTOS]: Define MI_PTE_LOOKUP_NEEDED instead of using 0xFFFF. The name was found in checked build assertion strings. [NTOS]: Add MM_VIEW (used for System-mapped Section Views) and MM_SESSSION (used to define the system/session view mappings) structure definitions.
Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/i386/init.... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] Mon Oct 4 18:34:41 2010 @@ -26,7 +26,7 @@ MMPDE DemandZeroPde = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS)};
/* Template PTE for prototype page */ -MMPTE PrototypePte = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS) | PTE_PROTOTYPE | 0xFFFFF000}; +MMPTE PrototypePte = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS) | PTE_PROTOTYPE | (MI_PTE_LOOKUP_NEEDED << PAGE_SHIFT)};
/* PRIVATE FUNCTIONS **********************************************************/
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Mon Oct 4 18:34:41 2010 @@ -232,6 +232,18 @@ #define MI_GET_PAGE_COLOR(x) ((x) & MmSecondaryColorMask) #define MI_GET_NEXT_COLOR(x) (MI_GET_PAGE_COLOR(++MmSystemPageColor)) #define MI_GET_NEXT_PROCESS_COLOR(x) (MI_GET_PAGE_COLOR(++(x)->NextPageColor)) + +// +// Decodes a Prototype PTE into the underlying PTE +// +#define MiProtoPteToPte(x) \ + (PMMPTE)((ULONG_PTR)MmPagedPoolStart + \ + ((x)->u.Proto.ProtoAddressHigh | (x)->u.Proto.ProtoAddressLow)) + +// +// Prototype PTEs that don't yet have a pagefile association +// +#define MI_PTE_LOOKUP_NEEDED 0xFFFFF
// // FIXFIX: These should go in ex.h after the pool merge @@ -358,6 +370,25 @@ PFN_NUMBER StartFrame; PFN_NUMBER LastFrame; } MI_LARGE_PAGE_RANGES, *PMI_LARGE_PAGE_RANGES; + +typedef struct _MMVIEW +{ + ULONG_PTR Entry; + PCONTROL_AREA ControlArea; +} MMVIEW, *PMMVIEW; + +typedef struct _MMSESSION +{ + KGUARDED_MUTEX SystemSpaceViewLock; + PKGUARDED_MUTEX SystemSpaceViewLockPointer; + PCHAR SystemSpaceViewStart; + PMMVIEW SystemSpaceViewTable; + ULONG SystemSpaceHashSize; + ULONG SystemSpaceHashEntries; + ULONG SystemSpaceHashKey; + ULONG BitmapFailures; + PRTL_BITMAP SystemSpaceBitMap; +} MMSESSION, *PMMSESSION;
extern MMPTE HyperTemplatePte; extern MMPDE ValidKernelPde; @@ -565,6 +596,31 @@ }
// +// Builds a Prototype PTE for the address of the PTE +// +FORCEINLINE +VOID +MI_MAKE_PROTOTYPE_PTE(IN PMMPTE NewPte, + IN PMMPTE PointerPte) +{ + ULONG_PTR Offset; + + /* Mark this as a prototype */ + NewPte->u.Long = 0; + NewPte->u.Proto.Prototype = 1; + + /* + * Prototype PTEs are only valid in paged pool by design, this little trick + * lets us only use 28 bits for the adress of the PTE + */ + Offset = (ULONG_PTR)PointerPte - (ULONG_PTR)MmPagedPoolStart; + + /* 7 bits go in the "low", and the other 21 bits go in the "high" */ + NewPte->u.Proto.ProtoAddressLow = Offset & 0x7F; + NewPte->u.Proto.ProtoAddressHigh = Offset & 0xFFFFF80; +} + +// // Returns if the page is physically resident (ie: a large page) // FIXFIX: CISC/x86 only? // @@ -1107,6 +1163,12 @@ IN PMMADDRESS_NODE Node );
+BOOLEAN +NTAPI +MiInitializeSystemSpaceMap( + IN PVOID InputSession OPTIONAL +); + // // MiRemoveZeroPage will use inline code to zero out the page manually if only // free pages are available. In some scenarios, we don't/can't run that piece of