mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 17:33:18 +00:00
[NTOSKRNL]: No longer force PAGE_READWRITE for allocations. Seems Mm is now mature enough to handle this. Tried with some winetests and they look happier.
svn path=/trunk/; revision=57222
This commit is contained in:
parent
073dea7474
commit
74f2cde659
3 changed files with 52 additions and 12 deletions
|
@ -81,6 +81,29 @@ CHAR MmUserProtectionToMask2[16] =
|
||||||
(CHAR)MM_INVALID_PROTECTION
|
(CHAR)MM_INVALID_PROTECTION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ULONG MmCompatibleProtectionMask[8] =
|
||||||
|
{
|
||||||
|
PAGE_NOACCESS,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_EXECUTE,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY | PAGE_EXECUTE |
|
||||||
|
PAGE_EXECUTE_READ,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY | PAGE_READWRITE,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY | PAGE_READWRITE |
|
||||||
|
PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE |
|
||||||
|
PAGE_EXECUTE_WRITECOPY,
|
||||||
|
|
||||||
|
PAGE_NOACCESS | PAGE_READONLY | PAGE_WRITECOPY | PAGE_EXECUTE |
|
||||||
|
PAGE_EXECUTE_READ | PAGE_EXECUTE_WRITECOPY
|
||||||
|
};
|
||||||
|
|
||||||
MMSESSION MmSession;
|
MMSESSION MmSession;
|
||||||
KGUARDED_MUTEX MmSectionCommitMutex;
|
KGUARDED_MUTEX MmSectionCommitMutex;
|
||||||
MM_AVL_TABLE MmSectionBasedRoot;
|
MM_AVL_TABLE MmSectionBasedRoot;
|
||||||
|
@ -89,6 +112,29 @@ PVOID MmHighSectionBase;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
MiIsProtectionCompatible(IN ULONG SectionPageProtection,
|
||||||
|
IN ULONG NewSectionPageProtection)
|
||||||
|
{
|
||||||
|
ULONG ProtectionMask, CompatibleMask;
|
||||||
|
|
||||||
|
/* Calculate the protection mask and make sure it's valid */
|
||||||
|
ProtectionMask = MiMakeProtectionMask(SectionPageProtection);
|
||||||
|
if (ProtectionMask == MM_INVALID_PROTECTION)
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid protection mask\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculate the compatible mask */
|
||||||
|
CompatibleMask = MmCompatibleProtectionMask[ProtectionMask & 0x7] |
|
||||||
|
PAGE_GUARD | PAGE_NOCACHE | PAGE_WRITECOMBINE;
|
||||||
|
|
||||||
|
/* See if the mapping protection is compatible with the create protection */
|
||||||
|
return ((CompatibleMask | NewSectionPageProtection) == CompatibleMask);
|
||||||
|
}
|
||||||
|
|
||||||
ACCESS_MASK
|
ACCESS_MASK
|
||||||
NTAPI
|
NTAPI
|
||||||
MiArm3GetCorrectFileAccessMask(IN ACCESS_MASK SectionPageProtection)
|
MiArm3GetCorrectFileAccessMask(IN ACCESS_MASK SectionPageProtection)
|
||||||
|
@ -2424,9 +2470,6 @@ MmMapViewOfArm3Section(IN PVOID SectionObject,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Force PAGE_READWRITE for everything, for now */
|
|
||||||
Protect = PAGE_READWRITE;
|
|
||||||
|
|
||||||
/* Get the segment and control area */
|
/* Get the segment and control area */
|
||||||
Section = (PSECTION)SectionObject;
|
Section = (PSECTION)SectionObject;
|
||||||
ControlArea = Section->Segment->ControlArea;
|
ControlArea = Section->Segment->ControlArea;
|
||||||
|
@ -2438,14 +2481,12 @@ MmMapViewOfArm3Section(IN PVOID SectionObject,
|
||||||
ASSERT((AllocationType & MEM_RESERVE) == 0);
|
ASSERT((AllocationType & MEM_RESERVE) == 0);
|
||||||
ASSERT(ControlArea->u.Flags.PhysicalMemory == 0);
|
ASSERT(ControlArea->u.Flags.PhysicalMemory == 0);
|
||||||
|
|
||||||
#if 0
|
/* Check if the mapping protection is compatible with the create */
|
||||||
/* FIXME: Check if the mapping protection is compatible with the create */
|
|
||||||
if (!MiIsProtectionCompatible(Section->InitialPageProtection, Protect))
|
if (!MiIsProtectionCompatible(Section->InitialPageProtection, Protect))
|
||||||
{
|
{
|
||||||
DPRINT1("Mapping protection is incompatible\n");
|
DPRINT1("Mapping protection is incompatible\n");
|
||||||
return STATUS_SECTION_PROTECTION;
|
return STATUS_SECTION_PROTECTION;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check if the offset and size would cause an overflow */
|
/* Check if the offset and size would cause an overflow */
|
||||||
if (((ULONG64)SectionOffset->QuadPart + *ViewSize) <
|
if (((ULONG64)SectionOffset->QuadPart + *ViewSize) <
|
||||||
|
|
|
@ -3739,11 +3739,6 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Force PAGE_READWRITE for everything, for now
|
|
||||||
//
|
|
||||||
Protect = PAGE_READWRITE;
|
|
||||||
|
|
||||||
/* Calculate the protection mask and make sure it's valid */
|
/* Calculate the protection mask and make sure it's valid */
|
||||||
ProtectionMask = MiMakeProtectionMask(Protect);
|
ProtectionMask = MiMakeProtectionMask(Protect);
|
||||||
if (ProtectionMask == MM_INVALID_PROTECTION)
|
if (ProtectionMask == MM_INVALID_PROTECTION)
|
||||||
|
|
|
@ -4986,7 +4986,11 @@ MmCreateSection (OUT PVOID * Section,
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT(AllocationAttributes & SEC_PHYSICALMEMORY);
|
if ((AllocationAttributes & SEC_PHYSICALMEMORY) == 0)
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid path: %lx %p %p\n", AllocationAttributes, FileObject, FileHandle);
|
||||||
|
}
|
||||||
|
// ASSERT(AllocationAttributes & SEC_PHYSICALMEMORY);
|
||||||
Status = MmCreatePageFileSection(SectionObject,
|
Status = MmCreatePageFileSection(SectionObject,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue