Author: tkreuzer
Date: Fri Sep 30 09:30:52 2011
New Revision: 53902
URL:
http://svn.reactos.org/svn/reactos?rev=53902&view=rev
Log:
[NTOSKRNL]
- implement helper functions MiIsMemoryTypeFree and MiIsMemoryTypeInvisible
- use symbolic names instead of hex values
- Don't ASSERT on mising large page support, just warn
- add some more mm macros for amd64
Modified:
trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/largepag.c
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] Fri Sep 30 09:30:52
2011
@@ -93,6 +93,9 @@
/* Easy accessing PFN in PTE */
#define PFN_FROM_PTE(v) ((v)->u.Hard.PageFrameNumber)
+#define PFN_FROM_PDE(v) ((v)->u.Hard.PageFrameNumber)
+#define PFN_FROM_PPE(v) ((v)->u.Hard.PageFrameNumber)
+#define PFN_FROM_PXE(v) ((v)->u.Hard.PageFrameNumber)
// FIXME, only copied from x86
#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0)
@@ -192,15 +195,35 @@
/* Convert a PTE into a corresponding address */
PVOID
FORCEINLINE
-MiPteToAddress(PMMPTE Pte)
-{
- /* Use signed math */
- LONG64 Temp = (LONG64)Pte;
- Temp <<= 25;
- Temp >>= 16;
- return (PVOID)Temp;
-}
-#define MiPdeToAddress MiPteToAddress
+MiPteToAddress(PMMPTE PointerPte)
+{
+ /* Use signed math */
+ return (PVOID)(((LONG64)PointerPte << 25) >> 16);
+}
+
+PVOID
+FORCEINLINE
+MiPdeToAddress(PMMPTE PointerPde)
+{
+ /* Use signed math */
+ return (PVOID)(((LONG64)PointerPde << 34) >> 16);
+}
+
+PVOID
+FORCEINLINE
+MiPpeToAddress(PMMPTE PointerPpe)
+{
+ /* Use signed math */
+ return (PVOID)(((LONG64)PointerPpe << 43) >> 16);
+}
+
+PVOID
+FORCEINLINE
+MiPxeToAddress(PMMPTE PointerPxe)
+{
+ /* Use signed math */
+ return (PVOID)(((LONG64)PointerPxe << 52) >> 16);
+}
BOOLEAN
FORCEINLINE
Modified: trunk/reactos/ntoskrnl/mm/ARM3/largepag.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/largepag.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/largepag.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/largepag.c [iso-8859-1] Fri Sep 30 09:30:52 2011
@@ -34,8 +34,8 @@
MiInitializeLargePageSupport(VOID)
{
#if _MI_PAGING_LEVELS > 2
- DPRINT1("PAE/x64 Not Implemented\n");
- ASSERT(FALSE);
+ DPRINT1("MiInitializeLargePageSupport: PAE/x64 Not Implemented\n");
+ //ASSERT(FALSE);
#else
/* Initialize the large-page hyperspace PTE used for initial mapping */
MiLargePageHyperPte = MiReserveSystemPtes(1, SystemPteSpace);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Fri Sep 30 09:30:52 2011
@@ -538,6 +538,27 @@
extern PVOID MiSessionPoolStart; // 0xBD000000
extern PVOID MiSessionViewStart; // 0xBE000000
+BOOLEAN
+FORCEINLINE
+MiIsMemoryTypeFree(TYPE_OF_MEMORY MemoryType)
+{
+ return ((MemoryType == LoaderFree) ||
+ (MemoryType == LoaderLoadedProgram) ||
+ (MemoryType == LoaderFirmwareTemporary) ||
+ (MemoryType == LoaderOsloaderStack));
+}
+
+BOOLEAN
+FORCEINLINE
+MiIsMemoryTypeInvisible(TYPE_OF_MEMORY MemoryType)
+{
+ return ((MemoryType == LoaderFirmwarePermanent) ||
+ (MemoryType == LoaderSpecialMemory) ||
+ (MemoryType == LoaderHALCachedMemory) ||
+ (MemoryType == LoaderBBTMemory));
+}
+
+
//
// Figures out the hardware bits for a PTE
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mminit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Fri Sep 30 09:30:52 2011
@@ -572,15 +572,16 @@
for (i = 0; i < MmSecondaryColors; i++)
{
/* Set both free and zero lists for each color */
- MmFreePagesByColor[ZeroedPageList][i].Flink = 0xFFFFFFFF;
- MmFreePagesByColor[ZeroedPageList][i].Blink = (PVOID)0xFFFFFFFF;
+ MmFreePagesByColor[ZeroedPageList][i].Flink = LIST_HEAD;
+ MmFreePagesByColor[ZeroedPageList][i].Blink = (PVOID)LIST_HEAD;
MmFreePagesByColor[ZeroedPageList][i].Count = 0;
- MmFreePagesByColor[FreePageList][i].Flink = 0xFFFFFFFF;
- MmFreePagesByColor[FreePageList][i].Blink = (PVOID)0xFFFFFFFF;
+ MmFreePagesByColor[FreePageList][i].Flink = LIST_HEAD;
+ MmFreePagesByColor[FreePageList][i].Blink = (PVOID)LIST_HEAD;
MmFreePagesByColor[FreePageList][i].Count = 0;
}
}
+#ifndef _M_AMD64
BOOLEAN
NTAPI
INIT_FUNCTION
@@ -1059,6 +1060,7 @@
/* Finally add the pages for the PFN database itself */
MiBuildPfnDatabaseSelf();
}
+#endif /* !_M_AMD64 */
VOID
NTAPI
@@ -1287,7 +1289,7 @@
PFN_NUMBER PageFrameIndex;
/* HAL Heap address -- should be on a PDE boundary */
- BaseAddress = (PVOID)0xFFC00000;
+ BaseAddress = (PVOID)MM_HAL_VA_START;
ASSERT(MiAddressToPteOffset(BaseAddress) == 0);
/* Check how many PDEs the heap has */