mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-26 08:36:49 +03:00
make caching for PnP disks really work
git-svn-id: svn://kolibrios.org@3164 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
edb957dfa2
commit
de94fe74ac
@ -626,8 +626,8 @@ disk_default_flush:
|
||||
|
||||
; The default implementation of DISKFUNC.adjust_cache_size.
|
||||
disk_default_adjust_cache_size:
|
||||
mov eax, [esp+4]
|
||||
ret 4
|
||||
mov eax, [esp+8]
|
||||
ret 8
|
||||
|
||||
; This is an internal function called from 'disk_media_changed' when a new media
|
||||
; is detected. It creates the list of partitions for the media.
|
||||
|
@ -135,7 +135,7 @@ end virtual
|
||||
push esp
|
||||
push edx
|
||||
push [.sector_lo+12]
|
||||
mov ecx, [.cache]
|
||||
mov ecx, [.cache+16]
|
||||
mov eax, edi
|
||||
shl eax, 9
|
||||
add eax, [ecx+DISKCACHE.data]
|
||||
@ -317,7 +317,7 @@ end virtual
|
||||
|
||||
.yes_in_cache_write:
|
||||
|
||||
mov dword [esi+4], 2 ; write - differs from hd
|
||||
mov dword [esi+8], 2 ; write - differs from hd
|
||||
|
||||
shl edi, 9
|
||||
mov ecx, [.cache]
|
||||
@ -373,11 +373,12 @@ find_empty_slot64:
|
||||
; This function is intended to replace the old 'write_cache' function.
|
||||
proc write_cache64 uses ecx edx esi edi, disk:dword
|
||||
locals
|
||||
cache_chain_started dd ?
|
||||
cache_chain_started dd 0
|
||||
cache_chain_size dd ?
|
||||
cache_chain_pos dd ?
|
||||
cache_chain_ptr dd ?
|
||||
endl
|
||||
saved_esi_pos = 16+12 ; size of local variables + size of registers before esi
|
||||
; If there is no cache for this disk, nothing to do.
|
||||
cmp [esi+DISKCACHE.pointer], 0
|
||||
jz .flush
|
||||
@ -465,7 +466,7 @@ endl
|
||||
.write_cache_chain:
|
||||
pusha
|
||||
mov edi, [cache_chain_pos]
|
||||
mov ecx, [ebp-12]
|
||||
mov ecx, [ebp-saved_esi_pos]
|
||||
shl edi, 9
|
||||
add edi, [ecx+DISKCACHE.data]
|
||||
mov ecx, [cache_chain_size]
|
||||
@ -549,7 +550,7 @@ disk_init_cache:
|
||||
|
||||
mov eax, [esi+DISK.SysCache.data_size]
|
||||
push ebx
|
||||
call calculate_for_hd
|
||||
call calculate_for_hd64
|
||||
pop ebx
|
||||
add eax, [esi+DISK.SysCache.pointer]
|
||||
mov [esi+DISK.SysCache.data], eax
|
||||
@ -564,7 +565,7 @@ disk_init_cache:
|
||||
|
||||
mov eax, [esi+DISK.AppCache.data_size]
|
||||
push ebx
|
||||
call calculate_for_hd
|
||||
call calculate_for_hd64
|
||||
pop ebx
|
||||
add eax, [esi+DISK.AppCache.pointer]
|
||||
mov [esi+DISK.AppCache.data], eax
|
||||
@ -590,6 +591,22 @@ disk_init_cache:
|
||||
mov al, 1
|
||||
ret
|
||||
|
||||
calculate_for_hd64:
|
||||
push eax
|
||||
mov ebx, eax
|
||||
shr eax, 9
|
||||
lea eax, [eax*3]
|
||||
shl eax, 2
|
||||
sub ebx, eax
|
||||
shr ebx, 9
|
||||
mov ecx, ebx
|
||||
shl ebx, 9
|
||||
pop eax
|
||||
sub eax, ebx
|
||||
dec ecx
|
||||
ret
|
||||
|
||||
|
||||
; This internal function is called from disk_media_dereference to free the
|
||||
; allocated cache, if there is one.
|
||||
; esi = pointer to DISK structure
|
||||
|
Loading…
Reference in New Issue
Block a user