From bfa03497ad0981a5f66899c330bfeafcb27d043b Mon Sep 17 00:00:00 2001 From: Brian Palmer Date: Fri, 8 Feb 2002 23:58:12 +0000 Subject: [PATCH] CacheInitializeDrive() no longer retains old cache data on removable drives Fixed small bug where it could possibly try to read more sectors than the BIOS supports svn path=/trunk/; revision=2611 --- freeldr/freeldr/cache/cache.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/freeldr/freeldr/cache/cache.c b/freeldr/freeldr/cache/cache.c index 70fc10ab7d2..c739421bd30 100644 --- a/freeldr/freeldr/cache/cache.c +++ b/freeldr/freeldr/cache/cache.c @@ -41,8 +41,11 @@ BOOL CacheInitializeDrive(ULONG DriveNumber) PCACHE_BLOCK NextCacheBlock; // If we already have a cache for this drive then - // by all means lets keep it - if (CacheManagerInitialized && DriveNumber == CacheManagerDrive.DriveNumber) + // by all means lets keep it, unless it is a removable + // drive, in which case we'll invalidate the cache + if ((CacheManagerInitialized == TRUE) && + (DriveNumber == CacheManagerDrive.DriveNumber) && + (DriveNumber >= 0x80)) { return TRUE; } @@ -85,7 +88,10 @@ BOOL CacheInitializeDrive(ULONG DriveNumber) // If not then the block size is the size of one track if (CacheManagerDrive.LbaSupported) { - CacheManagerDrive.BlockSize = 128; + // FIXME: Temporarily reduced this to + // 64 sectors since not all BIOS calls + // support reading as many as 128 sectors + CacheManagerDrive.BlockSize = 64;//128; } else {