From ec32b3ef341762ac59a4c903bc06afc4534da347 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 15 Dec 2013 05:02:59 +0000 Subject: [PATCH] [FAST486] Fix the calculation of PageLength for the last page. svn path=/branches/ntvdm/; revision=61275 --- lib/fast486/common.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fast486/common.inl b/lib/fast486/common.inl index b9ef5872247..175fb018292 100644 --- a/lib/fast486/common.inl +++ b/lib/fast486/common.inl @@ -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 */