From 6eb52f49862eb564cb1c3d4844362d5ee1bb8c86 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Wed, 5 Nov 2014 20:21:32 +0000 Subject: [PATCH] [FAST486] Make sure the corrected prefetch address contains the block we're trying to read. svn path=/trunk/; revision=65272 --- reactos/lib/fast486/common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reactos/lib/fast486/common.c b/reactos/lib/fast486/common.c index 61a120b8f7f..3d666ae90eb 100644 --- a/reactos/lib/fast486/common.c +++ b/reactos/lib/fast486/common.c @@ -106,6 +106,13 @@ Fast486ReadMemory(PFAST486_STATE State, /* We mustn't prefetch across a page boundary */ State->PrefetchAddress = PAGE_ALIGN(State->PrefetchAddress) | (FAST486_PAGE_SIZE - FAST486_CACHE_SIZE); + + if ((LinearAddress - State->PrefetchAddress + Size) >= FAST486_CACHE_SIZE) + { + /* We can't prefetch without possibly violating page permissions */ + State->PrefetchValid = FALSE; + return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size); + } } /* Prefetch */