[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 15 Dec 2013 05:02:59 +0000 (05:02 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 15 Dec 2013 05:02:59 +0000 (05:02 +0000)
Fix the calculation of PageLength for the last page.

svn path=/branches/ntvdm/; revision=61275

lib/fast486/common.inl

index b9ef587..175fb01 100644 (file)
@@ -160,7 +160,7 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
             if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
             {
                 /* Read only a part of the page */
-                PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
+                PageLength = PAGE_OFFSET(LinearAddress + Size - 1) - PageOffset + 1;
             }
 
             /* Read the memory */
@@ -228,7 +228,7 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
             if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
             {
                 /* Write only a part of the page */
-                PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
+                PageLength = PAGE_OFFSET(LinearAddress + Size - 1) - PageOffset + 1;
             }
 
             /* Write the memory */