sysfunction 70 cleaning

git-svn-id: svn://kolibrios.org@6464 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2016-07-29 11:12:13 +00:00
parent 1d995e8c33
commit ee14b53b33
5 changed files with 367 additions and 696 deletions

View File

@ -455,16 +455,12 @@ SendCommandToHDD_1:
cmp [ATAAddressMode], 1 cmp [ATAAddressMode], 1
ja @@Err2_4 ja @@Err2_4
; Проверить корректность номера канала ; Проверить корректность номера канала
mov bx, [ChannelNumber] movzx ebx, [ChannelNumber]
cmp bx, 1 dec ebx
jb @@Err3_4 cmp ebx, 1
cmp bx, 2
ja @@Err3_4 ja @@Err3_4
; Установить базовый адрес ; Установить базовый адрес
dec bx
shl ebx, 2 shl ebx, 2
movzx ebx, bx
mov eax, [cdpos] mov eax, [cdpos]
dec eax dec eax
shr eax, 2 shr eax, 2

View File

@ -1144,15 +1144,37 @@ dyndisk_handler:
jmp file_system_lfn.maindir_noesi jmp file_system_lfn.maindir_noesi
.haspartition: .haspartition:
; 12. The fs operation has specified some partition. ; 12. The fs operation has specified some partition.
; 12a. Store parameters for callback functions.
push edx push edx
push ecx push ecx
; 12b. Store callback functions. xor eax, eax
push dyndisk_cleanup lodsb
push fs_dyndisk sub eax, '0'
mov edi, esp jz .dyndisk_cleanup
; 12c. Let the procedure from fs_lfn.inc do the job. cmp eax, 10
jmp file_system_lfn.found2 jnc .dyndisk_cleanup
mov ecx, eax
lodsb
cmp eax, '/'
jz @f
test eax, eax
jnz .dyndisk_cleanup
dec esi
@@:
cmp byte [esi], 0
jnz @f
test ebp, ebp
jz @f
mov esi, ebp
xor ebp, ebp
@@:
jmp fs_dyndisk
.dyndisk_cleanup:
pop esi
pop edx
mov dword [esp+32], ERROR_FILE_NOT_FOUND
jmp .cleanup_esi
.access_denied: .access_denied:
; 13. Fail the operation with the appropriate code. ; 13. Fail the operation with the appropriate code.
mov dword [esp+32], ERROR_ACCESS_DENIED mov dword [esp+32], ERROR_ACCESS_DENIED
@ -1168,17 +1190,12 @@ dyndisk_handler:
; 15. Return. ; 15. Return.
ret ret
; This is a callback for cleaning up things called from file_system_lfn.found2.
dyndisk_cleanup:
mov esi, [edi+8]
mov edx, [edi+12]
jmp dyndisk_handler.cleanup_esi
; This is a callback for enumerating partitions called from ; This is a callback for enumerating partitions called from
; file_system_lfn.maindir in the case of inserted media. ; file_system_lfn.maindir in the case of inserted media.
; It just increments eax until DISK.NumPartitions reached and then ; It just increments eax until DISK.NumPartitions reached and then
; cleans up. ; cleans up.
fs_dyndisk_next: fs_dyndisk_next:
mov ecx, [esp+8]
cmp eax, [ecx+DISK.NumPartitions] cmp eax, [ecx+DISK.NumPartitions]
jae .nomore jae .nomore
inc eax inc eax
@ -1203,6 +1220,7 @@ fs_dyndisk_next_nomedia:
clc clc
ret ret
.nomore: .nomore:
mov ecx, [esp+8]
pusha pusha
mov esi, ecx mov esi, ecx
call disk_dereference call disk_dereference
@ -1210,13 +1228,11 @@ fs_dyndisk_next_nomedia:
stc stc
ret ret
; This is a callback for doing real work with selected partition. ; esp -> {dd pointer to DISK, dd media object}
; Currently this is just placeholder, since no file systems are supported.
; edi = esp -> {dd fs_dyndisk, dd dyndisk_cleanup, dd pointer to DISK, dd media object}
; ecx = partition number, esi+ebp = ASCIIZ name ; ecx = partition number, esi+ebp = ASCIIZ name
fs_dyndisk: fs_dyndisk:
dec ecx ; convert to zero-based partition index dec ecx ; convert to zero-based partition index
pop edx edx edx ; edx = pointer to DISK, dword [esp] = NULL or edx pop edx ; edx = pointer to DISK, dword [esp] = NULL or edx
; If the driver does not support insert notifications and we are the only fs ; If the driver does not support insert notifications and we are the only fs
; operation with this disk, ask the driver whether the media ; operation with this disk, ask the driver whether the media
; was inserted/removed/changed. Otherwise, assume that media status is valid. ; was inserted/removed/changed. Otherwise, assume that media status is valid.

