diff --git a/reactos/ntoskrnl/mm/kmap.c b/reactos/ntoskrnl/mm/kmap.c index cb71e481ef3..0a442803f5e 100644 --- a/reactos/ntoskrnl/mm/kmap.c +++ b/reactos/ntoskrnl/mm/kmap.c @@ -25,7 +25,7 @@ MiZeroPage(PFN_TYPE Page) KIRQL Irql; PVOID TempAddress; - Process = (PEPROCESS)KeGetCurrentThread()->ApcState.Process; + Process = PsGetCurrentProcess(); TempAddress = MiMapPageInHyperSpace(Process, Page, &Irql); if (TempAddress == NULL) { @@ -40,15 +40,19 @@ NTSTATUS NTAPI MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress) { + PEPROCESS Process; + KIRQL Irql; PVOID TempAddress; - TempAddress = MmCreateHyperspaceMapping(DestPage); + Process = PsGetCurrentProcess(); + TempAddress = MiMapPageInHyperSpace(Process, DestPage, &Irql); if (TempAddress == NULL) { return(STATUS_NO_MEMORY); } memcpy(TempAddress, SourceAddress, PAGE_SIZE); - MmDeleteHyperspaceMapping(TempAddress); + MiUnmapPageInHyperSpace(Process, TempAddress, Irql); return(STATUS_SUCCESS); } +/* EOF */ diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index cba0cedec2a..da42f5aabd6 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -657,8 +657,11 @@ MiReadPage(PMEMORY_AREA MemoryArea, } else { + PEPROCESS Process; + KIRQL Irql; PVOID PageAddr; ULONG CacheSegOffset; + /* * Allocate a page, this is rather complicated by the possibility * we might have to move other things out of memory @@ -692,7 +695,8 @@ MiReadPage(PMEMORY_AREA MemoryArea, } } - PageAddr = MmCreateHyperspaceMapping(*Page); + Process = PsGetCurrentProcess(); + PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql); CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset; Length = RawLength - SegOffset; if (Length <= CacheSegOffset && Length <= PAGE_SIZE) @@ -706,7 +710,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, else { memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, CacheSegOffset); - MmDeleteHyperspaceMapping(PageAddr); + MiUnmapPageInHyperSpace(Process, PageAddr, Irql); CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE); Status = CcRosGetCacheSegment(Bcb, FileOffset + CacheSegOffset, @@ -731,7 +735,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, return Status; } } - PageAddr = MmCreateHyperspaceMapping(*Page); + PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql); if (Length < PAGE_SIZE) { memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length - CacheSegOffset); @@ -741,7 +745,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE - CacheSegOffset); } } - MmDeleteHyperspaceMapping(PageAddr); + MiUnmapPageInHyperSpace(Process, PageAddr, Irql); CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE); } return(STATUS_SUCCESS);