mirror of
https://github.com/reactos/reactos.git
synced 2024-08-17 08:58:30 +00:00
Fixes.
svn path=/trunk/; revision=2259
This commit is contained in:
parent
6e4a29babf
commit
c0589a9fec
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: section.c,v 1.60 2001/08/26 17:29:09 ekohl Exp $
|
/* $Id: section.c,v 1.61 2001/09/25 19:41:38 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/section.c
|
* FILE: ntoskrnl/mm/section.c
|
||||||
|
@ -157,8 +157,6 @@ MmUnlockSectionSegment(PMM_SECTION_SEGMENT Segment)
|
||||||
KeReleaseMutex(&Segment->Lock, FALSE);
|
KeReleaseMutex(&Segment->Lock, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
ULONG Offset,
|
ULONG Offset,
|
||||||
|
@ -253,6 +251,13 @@ NTSTATUS
|
||||||
MiReadPage(PMEMORY_AREA MemoryArea,
|
MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
PVOID* Page)
|
PVOID* Page)
|
||||||
|
/*
|
||||||
|
* FUNCTION: Read a page for a section backed memory area.
|
||||||
|
* PARAMETERS:
|
||||||
|
* MemoryArea - Memory area to read the page for.
|
||||||
|
* Offset - Offset of the page to read.
|
||||||
|
* Page - Variable that receives a page contains the read data.
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
@ -263,6 +268,11 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
||||||
Fcb = (PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext;
|
Fcb = (PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the file system is letting us go directly to the cache and the
|
||||||
|
* memory area was mapped at an offset in the file which is page aligned
|
||||||
|
* then get the related cache segment.
|
||||||
|
*/
|
||||||
if (FileObject->Flags & FO_DIRECT_CACHE_PAGING_READ &&
|
if (FileObject->Flags & FO_DIRECT_CACHE_PAGING_READ &&
|
||||||
(Offset->QuadPart % PAGESIZE) == 0)
|
(Offset->QuadPart % PAGESIZE) == 0)
|
||||||
{
|
{
|
||||||
|
@ -272,18 +282,29 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
PCACHE_SEGMENT CacheSeg;
|
PCACHE_SEGMENT CacheSeg;
|
||||||
LARGE_INTEGER SegOffset;
|
LARGE_INTEGER SegOffset;
|
||||||
PHYSICAL_ADDRESS Addr;
|
PHYSICAL_ADDRESS Addr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the related cache segment; we use a lower level interface than
|
||||||
|
* filesystems do because it is safe for us to use an offset with a
|
||||||
|
* alignment less than the file system block size.
|
||||||
|
*/
|
||||||
Status = CcRosGetCacheSegment(Fcb->Bcb,
|
Status = CcRosGetCacheSegment(Fcb->Bcb,
|
||||||
(ULONG)Offset->QuadPart,
|
(ULONG)Offset->QuadPart,
|
||||||
&BaseOffset,
|
&BaseOffset,
|
||||||
&BaseAddress,
|
&BaseAddress,
|
||||||
&UptoDate,
|
&UptoDate,
|
||||||
&CacheSeg);
|
&CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
if (!UptoDate)
|
if (!UptoDate)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If the cache segment isn't up to date then call the file
|
||||||
|
* system to read in the data.
|
||||||
|
*/
|
||||||
|
|
||||||
Mdl = MmCreateMdl(NULL, BaseAddress, Fcb->Bcb->CacheSegmentSize);
|
Mdl = MmCreateMdl(NULL, BaseAddress, Fcb->Bcb->CacheSegmentSize);
|
||||||
MmBuildMdlForNonPagedPool(Mdl);
|
MmBuildMdlForNonPagedPool(Mdl);
|
||||||
SegOffset.QuadPart = BaseOffset;
|
SegOffset.QuadPart = BaseOffset;
|
||||||
|
@ -298,6 +319,9 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Retrieve the page from the cache segment that we actually want.
|
||||||
|
*/
|
||||||
Addr = MmGetPhysicalAddress(BaseAddress +
|
Addr = MmGetPhysicalAddress(BaseAddress +
|
||||||
Offset->QuadPart - BaseOffset);
|
Offset->QuadPart - BaseOffset);
|
||||||
(*Page) = (PVOID)(ULONG)Addr.QuadPart;
|
(*Page) = (PVOID)(ULONG)Addr.QuadPart;
|
||||||
|
|
Loading…
Reference in a new issue