Author: aandrejevic Date: Sun Dec 15 04:15:03 2013 New Revision: 61274
URL: http://svn.reactos.org/svn/reactos?rev=61274&view=rev Log: [FAST486] Fix linear memory access when paging is enabled.
Modified: branches/ntvdm/lib/fast486/common.inl
Modified: branches/ntvdm/lib/fast486/common.inl URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.inl?rev... ============================================================================== --- branches/ntvdm/lib/fast486/common.inl [iso-8859-1] (original) +++ branches/ntvdm/lib/fast486/common.inl [iso-8859-1] Sun Dec 15 04:15:03 2013 @@ -128,6 +128,7 @@ ULONG Page; FAST486_PAGE_TABLE TableEntry; INT Cpl = Fast486GetCurrentPrivLevel(State); + ULONG BufferOffset = 0;
for (Page = PAGE_ALIGN(LinearAddress); Page <= PAGE_ALIGN(LinearAddress + Size - 1); @@ -152,6 +153,7 @@ { /* Start reading from the offset from the beginning of the page */ PageOffset = PAGE_OFFSET(LinearAddress); + PageLength -= PageOffset; }
/* Check if this is the last page */ @@ -164,8 +166,10 @@ /* Read the memory */ State->MemReadCallback(State, (TableEntry.Address << 12) | PageOffset, - Buffer, + (PVOID)((ULONG_PTR)Buffer + BufferOffset), PageLength); + + BufferOffset += PageLength; } } else @@ -190,6 +194,7 @@ ULONG Page; FAST486_PAGE_TABLE TableEntry; INT Cpl = Fast486GetCurrentPrivLevel(State); + ULONG BufferOffset = 0;
for (Page = PAGE_ALIGN(LinearAddress); Page <= PAGE_ALIGN(LinearAddress + Size - 1); @@ -216,6 +221,7 @@ { /* Start writing from the offset from the beginning of the page */ PageOffset = PAGE_OFFSET(LinearAddress); + PageLength -= PageOffset; }
/* Check if this is the last page */ @@ -228,8 +234,10 @@ /* Write the memory */ State->MemWriteCallback(State, (TableEntry.Address << 12) | PageOffset, - Buffer, + (PVOID)((ULONG_PTR)Buffer + BufferOffset), PageLength); + + BufferOffset += PageLength; } } else