2009-09-17 13:55:38 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
2012-04-02 17:18:46 +02:00
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;**************************************************************************
|
|
|
|
|
;
|
|
|
|
|
; [cache_ide[X]_pointer]
|
|
|
|
|
; or [cache_ide[X]_data_pointer] first entry in cache list
|
|
|
|
|
;
|
|
|
|
|
; +0 - lba sector
|
|
|
|
|
; +4 - state of cache sector
|
|
|
|
|
; 0 = empty
|
|
|
|
|
; 1 = used for read ( same as in hd )
|
|
|
|
|
; 2 = used for write ( differs from hd )
|
|
|
|
|
;
|
|
|
|
|
; [cache_ide[X]_system_data]
|
|
|
|
|
; or [cache_ide[x]_appl_data] - cache entries
|
|
|
|
|
;
|
|
|
|
|
;**************************************************************************
|
|
|
|
|
|
2012-04-02 17:18:46 +02:00
|
|
|
|
$Revision $
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
write_cache:
|
|
|
|
|
;-----------------------------------------------------------
|
|
|
|
|
; write all changed sectors to disk
|
|
|
|
|
;-----------------------------------------------------------
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax ecx edx esi edi
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
; write difference ( 2 ) from cache to hd
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call calculate_cache
|
|
|
|
|
add esi, 8
|
|
|
|
|
mov edi, 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
write_cache_more:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp dword [esi+4], 2; if cache slot is not different
|
|
|
|
|
jne .write_chain
|
|
|
|
|
mov dword [esi+4], 1; same as in hd
|
|
|
|
|
mov eax, [esi] ; eax = sector to write
|
|
|
|
|
cmp eax, [PARTITION_START]
|
|
|
|
|
jb danger
|
|
|
|
|
cmp eax, [PARTITION_END]
|
|
|
|
|
ja danger
|
2009-09-17 13:55:38 +02:00
|
|
|
|
cmp [hdpos], 0x80
|
|
|
|
|
jae @f
|
|
|
|
|
; DMA write is permitted only if [allow_dma_access]=1
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [allow_dma_access], 2
|
|
|
|
|
jae .nodma
|
|
|
|
|
cmp [dma_hdd], 1
|
|
|
|
|
jnz .nodma
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
|
|
|
|
; <EFBFBD><EFBFBD>ꥤ<EFBFBD><EFBFBD>塞 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 楯<EFBFBD>窨 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᥪ<EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>饭<EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp ecx, 1
|
|
|
|
|
jz .nonext
|
|
|
|
|
cmp dword [esi+8+4], 2
|
|
|
|
|
jnz .nonext
|
|
|
|
|
push eax
|
|
|
|
|
inc eax
|
|
|
|
|
cmp eax, [esi+8]
|
|
|
|
|
pop eax
|
|
|
|
|
jnz .nonext
|
|
|
|
|
cmp [cache_chain_started], 1
|
|
|
|
|
jz @f
|
|
|
|
|
mov [cache_chain_started], 1
|
|
|
|
|
mov [cache_chain_size], 0
|
|
|
|
|
mov [cache_chain_pos], edi
|
|
|
|
|
mov [cache_chain_ptr], esi
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
inc [cache_chain_size]
|
|
|
|
|
cmp [cache_chain_size], 16
|
|
|
|
|
jnz .continue
|
|
|
|
|
jmp .write_chain
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.nonext:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call flush_cache_chain
|
|
|
|
|
mov [cache_chain_size], 1
|
|
|
|
|
mov [cache_chain_ptr], esi
|
|
|
|
|
call write_cache_sector
|
|
|
|
|
jmp .continue
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.nodma:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call cache_write_pio
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.write_chain:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call flush_cache_chain
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.continue:
|
|
|
|
|
danger:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
add esi, 8
|
|
|
|
|
inc edi
|
|
|
|
|
dec ecx
|
|
|
|
|
jnz write_cache_more
|
|
|
|
|
call flush_cache_chain
|
2009-09-17 13:55:38 +02:00
|
|
|
|
return_02:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
pop edi esi edx ecx eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
flush_cache_chain:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cache_chain_started], 0
|
|
|
|
|
jz @f
|
|
|
|
|
call write_cache_chain
|
|
|
|
|
mov [cache_chain_started], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
find_empty_slot:
|
|
|
|
|
;-----------------------------------------------------------
|
|
|
|
|
; find empty or read slot, flush cache if next 10% is used by write
|
|
|
|
|
; output : edi = cache slot
|
|
|
|
|
;-----------------------------------------------------------
|
|
|
|
|
; push ecx esi
|
|
|
|
|
|
|
|
|
|
search_again:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call calculate_cache_3
|
|
|
|
|
shr ecx, 3
|
2009-09-17 13:55:38 +02:00
|
|
|
|
search_for_empty:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
inc edi
|
|
|
|
|
call calculate_cache_4
|
|
|
|
|
jbe inside_cache
|
|
|
|
|
mov edi, 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inside_cache:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push esi
|
|
|
|
|
call calculate_cache_1
|
|
|
|
|
cmp dword [edi*8+esi+4], 2
|
|
|
|
|
pop esi
|
|
|
|
|
jb found_slot ; it's empty or read
|
|
|
|
|
dec ecx
|
|
|
|
|
jnz search_for_empty
|
|
|
|
|
call write_cache ; no empty slots found, write all
|
|
|
|
|
cmp [hd_error], 0
|
|
|
|
|
jne found_slot_access_denied
|
|
|
|
|
jmp search_again ; and start again
|
2009-09-17 13:55:38 +02:00
|
|
|
|
found_slot:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call calculate_cache_5
|
2009-09-17 13:55:38 +02:00
|
|
|
|
found_slot_access_denied:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
ret
|
2013-03-10 13:28:37 +01:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
clear_hd_cache:
|
|
|
|
|
ret
|
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
2009-09-17 13:55:38 +02:00
|
|
|
|
calculate_cache:
|
|
|
|
|
; mov ecx,cache_max ; entries in cache
|
|
|
|
|
; mov esi,HD_CACHE+8
|
|
|
|
|
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide0_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide0_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov ecx, [cache_ide1_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide1_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide1_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide1_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov ecx, [cache_ide2_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide2_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide2_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide2_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov ecx, [cache_ide3_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide3_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide3_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide3_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size-cache_ide0+eax]
|
|
|
|
|
mov esi, [cache_ide0_pointer-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size-cache_ide0+eax]
|
|
|
|
|
mov esi, [cache_ide0_data_pointer-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
calculate_cache_1:
|
|
|
|
|
; lea esi,[edi*8+HD_CACHE]
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov esi, [cache_ide0_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide0_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov esi, [cache_ide1_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide1_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov esi, [cache_ide2_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide2_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov esi, [cache_ide3_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide3_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
mov esi, [cache_ide0_pointer-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide0_data_pointer-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
calculate_cache_2:
|
|
|
|
|
; add esi,HD_CACHE+65536
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov eax, [cache_ide0_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide0_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov eax, [cache_ide1_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide1_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov eax, [cache_ide2_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide2_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov eax, [cache_ide3_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide3_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
mov eax, [cache_ide0_system_data-cache_ide0+eax]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide0_appl_data-cache_ide0+eax]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
calculate_cache_3:
|
|
|
|
|
; mov ecx,cache_max*10/100
|
|
|
|
|
; mov edi,[cache_search_start]
|
|
|
|
|
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide0_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide0_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov ecx, [cache_ide1_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide1_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide1_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide1_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov ecx, [cache_ide2_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide2_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide2_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide2_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov ecx, [cache_ide3_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide3_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide3_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide3_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size-cache_ide0+eax]
|
|
|
|
|
mov edi, [cache_ide0_search_start-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size-cache_ide0+eax]
|
|
|
|
|
mov edi, [cache_ide0_appl_search_start-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
calculate_cache_4:
|
|
|
|
|
; cmp edi,cache_max
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
cmp edi, [cache_ide0_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide0_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
cmp edi, [cache_ide1_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide1_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
cmp edi, [cache_ide2_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide2_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
cmp edi, [cache_ide3_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide3_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
cmp edi, [cache_ide0_system_sad_size-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide0_appl_sad_size-cache_ide0+eax]
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
calculate_cache_5:
|
|
|
|
|
; mov [cache_search_start],edi
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov [cache_ide0_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide0_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov [cache_ide1_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide1_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov [cache_ide2_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide2_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdpos], 4
|
|
|
|
|
jne .noide
|
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov [cache_ide3_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide3_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.noide:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax, [hdpos]
|
|
|
|
|
sub eax, 80h
|
|
|
|
|
cmp byte [BiosDisksData+eax*4+2], -1
|
|
|
|
|
jz @f
|
|
|
|
|
movzx eax, byte [BiosDisksData+eax*4+2]
|
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, cache_ide0
|
|
|
|
|
jmp .get
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
imul eax, cache_ide1-cache_ide0
|
|
|
|
|
add eax, BiosDiskCaches
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.get:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [hdd_appl_data], 0
|
|
|
|
|
jne .bd_appl_data
|
|
|
|
|
mov [cache_ide0_search_start-cache_ide0+eax], edi
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.bd_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide0_appl_search_start-cache_ide0+eax], edi
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
find_empty_slot_CD_cache:
|
|
|
|
|
;-----------------------------------------------------------
|
|
|
|
|
; find empty or read slot, flush cache if next 10% is used by write
|
|
|
|
|
; output : edi = cache slot
|
|
|
|
|
;-----------------------------------------------------------
|
|
|
|
|
.search_again:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call cd_calculate_cache_3
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.search_for_empty:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
inc edi
|
|
|
|
|
call cd_calculate_cache_4
|
|
|
|
|
jbe .inside_cache
|
|
|
|
|
mov edi, 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.inside_cache:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call cd_calculate_cache_5
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
clear_CD_cache:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
pusha
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
xor eax, eax
|
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
mov [cache_ide0_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide0_pointer]
|
|
|
|
|
call .clear
|
|
|
|
|
mov [cache_ide0_appl_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide0_data_pointer]
|
|
|
|
|
jmp .continue
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
mov [cache_ide1_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide1_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide1_pointer]
|
|
|
|
|
call .clear
|
|
|
|
|
mov [cache_ide1_appl_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide1_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide1_data_pointer]
|
|
|
|
|
jmp .continue
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
mov [cache_ide2_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide2_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide2_pointer]
|
|
|
|
|
call .clear
|
|
|
|
|
mov [cache_ide2_appl_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide2_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide2_data_pointer]
|
|
|
|
|
jmp .continue
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide3_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide3_system_sad_size]
|
|
|
|
|
mov edi, [cache_ide3_pointer]
|
|
|
|
|
call .clear
|
|
|
|
|
mov [cache_ide3_appl_search_start], eax
|
|
|
|
|
mov ecx, [cache_ide3_appl_sad_size]
|
|
|
|
|
mov edi, [cache_ide3_data_pointer]
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.continue:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
call .clear
|
|
|
|
|
popa
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.clear:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl ecx, 1
|
|
|
|
|
cld
|
|
|
|
|
rep stosd
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache:
|
|
|
|
|
; mov ecx,cache_max ; entries in cache
|
|
|
|
|
; mov esi,HD_CACHE+8
|
|
|
|
|
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov ecx, [cache_ide0_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide0_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide0_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide0_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov ecx, [cache_ide1_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide1_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide1_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide1_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov ecx, [cache_ide2_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide2_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide2_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide2_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov ecx, [cache_ide3_system_sad_size]
|
|
|
|
|
mov esi, [cache_ide3_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, [cache_ide3_appl_sad_size]
|
|
|
|
|
mov esi, [cache_ide3_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache_1:
|
|
|
|
|
; lea esi,[edi*8+HD_CACHE]
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov esi, [cache_ide0_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide0_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov esi, [cache_ide1_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide1_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov esi, [cache_ide2_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide2_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov esi, [cache_ide3_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov esi, [cache_ide3_data_pointer]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache_2:
|
|
|
|
|
; add esi,HD_CACHE+65536
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov eax, [cache_ide0_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide0_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov eax, [cache_ide1_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide1_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov eax, [cache_ide2_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide2_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov eax, [cache_ide3_system_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov eax, [cache_ide3_appl_data]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache_3:
|
|
|
|
|
; mov ecx,cache_max*10/100
|
|
|
|
|
; mov edi,[cache_search_start]
|
|
|
|
|
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov edi, [cache_ide0_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov edi, [cache_ide0_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov edi, [cache_ide1_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov edi, [cache_ide1_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov edi, [cache_ide2_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov edi, [cache_ide2_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov edi, [cache_ide3_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov edi, [cache_ide3_appl_search_start]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache_4:
|
|
|
|
|
; cmp edi,cache_max
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
cmp edi, [cache_ide0_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide0_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
cmp edi, [cache_ide1_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide1_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
cmp edi, [cache_ide2_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide2_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
cmp edi, [cache_ide3_system_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp edi, [cache_ide3_appl_sad_size]
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
cd_calculate_cache_5:
|
|
|
|
|
; mov [cache_search_start],edi
|
|
|
|
|
; 1 - IDE0 ... 4 - IDE3
|
|
|
|
|
.ide0:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 1
|
|
|
|
|
jne .ide1
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide0_appl_data
|
|
|
|
|
mov [cache_ide0_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide0_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide0_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 2
|
|
|
|
|
jne .ide2
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide1_appl_data
|
|
|
|
|
mov [cache_ide1_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide1_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide1_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cdpos], 3
|
|
|
|
|
jne .ide3
|
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide2_appl_data
|
|
|
|
|
mov [cache_ide2_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide2_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide2_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [cd_appl_data], 0
|
|
|
|
|
jne .ide3_appl_data
|
|
|
|
|
mov [cache_ide3_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
.ide3_appl_data:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [cache_ide3_appl_search_start], edi
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;--------------------------------------------------------------------
|
|
|
|
|
;align 4
|
|
|
|
|
;calculate_linear_to_real:
|
|
|
|
|
; shr eax, 12
|
|
|
|
|
; mov eax, [page_tabs+eax*4]
|
|
|
|
|
; and eax, 0xFFFFF000
|
|
|
|
|
; ret
|