View File

@ -46,7 +46,7 @@ FindHDD_2:
add [DeviceNumber], sizeof.HD_DATA add [DeviceNumber], sizeof.HD_DATA
shl byte [ebx+DRIVE_DATA], 2 shl byte [ebx+DRIVE_DATA], 2
FindHDD_1: FindHDD_1:
DEBUGF 1, "K : Channel %d ",[ChannelNumber]:2 DEBUGF 1, "K : Channel %d ",[ChannelNumber]:1
DEBUGF 1, "Disk %d\n",[DiskNumber]:1 DEBUGF 1, "Disk %d\n",[DiskNumber]:1
push ebx ecx push ebx ecx
call ReadHDD_ID call ReadHDD_ID
@ -83,17 +83,14 @@ FindHDD_1:
add [ebx+DRIVE_DATA], byte 2 add [ebx+DRIVE_DATA], byte 2
;-------------------------------------- ;--------------------------------------
.Print_Device_Name: .Print_Device_Name:
pushad pushad
pushfd pushfd
movzx ebx, [ChannelNumber]
xor ebx, ebx
mov bx, [ChannelNumber]
dec ebx dec ebx
shl ebx, 1 shl ebx, 1
add bl, [DiskNumber] add bl, [DiskNumber]
shl ebx, 1 shl ebx, 1
call calculate_IDE_device_values_storage call calculate_IDE_device_values_storage
;-------------------------------------- ;--------------------------------------
.copy_dev_name: .copy_dev_name:
@ -245,7 +242,7 @@ uglobal
; Стандартные базовые адреса каналов 1 и 2 ; Стандартные базовые адреса каналов 1 и 2
StandardATABases dw ?, ? ; 1F0h, 170h StandardATABases dw ?, ? ; 1F0h, 170h
; Номер канала ; Номер канала
ChannelNumber dw ? ChannelNumber db ?
; Номер диска ; Номер диска
DiskNumber db ? DiskNumber db ?
DeviceNumber db ? DeviceNumber db ?
@ -291,16 +288,12 @@ SendCommandToHDD:
cmp [ATAAddressMode], 1 cmp [ATAAddressMode], 1
ja @@Err2 ja @@Err2
; Проверить корректность номера канала ; Проверить корректность номера канала
mov bx, [ChannelNumber] movzx ebx, [ChannelNumber]
cmp bx, 1 dec ebx
jb @@Err3 cmp ebx, 1
cmp bx, 2
ja @@Err3 ja @@Err3
; Установить базовый адрес ; Установить базовый адрес
dec bx shl ebx, 1
shl bx, 1
movzx ebx, bx
mov ax, [ebx+StandardATABases] mov ax, [ebx+StandardATABases]
mov [ATABasePortAddr], ax mov [ATABasePortAddr], ax
; Ожидание готовности HDD к приему команды ; Ожидание готовности HDD к приему команды
@ -449,16 +442,12 @@ ReadCD_ID:
;************************************************* ;*************************************************
DeviceReset: DeviceReset:
; Проверить корректность номера канала ; Проверить корректность номера канала
mov bx, [ChannelNumber] movzx ebx, [ChannelNumber]
cmp bx, 1 dec ebx
jb @@Err3_2 cmp ebx, 1
cmp bx, 2
ja @@Err3_2 ja @@Err3_2
; Установить базовый адрес ; Установить базовый адрес
dec bx shl ebx, 1
shl bx, 1
movzx ebx, bx
mov dx, [ebx+StandardATABases] mov dx, [ebx+StandardATABases]
mov [ATABasePortAddr], dx mov [ATABasePortAddr], dx
; Выбрать нужный диск ; Выбрать нужный диск

File diff suppressed because it is too large Load Diff

View File

@ -5239,7 +5239,7 @@ syscall_cdaudio:
shr eax, 1 shr eax, 1
and eax, 1 and eax, 1
inc eax inc eax
mov [ChannelNumber], ax mov [ChannelNumber], al
mov eax, ecx mov eax, ecx
and eax, 1 and eax, 1
mov [DiskNumber], al mov [DiskNumber], al