speed up IDE operations

git-svn-id: svn://kolibrios.org@5569 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Pathoswithin 2015-06-17 18:25:55 +00:00
parent 5d45386146
commit 0ad5c3e509
4 changed files with 363 additions and 1042 deletions

View File

@ -7,22 +7,31 @@
$Revision$
; Access through BIOS by diamond
; Disk access through BIOS
iglobal
align 4
bd_callbacks:
dd bd_callbacks.end - bd_callbacks ; strucsize
dd 0 ; no close function
dd 0 ; no closemedia function
dd bd_callbacks.end - bd_callbacks ; strucsize
dd 0 ; no close function
dd 0 ; no closemedia function
dd bd_querymedia
dd bd_read_interface
dd bd_write_interface
dd 0 ; no flush function
dd 0 ; use default cache size
dd 0 ; no flush function
dd 0 ; use default cache size
.end:
endg
uglobal
bios_hdpos dd 0
bios_cur_sector dd ?
bios_read_len dd ?
cache_chain_ptr dd ?
int13_regs_in rb sizeof.v86_regs
int13_regs_out rb sizeof.v86_regs
cache_chain_size db ?
endg
;-----------------------------------------------------------------
proc bd_read_interface stdcall uses edi, \
userdata, buffer, startsector:qword, numsectors
; userdata = old [hdpos] = 80h + index in NumBiosDisks
@ -76,7 +85,7 @@ endl
xor eax, eax
ret
endp
;-----------------------------------------------------------------
proc bd_write_interface stdcall uses esi edi, \
userdata, buffer, startsector:qword, numsectors
; userdata = old [hdpos] = 80h + index in NumBiosDisks
@ -142,7 +151,7 @@ endl
xor eax, eax
ret
endp
;-----------------------------------------------------------------
; This is a stub.
proc bd_querymedia stdcall, hd_data, mediainfo
mov eax, [mediainfo]
@ -153,16 +162,7 @@ proc bd_querymedia stdcall, hd_data, mediainfo
xor eax, eax
ret
endp
;-----------------------------------------------------------------------------
; \begin{diamond}
uglobal
bios_hdpos dd 0 ; 0 is invalid value for [hdpos]
bios_cur_sector dd ?
bios_read_len dd ?
endg
;-----------------------------------------------------------------------------
align 4
;-----------------------------------------------------------------
bd_read:
push eax
push edx
@ -209,8 +209,7 @@ bd_read:
.v86err:
mov [hd_error], 1
jmp hd_read_error
;-----------------------------------------------------------------------------
align 4
;-----------------------------------------------------------------
bd_write_cache_chain:
pusha
mov edi, OS_BASE + 0x9A000
@ -234,20 +233,14 @@ bd_write_cache_chain:
popa
mov [hd_error], 1
jmp hd_write_error
;-----------------------------------------------------------------------------
uglobal
int13_regs_in rb sizeof.v86_regs
int13_regs_out rb sizeof.v86_regs
endg
;-----------------------------------------------------------------------------
align 4
;-----------------------------------------------------------------
int13_call:
; Because this code uses fixed addresses,
; it can not be run simultaniously by many threads.
; In current implementation it is protected by common mutex 'ide_status'
mov word [OS_BASE + 510h], 10h ; packet length
mov word [OS_BASE + 512h], cx ; number of sectors
mov dword [OS_BASE + 514h], 9A000000h ; buffer 9A00:0000
mov word [OS_BASE + 510h], 10h ; packet length
mov word [OS_BASE + 512h], cx ; number of sectors
mov dword [OS_BASE + 514h], 9A000000h ; buffer 9A00:0000
mov dword [OS_BASE + 518h], eax
and dword [OS_BASE + 51Ch], 0
push ebx ecx esi edi
@ -290,4 +283,3 @@ int13_call:
mov edx, ecx
@@:
ret
; \end{diamond}

File diff suppressed because it is too large Load Diff

View File

@ -229,7 +229,6 @@ SLOT_BASE equ (OS_BASE+0x0080000)
VGABasePtr equ (OS_BASE+0x00A0000)
CLEAN_ZONE equ (_CLEAN_ZONE-OS_BASE)
IDE_DMA equ (_IDE_DMA-OS_BASE)
UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000)

View File

@ -533,7 +533,6 @@ align 65536
SB16Buffer rb 65536
align 4096
_IDE_DMA rb 16*512
BUTTON_INFO rb 64*1024
RESERVED_PORTS: rb 64*1024