Author: sir_richard
Date: Sun May 9 20:17:53 2010
New Revision: 47150
URL:
http://svn.reactos.org/svn/reactos?rev=47150&view=rev
Log:
[NTOS]: Acquire PFN lock before setting up hyperspace PTE/page.
[NTOS]: Flush TLB after setting up hyperspace.
[NTOS]: Use new MiRemoveAnyPage interface instead of MmAllocPage(MC_SYSTEM), as the first
test of the new Page API/ABI.
[NTOS]: Add support for creating software PTEs.
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] Sun May 9 20:17:53 2010
@@ -151,6 +151,7 @@
MMPTE TempPde, TempPte;
PVOID NonPagedPoolExpansionVa;
ULONG OldCount;
+ KIRQL OldIrql;
/* Check for kernel stack size that's too big */
if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB))
@@ -541,21 +542,26 @@
//
MiInitializeSystemPtes(PointerPte, MmNumberOfSystemPtes, SystemPteSpace);
- //
- // Get the PDE For hyperspace
- //
+ /* Get the PDE For hyperspace */
StartPde = MiAddressToPde(HYPER_SPACE);
- //
- // Allocate a page for it and create it
- //
- PageFrameIndex = MmAllocPage(MC_SYSTEM);
+ /* Lock PFN database */
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+
+ /* Allocate a page for hyperspace and create it */
+ PageFrameIndex = MiRemoveAnyPage(0);
TempPde.u.Hard.PageFrameNumber = PageFrameIndex;
TempPde.u.Hard.Global = FALSE; // Hyperspace is local!
ASSERT(StartPde->u.Hard.Valid == 0);
ASSERT(TempPde.u.Hard.Valid == 1);
*StartPde = TempPde;
+ /* Flush the TLB */
+ KeFlushCurrentTb();
+
+ /* Release the lock */
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+
//
// Zero out the page table now
//
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] Sun May 9 20:17:53 2010
@@ -88,6 +88,24 @@
#define MM_NOCACHE 8
#define MM_DECOMMIT 0x10
#define MM_NOACCESS (MM_DECOMMIT | MM_NOCACHE)
+
+//
+// Corresponds to MMPTE_SOFTWARE.Protection
+//
+#ifdef _M_IX86
+#define MM_PTE_SOFTWARE_PROTECTION_BITS 5
+#elif _M_ARM
+#define MM_PTE_SOFTWARE_PROTECTION_BITS 5
+#elif _M_AMD64
+#define MM_PTE_SOFTWARE_PROTECTION_BITS 5
+#else
+#error Define these please!
+#endif
+
+//
+// Creates a software PTE with the given protection
+//
+#define MI_MAKE_SOFTWARE_PTE(x) ((x) << MM_PTE_SOFTWARE_PROTECTION_BITS)
//
// Special values for LoadedImports
@@ -409,6 +427,12 @@
IN PVOID TrapInformation
);
+NTSTATUS
+FASTCALL
+MiCheckPdeForPagedPool(
+ IN PVOID Address
+);
+
VOID
NTAPI
MiInitializeNonPagedPool(
@@ -532,6 +556,18 @@
IN PMMPFNLIST ListHead
);
+PFN_NUMBER
+NTAPI
+MiAllocatePfn(
+ IN PMMPTE PointerPte,
+ IN ULONG Protection
+);
+
+PFN_NUMBER
+NTAPI
+MiRemoveAnyPage(
+ IN ULONG Color
+);
VOID
NTAPI