Subversion Repositories Kolibri OS

Rev

Rev 593 | Rev 750 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
593 mikedld 1
 
2
3
 
580 mario79 4
5
 
6
;   1/32
7
    shr eax,5
8
;   round off up to 8 pages
9
    shr eax,3
10
    shl eax,3
11
;   translate pages in butes *4096
12
    shl eax,12
13
;       check a upper size of the cache, no more than 1 Mb on the physical device
585 mario79 14
    cmp  eax,1024*1024
580 mario79 15
    jbe  @f
16
    mov  eax,1024*1024
17
    jmp  .continue
18
@@:
19
;       check a lower size of the cache, not less than 128 Kb on the physical device
585 mario79 20
    cmp  eax,128*1024
580 mario79 21
    jae  @f
22
    mov  eax,128*1024
23
@@:
24
.continue:
25
    mov  [cache_ide0_size],eax
26
    mov  [cache_ide1_size],eax
27
    mov  [cache_ide2_size],eax
28
    mov  [cache_ide3_size],eax
29
    xor  eax,eax
30
    mov  [hdd_appl_data],1  ;al
31
    mov  [cd_appl_data],1
585 mario79 32
580 mario79 33
 
709 diamond 34
    mov  cl,ch
35
    and  cl,11b
580 mario79 36
    je	.ide2
585 mario79 37
    mov  esi,cache_ide3
709 diamond 38
    call get_cache_ide
39
.ide2:
580 mario79 40
    mov  cl,ch
41
    shr  cl,2
709 diamond 42
    and  cl,11b
43
    je	.ide1
585 mario79 44
    mov  esi,cache_ide2
709 diamond 45
    call get_cache_ide
46
.ide1:
580 mario79 47
    mov  cl,ch
48
    shr  cl,4
709 diamond 49
    and  cl,11b
50
    je	.ide0
585 mario79 51
    mov  esi,cache_ide1
709 diamond 52
    call get_cache_ide
53
.ide0:
580 mario79 54
    mov  cl,ch
55
    shr  cl,6
709 diamond 56
    and  cl,11b
57
    je	@f
58
    mov  esi,cache_ide0
59
    call get_cache_ide
60
@@:
61
    xor ecx,ecx
62
    cmp [NumBiosDisks],ecx
63
    jz  .endbd
64
    mov esi,BiosDiskCaches
65
.loopbd:
66
    cmp byte [BiosDisksData+ecx*4+2],-1
67
    jnz .contbd
68
    mov eax,[cache_ide0_size]
69
    mov [esi+cache_ide0_size-cache_ide0],eax
70
    push ecx
580 mario79 71
    mov  cl,1
709 diamond 72
    call get_cache_ide
73
    pop  ecx
580 mario79 74
.contbd:
709 diamond 75
    add  esi,cache_ide1-cache_ide0
76
    inc  ecx
77
    cmp  ecx,[NumBiosDisks]
78
    jb   .loopbd
79
.endbd:
80
    jmp  end_get_cache
81
580 mario79 82
 
709 diamond 83
    and  [esi+cache_ide0_search_start-cache_ide0],0
84
    and  [esi+cache_ide0_appl_search_start-cache_ide0],0
85
    push  ecx
580 mario79 86
    stdcall kernel_alloc,[esi+cache_ide0_size-cache_ide0]
709 diamond 87
    mov [esi+cache_ide0_pointer-cache_ide0],eax
88
    pop   ecx
580 mario79 89
    mov  edx,eax
90
    mov  eax,[esi+cache_ide0_size-cache_ide0]
709 diamond 91
    shr  eax,3
580 mario79 92
    mov  [esi+cache_ide0_system_data_size-cache_ide0],eax
709 diamond 93
    mov  ebx,eax
580 mario79 94
    imul eax,7
95
    mov  [esi+cache_ide0_appl_data_size-cache_ide0],eax
709 diamond 96
    add  ebx,edx
