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+ ; ecx number of bytes to read, 0+
; edx mem location to return data ; 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 ; eax = 0 ok read or other = errormsg
; ;
;-------------------------------------------------------------- ;--------------------------------------------------------------
@ -950,7 +950,7 @@ fs_RamdiskRead:
jz .l1 jz .l1
cmp dword [ebx+4], 0 cmp dword [ebx+4], 0
jz @f jz @f
mov ebx, [edi+28] xor ebx, ebx
.reteof: .reteof:
mov eax, 6 ; EOF mov eax, 6 ; EOF
pop edi pop edi
@ -958,10 +958,17 @@ fs_RamdiskRead:
@@: @@:
mov ebx, [ebx] mov ebx, [ebx]
.l1: .l1:
push dword [edi+28] ; file size
push dword [edi+28]
movzx edi, word [edi+26] ; cluster
push ecx edx 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: .new:
jecxz .done jecxz .done
test edi, edi test edi, edi
@ -980,31 +987,25 @@ fs_RamdiskRead:
cmp ecx, ebx cmp ecx, ebx
jbe @f jbe @f
mov ecx, ebx mov ecx, ebx
@@:
cmp ecx, [esp+12]
jbe @f
mov ecx, [esp+12]
@@: @@:
mov ebx, edx mov ebx, edx
call memmove call memmove
add edx, ecx add edx, ecx
sub [esp], ecx sub [esp], ecx
sub [esp+12], ecx
pop ecx pop ecx
xor ebx, ebx xor ebx, ebx
cmp [esp+8], ebx
jnz .skip
jecxz .done
jmp .eof
.skip: .skip:
movzx edi, word [edi*2+0x280000] ; find next cluster from FAT movzx edi, word [edi*2+0x280000] ; find next cluster from FAT
jmp .new jmp .new
.eof: .eof:
pop edx ecx ebx ebx mov ebx, edx
pop eax edx ecx
sub ebx, edx
jmp .reteof jmp .reteof
.done: .done:
pop edx ecx ebx ebx edi mov ebx, edx
xor eax, eax pop eax edx ecx edi
sub ebx, edx
ret ret
;---------------------------------------------------------------- ;----------------------------------------------------------------
@ -1065,7 +1066,7 @@ fs_RamdiskReadFolder:
jb .l1 jb .l1
add esp, 262*2+4 add esp, 262*2+4
pop ebp pop ebp
mov ebx, [edx+8] mov ebx, [edx+4]
xor eax, eax xor eax, eax
dec ecx dec ecx
js @f 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+ ; ecx number of bytes to read, 0+
; edx mem location to return data ; 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 ; eax = 0 ok read or other = errormsg
; ;
;-------------------------------------------------------------- ;--------------------------------------------------------------
@ -1198,7 +1198,7 @@ fs_FloppyRead:
jz .l1 jz .l1
cmp dword [ebx+4], 0 cmp dword [ebx+4], 0
jz @f jz @f
mov ebx, [edi+28] xor ebx, ebx
.reteof: .reteof:
mov eax, 6 ; EOF mov eax, 6 ; EOF
pop edi pop edi
@ -1206,18 +1206,24 @@ fs_FloppyRead:
@@: @@:
mov ebx, [ebx] mov ebx, [ebx]
.l1: .l1:
push dword [edi+28]
push dword [edi+28]
movzx edi, word [edi+26]
push ecx edx 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: .new:
jecxz .done jecxz .done
test edi, edi test edi, edi
jz .eof jz .eof
cmp edi, 0xFF8 cmp edi, 0xFF8
jae .eof jae .eof
mov eax, edi lea eax, [edi+31]
add eax, 31
pusha pusha
call read_chs_sector call read_chs_sector
popa popa
@ -1225,42 +1231,36 @@ fs_FloppyRead:
jnz .err jnz .err
sub ebx, 512 sub ebx, 512
jae .skip jae .skip
lea eax, [eax+ebx+512] lea eax, [0xD000+ebx+512]
neg ebx neg ebx
push ecx push ecx
cmp ecx, ebx cmp ecx, ebx
jbe @f jbe @f
mov ecx, ebx mov ecx, ebx
@@:
cmp ecx, [esp+12]
jbe @f
mov ecx, [esp+12]
@@: @@:
mov ebx, edx mov ebx, edx
mov eax, 0xD000
call memmove call memmove
add edx, ecx add edx, ecx
sub [esp], ecx sub [esp], ecx
sub [esp+12], ecx
pop ecx pop ecx
xor ebx, ebx xor ebx, ebx
cmp [esp+8], ebx
jnz .skip
jecxz .done
jmp .eof
.skip: .skip:
movzx edi, word [edi*2+0x282000] movzx edi, word [edi*2+0x282000]
jmp .new jmp .new
.done: .done:
pop edx ecx ebx ebx edi mov ebx, edx
xor eax, eax pop eax edx ecx edi
sub ebx, edx
ret ret
.eof: .eof:
pop edx ecx ebx ebx mov ebx, edx
pop eax edx ecx
jmp .reteof jmp .reteof
.err: .err:
mov eax, 5 ; may be other error code? mov ebx, edx
pop edx ecx ebx ebx edi pop eax edx ecx edi
sub ebx, edx
mov al, 5 ; may be other error code?
ret ret
;---------------------------------------------------------------- ;----------------------------------------------------------------
@ -1272,7 +1272,7 @@ fs_FloppyRead:
; ecx number of blocks to read, 0+ ; ecx number of blocks to read, 0+
; edx mem location to return data ; 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 ; eax = 0 ok read or other = errormsg
; ;
;-------------------------------------------------------------- ;--------------------------------------------------------------
@ -1388,7 +1388,7 @@ fs_FloppyReadFolder:
.done: .done:
add esp, 262*2+4 add esp, 262*2+4
pop ebp pop ebp
mov ebx, [edx+8] mov ebx, [edx+4]
xor eax, eax xor eax, eax
dec ecx dec ecx
js @f js @f

View File

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

View File

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