Some corrections in new file system functions. Added sysfuncr.txt docs.

git-svn-id: svn://kolibrios.org@77 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2006-05-10 14:30:38 +00:00
parent c9d4558817
commit 0b65f18e93
5 changed files with 4302 additions and 71 deletions

View File

@ -927,7 +927,7 @@ rd_find_lfn:
; ecx number of bytes to read, 0+
; edx mem location to return data
;
; ret ebx = size or 0xffffffff file not found
; ret ebx = bytes read or 0xffffffff file not found
; eax = 0 ok read or other = errormsg
;
;--------------------------------------------------------------
@ -950,7 +950,7 @@ fs_RamdiskRead:
jz .l1
cmp dword [ebx+4], 0
jz @f
mov ebx, [edi+28]
xor ebx, ebx
.reteof:
mov eax, 6 ; EOF
pop edi
@ -958,10 +958,17 @@ fs_RamdiskRead:
@@:
mov ebx, [ebx]
.l1:
push dword [edi+28] ; file size
push dword [edi+28]
movzx edi, word [edi+26] ; cluster
push ecx edx
push 0
mov eax, [edi+28]
sub eax, ebx
jb .eof
cmp eax, ecx
jae @f
mov ecx, eax
mov byte [esp], 6 ; EOF
@@:
movzx edi, word [edi+26] ; cluster
.new:
jecxz .done
test edi, edi
@ -980,31 +987,25 @@ fs_RamdiskRead:
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
cmp ecx, [esp+12]
jbe @f
mov ecx, [esp+12]
@@:
mov ebx, edx
call memmove
add edx, ecx
sub [esp], ecx
sub [esp+12], ecx
pop ecx
xor ebx, ebx
cmp [esp+8], ebx
jnz .skip
jecxz .done
jmp .eof
.skip:
movzx edi, word [edi*2+0x280000] ; find next cluster from FAT
jmp .new
.eof:
pop edx ecx ebx ebx
mov ebx, edx
pop eax edx ecx
sub ebx, edx
jmp .reteof
.done:
pop edx ecx ebx ebx edi
xor eax, eax
mov ebx, edx
pop eax edx ecx edi
sub ebx, edx
ret
;----------------------------------------------------------------
@ -1065,7 +1066,7 @@ fs_RamdiskReadFolder:
jb .l1
add esp, 262*2+4
pop ebp
mov ebx, [edx+8]
mov ebx, [edx+4]
xor eax, eax
dec ecx
js @f

File diff suppressed because it is too large Load Diff

View File

@ -1174,7 +1174,7 @@ fd_find_lfn:
; ecx number of bytes to read, 0+
; edx mem location to return data
;
; ret ebx = size or 0xffffffff file not found
; ret ebx = bytes read or 0xffffffff file not found
; eax = 0 ok read or other = errormsg
;
;--------------------------------------------------------------
@ -1198,7 +1198,7 @@ fs_FloppyRead:
jz .l1
cmp dword [ebx+4], 0
jz @f
mov ebx, [edi+28]
xor ebx, ebx
.reteof:
mov eax, 6 ; EOF
pop edi
@ -1206,18 +1206,24 @@ fs_FloppyRead:
@@:
mov ebx, [ebx]
.l1:
push dword [edi+28]
push dword [edi+28]
movzx edi, word [edi+26]
push ecx edx
push 0
mov eax, [edi+28]
sub eax, ebx
jb .eof
cmp eax, ecx
jae @f
mov ecx, eax
mov byte [esp], 6 ; EOF
@@:
movzx edi, word [edi+26]
.new:
jecxz .done
test edi, edi
jz .eof
cmp edi, 0xFF8
jae .eof
mov eax, edi
add eax, 31
lea eax, [edi+31]
pusha
call read_chs_sector
popa
@ -1225,42 +1231,36 @@ fs_FloppyRead:
jnz .err
sub ebx, 512
jae .skip
lea eax, [eax+ebx+512]
lea eax, [0xD000+ebx+512]
neg ebx
push ecx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
cmp ecx, [esp+12]
jbe @f
mov ecx, [esp+12]
@@:
mov ebx, edx
mov eax, 0xD000
call memmove
add edx, ecx
sub [esp], ecx
sub [esp+12], ecx
pop ecx
xor ebx, ebx
cmp [esp+8], ebx
jnz .skip
jecxz .done
jmp .eof
.skip:
movzx edi, word [edi*2+0x282000]
jmp .new
.done:
pop edx ecx ebx ebx edi
xor eax, eax
mov ebx, edx
pop eax edx ecx edi
sub ebx, edx
ret
.eof:
pop edx ecx ebx ebx
mov ebx, edx
pop eax edx ecx
jmp .reteof
.err:
mov eax, 5 ; may be other error code?
pop edx ecx ebx ebx edi
mov ebx, edx
pop eax edx ecx edi
sub ebx, edx
mov al, 5 ; may be other error code?
ret
;----------------------------------------------------------------
@ -1272,7 +1272,7 @@ fs_FloppyRead:
; ecx number of blocks to read, 0+
; edx mem location to return data
;
; ret ebx = size or 0xffffffff folder not found
; ret ebx = blocks read or 0xffffffff folder not found
; eax = 0 ok read or other = errormsg
;
;--------------------------------------------------------------
@ -1388,7 +1388,7 @@ fs_FloppyReadFolder:
.done:
add esp, 262*2+4
pop ebp
mov ebx, [edx+8]
mov ebx, [edx+4]
xor eax, eax
dec ecx
js @f