580 mario79 97
    mov  [esi+cache_ide0_data_pointer-cache_ide0],ebx
709 diamond 98
585 mario79 99
 
580 mario79 100
    je	.cd
585 mario79 101
    push ecx
580 mario79 102
    mov  eax,[esi+cache_ide0_system_data_size-cache_ide0]
709 diamond 103
    call calculate_for_hd
580 mario79 104
    add  eax,[esi+cache_ide0_pointer-cache_ide0]
709 diamond 105
    mov  [esi+cache_ide0_system_data-cache_ide0],eax
106
    mov  [esi+cache_ide0_system_sad_size-cache_ide0],ecx
107
580 mario79 108
 
109
    mov   edi,[esi+cache_ide0_pointer-cache_ide0]
709 diamond 110
    call  clear_ide_cache
580 mario79 111
    pop   edi
112
113
 
709 diamond 114
    call calculate_for_hd
580 mario79 115
    add  eax,[esi+cache_ide0_data_pointer-cache_ide0]
709 diamond 116
    mov  [esi+cache_ide0_appl_data-cache_ide0],eax
117
    mov  [esi+cache_ide0_appl_sad_size-cache_ide0],ecx
118
585 mario79 119
 
580 mario79 120
    mov   edi,[esi+cache_ide0_data_pointer-cache_ide0]
709 diamond 121
    call  clear_ide_cache
580 mario79 122
    pop   edi
123
585 mario79 124
 
580 mario79 125
    ret
126
.cd:
127
    push ecx
128
    mov  eax,[esi+cache_ide0_system_data_size-cache_ide0]
709 diamond 129
    call calculate_for_cd
580 mario79 130
    add  eax,[esi+cache_ide0_pointer-cache_ide0]
709 diamond 131
    mov  [esi+cache_ide0_system_data-cache_ide0],eax
132
    mov  [esi+cache_ide0_system_sad_size-cache_ide0],ecx
133
580 mario79 134
 
135
    mov   edi,[esi+cache_ide0_pointer-cache_ide0]
709 diamond 136
    call  clear_ide_cache
580 mario79 137
    pop   edi
138
139
 
709 diamond 140
    call calculate_for_cd
580 mario79 141
    add  eax,[esi+cache_ide0_data_pointer-cache_ide0]
709 diamond 142
    mov  [esi+cache_ide0_appl_data-cache_ide0],eax
143
    mov  [esi+cache_ide0_appl_sad_size-cache_ide0],ecx
144
585 mario79 145
 
580 mario79 146
    mov   edi,[esi+cache_ide0_data_pointer-cache_ide0]
709 diamond 147
    call  clear_ide_cache
580 mario79 148
    pop   edi
149
585 mario79 150
 
580 mario79 151
    ret
152
153
 
154
    push eax
155
    mov  ebx,eax
156
    shr  eax,9
157
    shl  eax,3
158
    sub  ebx,eax
159
    shr  ebx,9
160
    mov  ecx,ebx
161
    shl  ebx,9
162
    pop  eax
163
    sub  eax,ebx
164
    dec  ecx
584 mario79 165
    ret
580 mario79 166
167
 
168
    push eax
169
    mov  ebx,eax
170
    shr  eax,11
171
    shl  eax,3
172
    sub  ebx,eax
173
    shr  ebx,11
174
    mov  ecx,ebx
175
    shl  ebx,11
176
    pop  eax
177
    sub  eax,ebx
178
    dec  ecx
584 mario79 179
    ret
580 mario79 180
585 mario79 181
 
580 mario79 182
    push   eax
183
    shl   ecx,1
184
    xor   eax,eax
185
    cld
186
    rep   stosd
187
    pop   eax
188
    ret
189
585 mario79 190
 
580 mario79 191
;    mov  [cache_ide0_pointer],HD_CACHE
192
;    mov  [cache_ide0_system_data],HD_CACHE+65536
193
;    mov  [cache_ide0_system_sad_size],1919
194
    popa
195