Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 320 → Rev 321

/kernel/trunk/blkdev/hd_drv.inc
75,13 → 75,11
hd_read_pio:
push eax edx
 
call disable_ide_int
 
call wait_for_hd_idle
cmp [hd_error],0
jne hd_read_error
 
; cli
cli
xor eax,eax
mov edx,[hdbase]
inc edx
107,7 → 105,7
inc edx
mov al,20h
out dx,al ; ATACommand ॣ¨áâà ª®¬ ­¤
; sti
sti
 
call wait_for_sector_buffer
 
114,7 → 112,7
cmp [hd_error],0
jne hd_read_error
 
; cli
cli
push edi
shl edi,9
add edi,0x600000+65536
123,10 → 121,8
cld
rep insw
pop edi
; sti
sti
 
call enable_ide_int
 
pop edx eax
ret
 
420,8 → 416,8
 
hd_timeout_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_timeout_str
call sys_msg_board_str
; jmp $
431,8 → 427,8
 
hd_read_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_read_str
call sys_msg_board_str
pop edx eax
440,15 → 436,15
 
hd_write_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_write_str
call sys_msg_board_str
ret
 
hd_write_error_dma:
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi, hd_write_str
call sys_msg_board_str
pop esi
455,8 → 451,8
ret
 
hd_lba_error:
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_lba_str
call sys_msg_board_str
jmp LBA_read_ret
/kernel/trunk/blkdev/rd.inc
1466,12 → 1466,13
 
;----------------------------------------------------------------
;
; fs_RamdiskRewrite - LFN variant for writing sys floppy
; fs_RamdiskRewrite - LFN variant for writing ramdisk
; fs_RamdiskCreateFolder - create folder on ramdisk
;
; esi points to filename
; esi points to file/folder name
; ebx ignored (reserved)
; ecx number of bytes to write, 0+
; edx mem location to data
; ecx number of bytes to write, 0+ (ignored for folders)
; edx mem location to data (ignored for folders)
;
; ret ebx = number of written bytes
; eax = 0 ok read or other = errormsg
1482,7 → 1483,13
xor ebx, ebx
ret
 
fs_RamdiskCreateFolder:
mov al, 1 ; create folder
jmp fs_RamdiskRewrite.common
 
fs_RamdiskRewrite:
xor eax, eax ; create file
.common:
cmp byte [esi], 0
jz @b
pushad
1537,9 → 1544,25
.common1:
call fat_find_lfn
jc .notfound
; found; must not be directory
; found
test byte [edi+11], 10h
jz .exists_file
; found directory; if we are creating directory, return OK,
; if we are creating file, say "access denied"
add esp, 20
popad
test al, al
mov eax, ERROR_ACCESS_DENIED
jz @f
mov al, 0
@@:
xor ebx, ebx
ret
.exists_file:
; found file; if we are creating directory, return "access denied",
; if we are creating file, delete existing file and continue
cmp byte [esp+20+28], 0
jz @f
add esp, 20
popad
mov eax, ERROR_ACCESS_DENIED
1556,7 → 1579,7
@@:
cmp eax, 0xFF8
jae .done1
lea edi, [0x280000 + eax*2] ; position in FAT
lea edi, [RAMDISK_FAT + eax*2] ; position in FAT
xor eax, eax
xchg ax, [edi]
jmp @b
1748,6 → 1771,12
and word [edi+20], 0 ; high word of cluster
and word [edi+26], 0 ; low word of cluster - to be filled
and dword [edi+28], 0 ; file size - to be filled
cmp byte [esp+20+28], 0
jz .doit
; create directory
mov byte [edi+11], 10h ; attributes: folder
mov ecx, 32*2
mov edx, edi
.doit:
push edx
push ecx
1756,7 → 1785,7
push edi
jecxz .done
mov ecx, 2849
mov edi, 0x280000
mov edi, RAMDISK_FAT
.write_loop:
; allocate new cluster
xor eax, eax
1764,7 → 1793,7
jnz .disk_full2
dec edi
dec edi
lea eax, [edi-0x280000]
lea eax, [edi-(RAMDISK_FAT)]
shr eax, 1 ; eax = cluster
mov word [edi], 0xFFF ; mark as last cluster
xchg edi, [esp]
1773,8 → 1802,11
push edi
inc ecx
; write data
cmp byte [esp+16+20+28], 0
jnz .writedir
shl eax, 9
add eax, 0x100000+31*512
add eax, RAMDISK+31*512
.writefile:
mov ebx, edx
xchg eax, ebx
push ecx
1809,6 → 1841,34
push ERROR_DISK_FULL
pop eax
ret
.writedir:
mov edi, eax
shl edi, 9
add edi, RAMDISK+31*512
mov esi, edx
mov ecx, 32/4
push ecx
rep movsd
mov dword [edi-32], '. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov word [edi-32+26], ax
mov esi, edx
pop ecx
rep movsd
mov dword [edi-32], '.. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov eax, [esp+16+8]
mov word [edi-32+26], ax
pop edi edi ecx edx
add esp, 20
popad
xor eax, eax
xor ebx, ebx
ret
 
.read_symbol:
or ax, -1
/kernel/trunk/blkdev/rdsave.inc
16,10 → 16,12
add edx,ecx
img_save_hd_3:
call reserve_hd1
call reserve_hd_channel
call restorefatchain ; restore FAT !!!
mov eax,image_save
mov ebx,1440*1024 ; size 1440 Kb
mov ecx,0x100000 ; address of image
call file_write
call free_hd_channel
mov [esp+36],eax
ret