View File

@ -3053,7 +3053,7 @@ hd_find_lfn:
; ecx number of bytes to read, 0+
; edx mem location to return data
;
; ret ebx = size or 0xffffffff file not found
; ret ebx = bytes read or 0xffffffff file not found
; eax = 0 ok read or other = errormsg
;
;--------------------------------------------------------------
@ -3099,7 +3099,7 @@ fs_HdRead:
jz .l1
cmp dword [ebx+4], 0
jz @f
mov ebx, [edi+28]
xor ebx, ebx
.reteof:
mov eax, 6
pop edi
@ -3107,11 +3107,18 @@ fs_HdRead:
@@:
mov ebx, [ebx]
.l1:
push dword [edi+28] ; file size
push ecx edx
push 0
mov eax, [edi+28]
sub eax, ebx
jb .eof
cmp eax, ecx
jae @f
mov ecx, eax
mov byte [esp], 6
@@:
mov eax, [edi+20-2]
mov ax, [edi+26]
push ecx edx
push dword [edi+28]
; now eax=cluster, ebx=position, ecx=count, edx=buffer for data
.new_cluster:
jecxz .new_sector
@ -3134,19 +3141,15 @@ fs_HdRead:
jnz .force_buf
cmp ecx, 512
jb .force_buf
cmp dword [esp], 512
jb .force_buf
; we may read directly to given buffer
push ebx
mov ebx, edx
call hd_read
cmp [hd_error],0
jne .noaccess_1
pop ebx
add edx, 512
sub ecx, 512
sub dword [esp], 512
jmp .skip
.force_buf:
; we must read sector to temporary buffer and then copy it to destination
@ -3166,22 +3169,13 @@ fs_HdRead:
mov ecx, 512
@@:
sub ecx, ebx
cmp ecx, [esp+8]
jbe @f
mov ecx, [esp+8]
@@:
mov ebx, edx
call memmove
add edx, ecx
sub [esp], ecx
sub [esp+8], ecx
pop ecx
pop eax
xor ebx, ebx
cmp [esp], ebx
jnz .skip
jecxz .done
jmp .eof
.skip:
inc eax
dec edi
@ -3193,12 +3187,15 @@ fs_HdRead:
jmp .new_cluster
.done:
pop ebx edx ecx ebx edi
xor eax, eax
ret
mov ebx, edx
pop eax edx ecx edi
sub ebx, edx
ret
.eof:
pop ebx edx ecx ebx
jmp .reteof
mov ebx, edx
pop eax edx ecx
sub ebx, edx
jmp .reteof
;----------------------------------------------------------------
;
@ -3209,7 +3206,7 @@ fs_HdRead:
; ecx number of blocks to read, 0+
; edx mem location to return data
;
; ret ebx = size or 0xffffffff folder not found
; ret ebx = blocks read or 0xffffffff folder not found
; eax = 0 ok read or other = errormsg
;
;--------------------------------------------------------------
@ -3358,7 +3355,7 @@ fs_HdReadFolder:
.done:
add esp, 262*2+4+8
pop ebp
mov ebx, [edx+8]
mov ebx, [edx+4]
xor eax, eax
dec ecx
js @f

View File

@ -72,7 +72,7 @@ drawbar dd __sys_drawbar
putpixel dd __sys_putpixel
; } mike.dld
version db 'Kolibri OS version 0.5.3.0 ',13,10,13,10,0
version db 'Kolibri OS version 0.5.3.1 ',13,10,13,10,0
;dd endofcode-0x10000
;db 'Boot02'
@ -148,7 +148,7 @@ app_data equ 3+app_data_l-gdts
or eax, ecx
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
mov cr0, eax
jmp byte $+2
jmp $+2
mov ax,os_data ; Selector for os
mov ds,ax
mov es,ax
@ -2305,7 +2305,7 @@ endg
iglobal
version_inf:
db 0,5,3,0 ; version 0.5.3.0
db 0,5,3,1 ; version 0.5.3.1
db UID_KOLIBRI
db 'Kolibri',0
version_end: