mirror of
https://github.com/reactos/reactos.git
synced 2024-07-27 22:58:42 +00:00
Implemented MmMapViewInSystemSpace() and MmUnmapViewInSystemSpace().
svn path=/trunk/; revision=4683
This commit is contained in:
parent
10f9688a17
commit
9fef3a18ee
|
@ -1,6 +1,6 @@
|
|||
#ifndef _INCLUDE_DDK_MMFUNCS_H
|
||||
#define _INCLUDE_DDK_MMFUNCS_H
|
||||
/* $Id: mmfuncs.h,v 1.14 2002/10/01 19:27:19 chorns Exp $ */
|
||||
/* $Id: mmfuncs.h,v 1.15 2003/05/14 10:51:26 ekohl Exp $ */
|
||||
/* MEMORY MANAGMENT ******************************************************/
|
||||
|
||||
|
||||
|
@ -362,7 +362,7 @@ MmMapVideoDisplay (
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
MmMapViewInSystemSpace (
|
||||
IN PVOID Section,
|
||||
IN PVOID SectionObject,
|
||||
OUT PVOID * MappedBase,
|
||||
IN PULONG ViewSize
|
||||
);
|
||||
|
@ -535,7 +535,7 @@ MmUnmapVideoDisplay (
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
MmUnmapViewInSystemSpace (
|
||||
DWORD Unknown0
|
||||
IN PVOID MappedBase
|
||||
);
|
||||
#if 0
|
||||
NTSTATUS
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: section.c,v 1.109 2003/05/13 21:28:26 chorns Exp $
|
||||
/* $Id: section.c,v 1.110 2003/05/14 10:52:46 ekohl Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/section.c
|
||||
|
@ -2795,7 +2795,7 @@ MmMapViewOfSegment(PEPROCESS Process,
|
|||
KIRQL oldIrql;
|
||||
|
||||
Status = MmCreateMemoryArea(Process,
|
||||
&Process->AddressSpace,
|
||||
AddressSpace,
|
||||
MEMORY_AREA_SECTION_VIEW,
|
||||
BaseAddress,
|
||||
ViewSize,
|
||||
|
@ -3527,7 +3527,6 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
|||
MmUnlockSection(Section);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MmUnlockSection(Section);
|
||||
|
@ -3581,19 +3580,117 @@ MmForceSectionClosed (DWORD Unknown0,
|
|||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
MmMapViewInSystemSpace (IN PVOID Section,
|
||||
MmMapViewInSystemSpace (IN PVOID SectionObject,
|
||||
OUT PVOID * MappedBase,
|
||||
IN PULONG ViewSize)
|
||||
IN OUT PULONG ViewSize)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (STATUS_NOT_IMPLEMENTED);
|
||||
PSECTION_OBJECT Section;
|
||||
PMADDRESS_SPACE AddressSpace;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("MmMapViewInSystemSpace() called\n");
|
||||
|
||||
Section = (PSECTION_OBJECT)SectionObject;
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
|
||||
MmLockSection(SectionObject);
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
|
||||
if ((*ViewSize) == 0)
|
||||
{
|
||||
(*ViewSize) = Section->MaximumSize.u.LowPart;
|
||||
}
|
||||
else if ((*ViewSize) > Section->MaximumSize.u.LowPart)
|
||||
{
|
||||
(*ViewSize) = Section->MaximumSize.u.LowPart;
|
||||
}
|
||||
|
||||
MmLockSectionSegment(Section->Segments);
|
||||
|
||||
Status = MmMapViewOfSegment(NULL,
|
||||
AddressSpace,
|
||||
Section,
|
||||
Section->Segments,
|
||||
MappedBase,
|
||||
*ViewSize,
|
||||
PAGE_READWRITE,
|
||||
0);
|
||||
|
||||
MmUnlockSectionSegment(Section->Segments);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
MmUnlockSection(Section);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
MmUnmapViewInSystemSpace (DWORD Unknown0)
|
||||
MmUnmapViewInSystemSpace (IN PVOID MappedBase)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (STATUS_NOT_IMPLEMENTED);
|
||||
PMEMORY_AREA MemoryArea;
|
||||
PMADDRESS_SPACE AddressSpace;
|
||||
PSECTION_OBJECT Section;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PMM_REGION CurrentRegion;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("MmUnmapViewInSystemSpace() called\n");
|
||||
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
|
||||
DPRINT("Opening memory area at base address %x\n",
|
||||
MappedBase);
|
||||
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
||||
MappedBase);
|
||||
if (MemoryArea == NULL)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
MemoryArea->DeleteInProgress = TRUE;
|
||||
|
||||
MmLockSection(MemoryArea->Data.SectionData.Section);
|
||||
MmLockSectionSegment(MemoryArea->Data.SectionData.Segment);
|
||||
Section = MemoryArea->Data.SectionData.Section;
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
KeAcquireSpinLock(&Section->ViewListLock, &oldIrql);
|
||||
RemoveEntryList(&MemoryArea->Data.SectionData.ViewListEntry);
|
||||
KeReleaseSpinLock(&Section->ViewListLock, oldIrql);
|
||||
|
||||
CurrentEntry = MemoryArea->Data.SectionData.RegionListHead.Flink;
|
||||
while (CurrentEntry != &MemoryArea->Data.SectionData.RegionListHead)
|
||||
{
|
||||
CurrentRegion =
|
||||
CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry);
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
ExFreePool(CurrentRegion);
|
||||
}
|
||||
|
||||
if (MemoryArea->Data.SectionData.Section->AllocationAttributes &
|
||||
SEC_PHYSICALMEMORY)
|
||||
{
|
||||
Status = MmFreeMemoryArea(AddressSpace,
|
||||
MappedBase,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = MmFreeMemoryArea(AddressSpace,
|
||||
MappedBase,
|
||||
0,
|
||||
MmFreeSectionPage,
|
||||
MemoryArea);
|
||||
}
|
||||
|
||||
MmUnlockSectionSegment(Segment);
|
||||
MmUnlockSection(Section);
|
||||
ObDereferenceObject(Section);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3677,9 +3774,3 @@ MmCreateSection (OUT PSECTION_OBJECT * SectionObject,
|
|||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue