mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 04:03:56 +00:00
[NTOSKRNL] Get rid of MEMORY_AREA::Protect
Use the VAD node instead
This commit is contained in:
parent
c9f924940a
commit
c6a87f28bf
3 changed files with 10 additions and 11 deletions
|
@ -212,7 +212,6 @@ typedef struct _MEMORY_AREA
|
||||||
MMVAD VadNode;
|
MMVAD VadNode;
|
||||||
|
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
ULONG Protect;
|
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
BOOLEAN DeleteInProgress;
|
BOOLEAN DeleteInProgress;
|
||||||
ULONG Magic;
|
ULONG Magic;
|
||||||
|
|
|
@ -165,12 +165,13 @@ MiMakeProtectionMask(
|
||||||
static VOID
|
static VOID
|
||||||
MmInsertMemoryArea(
|
MmInsertMemoryArea(
|
||||||
PMMSUPPORT AddressSpace,
|
PMMSUPPORT AddressSpace,
|
||||||
PMEMORY_AREA marea)
|
PMEMORY_AREA marea,
|
||||||
|
ULONG Protect)
|
||||||
{
|
{
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
|
|
||||||
marea->VadNode.u.VadFlags.Spare = 1;
|
marea->VadNode.u.VadFlags.Spare = 1;
|
||||||
marea->VadNode.u.VadFlags.Protection = MiMakeProtectionMask(marea->Protect);
|
marea->VadNode.u.VadFlags.Protection = MiMakeProtectionMask(Protect);
|
||||||
|
|
||||||
/* Build a lame VAD if this is a user-space allocation */
|
/* Build a lame VAD if this is a user-space allocation */
|
||||||
if (marea->VadNode.EndingVpn + 1 < (ULONG_PTR)MmSystemRangeStart >> PAGE_SHIFT)
|
if (marea->VadNode.EndingVpn + 1 < (ULONG_PTR)MmSystemRangeStart >> PAGE_SHIFT)
|
||||||
|
@ -457,7 +458,6 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
||||||
|
|
||||||
RtlZeroMemory(MemoryArea, sizeof(MEMORY_AREA));
|
RtlZeroMemory(MemoryArea, sizeof(MEMORY_AREA));
|
||||||
MemoryArea->Type = Type & ~MEMORY_AREA_STATIC;
|
MemoryArea->Type = Type & ~MEMORY_AREA_STATIC;
|
||||||
MemoryArea->Protect = Protect;
|
|
||||||
MemoryArea->Flags = AllocationFlags;
|
MemoryArea->Flags = AllocationFlags;
|
||||||
MemoryArea->Magic = 'erAM';
|
MemoryArea->Magic = 'erAM';
|
||||||
MemoryArea->DeleteInProgress = FALSE;
|
MemoryArea->DeleteInProgress = FALSE;
|
||||||
|
@ -478,7 +478,7 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
||||||
|
|
||||||
MemoryArea->VadNode.StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
|
MemoryArea->VadNode.StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
|
||||||
MemoryArea->VadNode.EndingVpn = ((ULONG_PTR)*BaseAddress + tmpLength - 1) >> PAGE_SHIFT;
|
MemoryArea->VadNode.EndingVpn = ((ULONG_PTR)*BaseAddress + tmpLength - 1) >> PAGE_SHIFT;
|
||||||
MmInsertMemoryArea(AddressSpace, MemoryArea);
|
MmInsertMemoryArea(AddressSpace, MemoryArea, Protect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -516,7 +516,7 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
||||||
|
|
||||||
MemoryArea->VadNode.StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
|
MemoryArea->VadNode.StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
|
||||||
MemoryArea->VadNode.EndingVpn = ((ULONG_PTR)*BaseAddress + tmpLength - 1) >> PAGE_SHIFT;
|
MemoryArea->VadNode.EndingVpn = ((ULONG_PTR)*BaseAddress + tmpLength - 1) >> PAGE_SHIFT;
|
||||||
MmInsertMemoryArea(AddressSpace, MemoryArea);
|
MmInsertMemoryArea(AddressSpace, MemoryArea, Protect);
|
||||||
}
|
}
|
||||||
|
|
||||||
*Result = MemoryArea;
|
*Result = MemoryArea;
|
||||||
|
|
|
@ -2222,7 +2222,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
{
|
{
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
Address,
|
Address,
|
||||||
MemoryArea->Protect,
|
MmProtectToValue[MemoryArea->VadNode.u.VadFlags.Protection],
|
||||||
&Page,
|
&Page,
|
||||||
1);
|
1);
|
||||||
MmSetDirtyPage(Process, Address);
|
MmSetDirtyPage(Process, Address);
|
||||||
|
@ -2243,7 +2243,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
*/
|
*/
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
Address,
|
Address,
|
||||||
MemoryArea->Protect,
|
MmProtectToValue[MemoryArea->VadNode.u.VadFlags.Protection],
|
||||||
&Page,
|
&Page,
|
||||||
1);
|
1);
|
||||||
MmSetDirtyPage(Process, Address);
|
MmSetDirtyPage(Process, Address);
|
||||||
|
@ -2280,7 +2280,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
{
|
{
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
Address,
|
Address,
|
||||||
MemoryArea->Protect,
|
MmProtectToValue[MemoryArea->VadNode.u.VadFlags.Protection],
|
||||||
&Page,
|
&Page,
|
||||||
1);
|
1);
|
||||||
MmSetDirtyPage(Process, Address);
|
MmSetDirtyPage(Process, Address);
|
||||||
|
@ -2293,7 +2293,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
MmLockSectionSegment(Context.Segment);
|
MmLockSectionSegment(Context.Segment);
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
Address,
|
Address,
|
||||||
MemoryArea->Protect,
|
MmProtectToValue[MemoryArea->VadNode.u.VadFlags.Protection],
|
||||||
&Page,
|
&Page,
|
||||||
1);
|
1);
|
||||||
MmSetDirtyPage(Process, Address);
|
MmSetDirtyPage(Process, Address);
|
||||||
|
@ -2579,7 +2579,7 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea,
|
||||||
Info->Type = MEM_MAPPED;
|
Info->Type = MEM_MAPPED;
|
||||||
}
|
}
|
||||||
Info->BaseAddress = RegionBaseAddress;
|
Info->BaseAddress = RegionBaseAddress;
|
||||||
Info->AllocationProtect = MemoryArea->Protect;
|
Info->AllocationProtect = MmProtectToValue[MemoryArea->VadNode.u.VadFlags.Protection];
|
||||||
Info->RegionSize = Region->Length;
|
Info->RegionSize = Region->Length;
|
||||||
Info->State = MEM_COMMIT;
|
Info->State = MEM_COMMIT;
|
||||||
Info->Protect = Region->Protect;
|
Info->Protect = Region->Protect;
|
||||||
|
|
Loading…
Reference in a new issue