[ros-diffs] [dgorbachev] 39681: Change page file PTE format to distinguish paged out pages from noaccess pages. It fixes kernel crash at the end of Sun JRE setup.
dgorbachev at svn.reactos.org
dgorbachev at svn.reactos.org
Thu Feb 19 12:47:34 CET 2009
Author: dgorbachev
Date: Thu Feb 19 05:47:34 2009
New Revision: 39681
URL: http://svn.reactos.org/svn/reactos?rev=39681&view=rev
Log:
Change page file PTE format to distinguish paged out pages from
noaccess pages. It fixes kernel crash at the end of Sun JRE setup.
Modified:
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/pagefile.c
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev=39681&r1=39680&r2=39681&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Thu Feb 19 05:47:34 2009
@@ -671,7 +671,7 @@
NTAPI
MmIsPagePresent(PEPROCESS Process, PVOID Address)
{
- return MmGetPageEntryForProcess(Process, Address) & PA_PRESENT ? TRUE : FALSE;
+ return MmGetPageEntryForProcess(Process, Address) & PA_PRESENT;
}
BOOLEAN
@@ -680,7 +680,7 @@
{
ULONG Entry;
Entry = MmGetPageEntryForProcess(Process, Address);
- return !(Entry & PA_PRESENT) && Entry != 0 ? TRUE : FALSE;
+ return !(Entry & PA_PRESENT) && (Entry & 0x800) && Entry != 0;
}
NTSTATUS
@@ -841,7 +841,7 @@
if (PageCount > 0x10000 ||
(ULONG_PTR) Address / PAGE_SIZE + PageCount > 0x100000)
{
- DPRINT1("Page count to large\n");
+ DPRINT1("Page count too large\n");
KeBugCheck(MEMORY_MANAGEMENT);
}
}
@@ -856,7 +856,7 @@
(ULONG_PTR) Address / PAGE_SIZE + PageCount >
(ULONG_PTR)MmSystemRangeStart / PAGE_SIZE)
{
- DPRINT1("Page Count to large\n");
+ DPRINT1("Page Count too large\n");
KeBugCheck(MEMORY_MANAGEMENT);
}
}
@@ -909,13 +909,14 @@
Pte = *Pt;
MmMarkPageMapped(Pages[i]);
- if (PAGE_MASK((Pte)) != 0 && !((Pte) & PA_PRESENT))
- {
+ if (PAGE_MASK(Pte) != 0 && !(Pte & PA_PRESENT) && (Pte & 0x800))
+ {
+ DPRINT1("Bad PTE %lx\n", Pte);
KeBugCheck(MEMORY_MANAGEMENT);
}
- if (PAGE_MASK((Pte)) != 0)
- {
- MmMarkPageUnmapped(PTE_TO_PFN((Pte)));
+ if (PAGE_MASK(Pte) != 0)
+ {
+ MmMarkPageUnmapped(PTE_TO_PFN(Pte));
}
InterlockedExchangePte(Pt, PFN_TO_PTE(Pages[i]) | Attributes);
if (Pte != 0)
@@ -1014,6 +1015,7 @@
Process, Address, flProtect);
Attributes = ProtectToPTE(flProtect);
+
if (Attributes & 0x80000000)
{
NoExecute = TRUE;
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pagefile.c?rev=39681&r1=39680&r2=39681&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] Thu Feb 19 05:47:34 2009
@@ -117,9 +117,9 @@
/*
* Translate between a swap entry and a file and offset pair.
*/
-#define FILE_FROM_ENTRY(i) ((i) >> 24)
-#define OFFSET_FROM_ENTRY(i) (((i) & 0xffffff) - 1)
-#define ENTRY_FROM_FILE_OFFSET(i, j) (((i) << 24) | ((j) + 1))
+#define FILE_FROM_ENTRY(i) ((i) & 0x0f)
+#define OFFSET_FROM_ENTRY(i) ((i) >> 11)
+#define ENTRY_FROM_FILE_OFFSET(i, j) ((i) | (j) << 11 | 0x400)
static BOOLEAN MmSwapSpaceMessage = FALSE;
More information about the Ros-diffs
mailing list