mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 17:06:29 +00:00
[FAT32]
- Really fix loading the MSVC built kernel, by moving the FAT sector buffer beyond the area for freeldr.sys - Load segment only in one place svn path=/trunk/; revision=52500
This commit is contained in:
parent
7bff316a9a
commit
b062ee8583
|
@ -153,6 +153,7 @@ LoadExtraBootCode:
|
||||||
// EAX has logical sector number to read
|
// EAX has logical sector number to read
|
||||||
// CX has number of sectors to read
|
// CX has number of sectors to read
|
||||||
ReadSectors:
|
ReadSectors:
|
||||||
|
push es
|
||||||
cmp eax, dword ptr ds:[BiosCHSDriveSize] // Check if they are reading a sector outside CHS range
|
cmp eax, dword ptr ds:[BiosCHSDriveSize] // Check if they are reading a sector outside CHS range
|
||||||
jae ReadSectorsLBA // Yes - go to the LBA routine
|
jae ReadSectorsLBA // Yes - go to the LBA routine
|
||||||
// If at all possible we want to use LBA routines because
|
// If at all possible we want to use LBA routines because
|
||||||
|
@ -194,13 +195,6 @@ ReadSectorsSetupDiskAddressPacket:
|
||||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||||
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
||||||
int HEX(13) // Call BIOS
|
int HEX(13) // Call BIOS
|
||||||
|
|
||||||
/* This code "fixes" loading the MSVC built kernel */
|
|
||||||
pushad
|
|
||||||
mov si, offset msgNull
|
|
||||||
call PutChars
|
|
||||||
popad
|
|
||||||
|
|
||||||
jc PrintDiskError // If the read failed then abort
|
jc PrintDiskError // If the read failed then abort
|
||||||
|
|
||||||
add sp, 16 // Remove disk address packet from stack
|
add sp, 16 // Remove disk address packet from stack
|
||||||
|
@ -219,6 +213,7 @@ ReadSectorsSetupDiskAddressPacket:
|
||||||
sub cx, word ptr ds:[LBASectorsRead]
|
sub cx, word ptr ds:[LBASectorsRead]
|
||||||
jnz ReadSectorsLBA // Read next sector
|
jnz ReadSectorsLBA // Read next sector
|
||||||
|
|
||||||
|
pop es
|
||||||
ret
|
ret
|
||||||
|
|
||||||
LBASectorsRead:
|
LBASectorsRead:
|
||||||
|
@ -309,8 +304,6 @@ msgFileSystemError:
|
||||||
.ascii "File system error", CR, LF, NUL
|
.ascii "File system error", CR, LF, NUL
|
||||||
msgAnyKey:
|
msgAnyKey:
|
||||||
.ascii "Press any key to restart", CR, LF, NUL
|
.ascii "Press any key to restart", CR, LF, NUL
|
||||||
msgNull:
|
|
||||||
.ascii NUL
|
|
||||||
|
|
||||||
.org 509 // Pad to 509 bytes
|
.org 509 // Pad to 509 bytes
|
||||||
|
|
||||||
|
@ -473,21 +466,21 @@ GetActiveFatOffset:
|
||||||
|
|
||||||
LoadFatSector:
|
LoadFatSector:
|
||||||
push ecx
|
push ecx
|
||||||
|
|
||||||
|
mov bx, HEX(9000) // We will load it to [9000:0000h]
|
||||||
|
mov es, bx
|
||||||
|
|
||||||
// EAX holds logical FAT sector number
|
// EAX holds logical FAT sector number
|
||||||
// Check if we have already loaded it
|
// Check if we have already loaded it
|
||||||
cmp eax, dword ptr ds:[FatSectorInCache]
|
cmp eax, dword ptr ds:[FatSectorInCache]
|
||||||
je LoadFatSectorAlreadyLoaded
|
je LoadFatSectorAlreadyLoaded
|
||||||
|
|
||||||
mov dword ptr ds:[FatSectorInCache], eax
|
mov dword ptr ds:[FatSectorInCache], eax
|
||||||
mov bx, HEX(7000)
|
xor bx, bx
|
||||||
mov es, bx
|
|
||||||
xor bx, bx // We will load it to [7000:0000h]
|
|
||||||
mov cx, 1
|
mov cx, 1
|
||||||
call ReadSectors
|
call ReadSectors
|
||||||
|
|
||||||
LoadFatSectorAlreadyLoaded:
|
LoadFatSectorAlreadyLoaded:
|
||||||
mov bx, HEX(7000)
|
|
||||||
mov es, bx
|
|
||||||
pop ecx
|
pop ecx
|
||||||
mov eax, dword ptr es:[ecx] // Get FAT entry
|
mov eax, dword ptr es:[ecx] // Get FAT entry
|
||||||
and eax, HEX(0fffffff) // Mask off reserved bits
|
and eax, HEX(0fffffff) // Mask off reserved bits
|
||||||
|
|
Loading…
Reference in a new issue