From a89e08d368a8b5f1755ea8505a684866b385ec2e Mon Sep 17 00:00:00 2001 From: Brian Palmer Date: Tue, 11 Jun 2002 16:58:31 +0000 Subject: [PATCH] Caches the current FAT sector so it doesn't read again if it doesn't have to. svn path=/trunk/; revision=3047 --- freeldr/bootsect/fat32.asm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/freeldr/bootsect/fat32.asm b/freeldr/bootsect/fat32.asm index 5c6be94c308..d211d5d6dd7 100644 --- a/freeldr/bootsect/fat32.asm +++ b/freeldr/bootsect/fat32.asm @@ -426,11 +426,18 @@ GetActiveFatOffset: LoadFatSector: push ecx ; EAX holds logical FAT sector number + ; Check if we have already loaded it + cmp eax,DWORD [FatSectorInCache] + je LoadFatSectorAlreadyLoaded + + mov DWORD [FatSectorInCache],eax mov bx,7000h mov es,bx xor bx,bx ; We will load it to [7000:0000h] mov cx,1 call ReadSectors + +LoadFatSectorAlreadyLoaded: mov bx,7000h mov es,bx pop ecx @@ -439,6 +446,9 @@ LoadFatSector: ret +FatSectorInCache: ; This variable tells us which sector we currently have in memory + dd 0ffffffffh ; There is no need to re-read the same sector if we don't have to + ; Reads cluster number in EAX into [ES:0000] ReadCluster: