kolibri-cfg: fixes in fat32 bootloader

git-svn-id: svn://kolibrios.org@1950 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2011-06-08 18:43:41 +00:00
parent 64c3c758d5
commit b0b34108f2

View File

@ -206,9 +206,11 @@ get_next_cluster:
; out: if there is next cluster: CF=1, eax = next cluster ; out: if there is next cluster: CF=1, eax = next cluster
; out: if there is no next cluster: CF=0 ; out: if there is no next cluster: CF=0
push di bx push di bx
push ds push ds es
push ss push ss
pop ds pop ds
push ss
pop es
push ax push ax
shr eax, 7 shr eax, 7
; eax = FAT sector number; look in cache ; eax = FAT sector number; look in cache
@ -248,10 +250,9 @@ get_next_cluster:
.cache_append: .cache_append:
; read FAT ; read FAT
mov [di+4], eax mov [di+4], eax
push es
pushad pushad
lea cx, [di + 0x10000 - 0x8400 + (0x6000 shr (9-3))] ; +0x10000 - for FASM lea cx, [di + 0x10000 - 0x8400 + (0x6000 shr (9-4-3))] ; +0x10000 - for FASM
shl cx, 9-3 shl cx, 9-4-3
mov es, cx mov es, cx
xor bx, bx xor bx, bx
mov cx, 1 mov cx, 1
@ -259,7 +260,6 @@ get_next_cluster:
sub eax, [bp-10] sub eax, [bp-10]
call [read_sectors2] call [read_sectors2]
popad popad
pop es
@@: @@:
; add new sector to the end of list ; add new sector to the end of list
mov bx, di mov bx, di
@ -269,15 +269,15 @@ get_next_cluster:
mov [bx], di mov [bx], di
mov [di+2], bx mov [di+2], bx
; get requested item ; get requested item
lea ax, [di + 0x10000 - 0x8400 + (0x6000 shr (9-3))] lea ax, [di + 0x10000 - 0x8400 + (0x6000 shr (9-4-3))]
pop di pop di
and di, 0x7F and di, 0x7F
shl di, 2 shl di, 2
shl ax, 9-3 shl ax, 9-4-3
mov ds, ax mov ds, ax
and byte [di+3], 0x0F and byte [di+3], 0x0F
mov eax, [di] mov eax, [di]
pop ds pop es ds
pop bx di pop bx di
;and eax, 0x0FFFFFFF ;and eax, 0x0FFFFFFF
cmp eax, 0x0FFFFFF7 cmp eax, 0x0FFFFFF7
@ -557,16 +557,17 @@ nextclus:
pushf pushf
pop [flags] pop [flags]
jnc @f ; no next cluster => return jnc @f ; no next cluster => return
mov dl, 1 ; dh=0 in any case mov dl, 1
test di, di test di, di
jz @f ; if there is next cluster but current limit is 0 => return: limit exceeded jz @f ; if there is next cluster but current limit is 0 => return: limit exceeded
push di push di
jmp clusloop ; all is ok, continue jmp clusloop ; all is ok, continue
hooked_err: hooked_err:
mov sp, 7C00h-14-2 ; restore stack mov sp, 7C00h-14-2 ; restore stack
mov dx, 3 ; return: read error mov dl, 3 ; return: read error
@@: @@:
mov bx, dx mov bl, dl
mov bh, 0
mov ax, [filesize] mov ax, [filesize]
mov dx, [filesize+2] mov dx, [filesize+2]
ret ret
@ -656,8 +657,8 @@ callback_ret:
secondary_loader_info: secondary_loader_info:
dw 0, 0x1000 dw 0, 0x1000
dw 0x30000 / 0x1000 dw 0x30000 / 0x1000
db 'kord/loader',0 db 'kernel.mnt',0
aKernelNotFound db 'Fatal error: cannot load the secondary loader',0 aKernelNotFound db 'Fatal error: cannot load the kernel',0
;if $ > 0x8200 ;if $ > 0x8200
;error 'total size of kordldr.f32 must not exceed 1024 bytes!' ;error 'total size of kordldr.f32 must not exceed 1024 bytes!'