Author: ros-arm-bringup Date: Tue Jul 22 01:40:00 2008 New Revision: 34661
URL: http://svn.reactos.org/svn/reactos?rev=34661&view=rev Log: - Double fail: Fix a math bug, calculate the actual offset in the mapping and return it, and don't forget to return the total length read too.
Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c
Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramdi... ============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:40:00 2008 @@ -276,6 +276,7 @@ { PHYSICAL_ADDRESS PhysicalAddress; PVOID MappedBase; + ULONG PageOffset; SIZE_T ActualLength; LARGE_INTEGER ActualOffset; LARGE_INTEGER ActualPages; @@ -295,13 +296,13 @@ // // Convert to pages // - ActualOffset.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); + ActualPages.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); DPRINT1("Offset in pages is: %d\n", ActualOffset);
// // Now add the base page // - ActualPages.QuadPart = DeviceExtension->BasePage + ActualOffset.QuadPart; + ActualPages.QuadPart = DeviceExtension->BasePage + ActualPages.QuadPart; DPRINT1("Ramdisk mapped at page: %d, actual page is: %I64d\n", DeviceExtension->BasePage, ActualPages);
@@ -324,9 +325,21 @@ DPRINT1("Length in bytes: %d\n", ActualLength);
// + // Get the offset within the page + // + PageOffset = BYTE_OFFSET(ActualOffset.QuadPart); + DPRINT1("Page offset: %lx\n", PageOffset); + + // // Map the I/O Space from the loader // MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); + + // + // Return actual offset within the page as well as the length + // + if (MappedBase) MappedBase = (PVOID)((ULONG_PTR)MappedBase + PageOffset); + *OutputLength = Length; DPRINT1("Mapped at: %p\n", MappedBase); return MappedBase; }