[ros-dev] Re: [ros-svn] [hbirr] 13570: - Started the rewriting of the cache manger.

Filip Navara xnavara at volny.cz
Sat Feb 19 00:19:25 CET 2005


Filip Navara wrote:

> Hartmut Birr wrote:
>
>>> [cc02.diff] Don't try to map data past the end of file in VFAT.
>>
>> I think that this patch isn't necessary, because the real problem is 
>> in pin.c.
>
> At first I did the same thing as you did in the attached patch. Then I 
> actually followed it by some testing on Windows and _it is possible to 
> map data past the end of file_ with CcMapData. I haven't tried to 
> access the mapped memory though...

I did more testing and the result is the attached patch (comment 
inside). Does it look ok?

Regards,
Filip
-------------- next part --------------
Index: section.c
===================================================================
--- section.c	(revision 13615)
+++ section.c	(working copy)
@@ -866,15 +866,20 @@
 
    FileOffset.QuadPart = SegOffset + SectionData->Segment->FileOffset;
    Length = PageCount * PAGE_SIZE;
-   if (SegOffset > SectionData->Segment->RawLength)
+
+   if (SegOffset >= SectionData->Segment->RawLength)
    {
-      KEBUGCHECK(0);
+      /* It is perfectly valid to map area past the end of file with CcMapData
+       * and then access the pages. In this case the page fault doesn't result
+       * in I/O request and we get zeroed pages.
+       */
+      return STATUS_SUCCESS;
    }
+
    if (Length + SegOffset > SectionData->Segment->RawLength)
    {
       Length = SectionData->Segment->RawLength - SegOffset;
    }
-   
 
    Status = MmspRawReadPages(SectionData->Section->FileObject,
                              SectorSize,
@@ -1717,7 +1722,7 @@
       Status = MmspReadSectionSegmentPages(SectionData, Offset, PageCount, Pfn);
       if (!NT_SUCCESS(Status))
       {
-         DPRINT1("MiReadPage failed (Status %x)\n", Status);
+         DPRINT1("MmspReadSectionSegmentPages failed (Status %x)\n", Status);
       }
       MmLockAddressSpace(AddressSpace);
       if (!NT_SUCCESS(Status))


More information about the Ros-dev mailing list