Subversion Repositories Kolibri OS

Rev

Rev 585 | Rev 709 | 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
 
4
 
580 mario79 5
;cache_ide0_size             dd 0   ; not use
6
;cache_ide0_data_pointer     dd 0
7
;cache_ide0_system_data_size dd 0   ; not use
8
;cache_ide0_appl_data_size   dd 0   ; not use
9
;cache_ide0_system_data      dd 0
10
;cache_ide0_appl_data        dd 0
11
;cache_ide0_system_sad_size  dd 0
12
;cache_ide0_appl_sad_size    dd 0
13
14
 
15
16
 
17
;   1/32
18
    shr eax,5
19
;   round off up to 8 pages
20
    shr eax,3
21
    shl eax,3
22
;   translate pages in butes *4096
23
    shl eax,12
24
;       check a upper size of the cache, no more than 1 Mb on the physical device
585 mario79 25
    cmp  eax,1024*1024
580 mario79 26
    jbe  @f
27
    mov  eax,1024*1024
28
    jmp  .continue
29
@@:
30
;       check a lower size of the cache, not less than 128 Kb on the physical device
585 mario79 31
    cmp  eax,128*1024
580 mario79 32
    jae  @f
33
    mov  eax,128*1024
34
@@:
35
.continue:
36
    mov  [cache_ide0_size],eax
37
    mov  [cache_ide1_size],eax
38
    mov  [cache_ide2_size],eax
39
    mov  [cache_ide3_size],eax
40
    xor  eax,eax
41
    mov  [cache_ide0_search_start],eax
42
    mov  [cache_ide0_appl_search_start],eax
43
    mov  [cache_ide1_search_start],eax
44
    mov  [cache_ide1_appl_search_start],eax
45
    mov  [cache_ide2_search_start],eax
46
    mov  [cache_ide2_appl_search_start],eax
47
    mov  [cache_ide3_search_start],eax
48
    mov  [cache_ide3_appl_search_start],eax
49
    mov  [hdd_appl_data],1  ;al
50
    mov  [cd_appl_data],1
585 mario79 51
580 mario79 52
 
53
    mov  ch,cl
54
    and  cl,11b
55
    cmp cl,0
56
    je	.ide2
585 mario79 57
    call get_cache_ide3
580 mario79 58
.ide2:
59
    mov  cl,ch
60
    and  cl,1100b
61
    cmp cl,0
62
    je	.ide1
585 mario79 63
    call get_cache_ide2
580 mario79 64
.ide1:
65
    mov  cl,ch
66
    and  cl,110000b
67
    cmp cl,0
68
    je	.ide0
585 mario79 69
    call get_cache_ide1
580 mario79 70
.ide0:
71
    mov  cl,ch
72
    and  cl,11000000b
73
    cmp cl,0
74
    je	end_get_cache
585 mario79 75
    call get_cache_ide0
580 mario79 76
    jmp  end_get_cache
77
78
 
79
    push  ecx
80
    stdcall kernel_alloc,[cache_ide0_size]
81
    mov [cache_ide0_pointer],eax
82
    pop   ecx
83
    mov  edx,eax
84
    mov  eax,[cache_ide0_size]
85
    shr  eax,3
86
    mov  [cache_ide0_system_data_size],eax
87
    mov  ebx,eax
88
    imul eax,7
89
    mov  [cache_ide0_appl_data_size],eax
90
    add  ebx,edx
91
    mov  [cache_ide0_data_pointer],ebx
92
585 mario79 93
 
580 mario79 94
    je	.cd
585 mario79 95
    push ecx
580 mario79 96
    mov  eax,[cache_ide0_system_data_size]
97
    call calculate_for_hd
98
    add  eax,[cache_ide0_pointer]
99
    mov  [cache_ide0_system_data],eax
100
    mov  [cache_ide0_system_sad_size],ecx
101
585 mario79 102
 
580 mario79 103
    mov   edi,[cache_ide0_pointer]
104
    call  clear_ide_cache
105
    pop   edi
106
585 mario79 107
 
580 mario79 108
    call calculate_for_hd
109
    add  eax,[cache_ide0_data_pointer]
110
    mov  [cache_ide0_appl_data],eax
111
    mov  [cache_ide0_appl_sad_size],ecx
112
113
 
114
    mov   edi,[cache_ide0_data_pointer]
115
    call  clear_ide_cache
116
    pop   edi
117
585 mario79 118
 
580 mario79 119
    ret
120
.cd:
121
    push ecx
122
    mov  eax,[cache_ide0_system_data_size]
123
    call calculate_for_cd
124
    add  eax,[cache_ide0_pointer]
125
    mov  [cache_ide0_system_data],eax
126
    mov  [cache_ide0_system_sad_size],ecx
127
128
 
129
    mov   edi,[cache_ide0_pointer]
130
    call  clear_ide_cache
131
    pop   edi
132
585 mario79 133
 
580 mario79 134
    call calculate_for_cd
135
    add  eax,[cache_ide0_data_pointer]
136
    mov  [cache_ide0_appl_data],eax
137
    mov  [cache_ide0_appl_sad_size],ecx
138
585 mario79 139
 
580 mario79 140
    mov   edi,[cache_ide0_data_pointer]
141
    call  clear_ide_cache
142
    pop   edi
143
585 mario79 144
 
580 mario79 145
    ret
146
585 mario79 147
 
580 mario79 148
    push  ecx
149
    stdcall kernel_alloc,[cache_ide1_size]
150
    mov [cache_ide1_pointer],eax
151
    pop   ecx
152
    mov  edx,eax
153
    mov  eax,[cache_ide1_size]
154
    shr  eax,3
155
    mov  [cache_ide1_system_data_size],eax
156
    mov  ebx,eax
157
    imul eax,7
158
    mov  [cache_ide1_appl_data_size],eax
159
    add  ebx,edx
160
    mov  [cache_ide1_data_pointer],ebx
161
585 mario79 162
 
580 mario79 163
    je	.cd
585 mario79 164
    push ecx
580 mario79 165
    mov  eax,[cache_ide1_system_data_size]
166
    call calculate_for_hd
167
    add  eax,[cache_ide1_pointer]
168
    mov  [cache_ide1_system_data],eax
169
    mov  [cache_ide1_system_sad_size],ecx
170
171
 
172
    mov   edi,[cache_ide1_pointer]
173
    call  clear_ide_cache
174
    pop   edi
175
176
 
177
    call calculate_for_hd
178
    add  eax,[cache_ide1_data_pointer]
179
    mov  [cache_ide1_appl_data],eax
180
    mov  [cache_ide1_appl_sad_size],ecx
181
585 mario79 182
 
580 mario79 183
    mov   edi,[cache_ide1_data_pointer]
184
    call  clear_ide_cache
185
    pop   edi
186
585 mario79 187
 
580 mario79 188
    ret
189
.cd:
190
    push ecx
191
    mov  eax,[cache_ide1_system_data_size]
192
    call calculate_for_cd
193
    add  eax,[cache_ide1_pointer]
194
    mov  [cache_ide1_system_data],eax
195
    mov  [cache_ide1_system_sad_size],ecx
196
197
 
198
    mov   edi,[cache_ide1_pointer]
199
    call  clear_ide_cache
200
    pop   edi
201
202
 
203
    call calculate_for_cd
204
    add  eax,[cache_ide1_data_pointer]
205
    mov  [cache_ide1_appl_data],eax
206
    mov  [cache_ide1_appl_sad_size],ecx
207
585 mario79 208
 
580 mario79 209
    mov   edi,[cache_ide1_data_pointer]
210
    call  clear_ide_cache
211
    pop   edi
212
585 mario79 213
 
580 mario79 214
    ret
215
216
 
217
    push  ecx
218
    stdcall kernel_alloc,[cache_ide2_size]
219
    mov [cache_ide2_pointer],eax
220
    pop   ecx
221
    mov  edx,eax
222
    mov  eax,[cache_ide2_size]
223
    shr  eax,3
224
    mov  [cache_ide2_system_data_size],eax
225
    mov  ebx,eax
226
    imul eax,7
227
    mov  [cache_ide2_appl_data_size],eax
228
    add  ebx,edx
229
    mov  [cache_ide2_data_pointer],ebx
230
585 mario79 231
 
580 mario79 232
    je	.cd
585 mario79 233
    push ecx
580 mario79 234
    mov  eax,[cache_ide2_system_data_size]
235
    call calculate_for_hd
236
    add  eax,[cache_ide2_pointer]
237
    mov  [cache_ide2_system_data],eax
238
    mov  [cache_ide2_system_sad_size],ecx
239
240
 
241
    mov   edi,[cache_ide2_pointer]
242
    call  clear_ide_cache
243
    pop   edi
244
245
 
246
    call calculate_for_hd
247
    add  eax,[cache_ide2_data_pointer]
248
    mov  [cache_ide2_appl_data],eax
249
    mov  [cache_ide2_appl_sad_size],ecx
250
585 mario79 251
 
580 mario79 252
    mov   edi,[cache_ide2_data_pointer]
253
    call  clear_ide_cache
254
    pop   edi
255
585 mario79 256
 
580 mario79 257
    ret
258
.cd:
259
    push ecx
260
    mov  eax,[cache_ide2_system_data_size]
261
    call calculate_for_cd
262
    add  eax,[cache_ide2_pointer]
263
    mov  [cache_ide2_system_data],eax
264
    mov  [cache_ide2_system_sad_size],ecx
265
266
 
267
    mov   edi,[cache_ide2_pointer]
268
    call  clear_ide_cache
269
    pop   edi
270
271
 
272
    call calculate_for_cd
273
    add  eax,[cache_ide2_data_pointer]
274
    mov  [cache_ide2_appl_data],eax
275
    mov  [cache_ide2_appl_sad_size],ecx
276
585 mario79 277
 
580 mario79 278
    mov   edi,[cache_ide2_data_pointer]
279
    call  clear_ide_cache
280
    pop   edi
281
585 mario79 282
 
580 mario79 283
    ret
284
285
 
286
    push  ecx
287
    stdcall kernel_alloc,[cache_ide3_size]
288
    mov [cache_ide3_pointer],eax
289
    pop   ecx
290
    mov  edx,eax
291
    mov  eax,[cache_ide3_size]
292
    shr  eax,3
293
    mov  [cache_ide3_system_data_size],eax
294
    mov  ebx,eax
295
    imul eax,7
296
    mov  [cache_ide3_appl_data_size],eax
297
    add  ebx,edx
298
    mov  [cache_ide3_data_pointer],ebx
299
585 mario79 300
 
580 mario79 301
    je	.cd
585 mario79 302
    push ecx
580 mario79 303
    mov  eax,[cache_ide3_system_data_size]
304
    call calculate_for_hd
305
    add  eax,[cache_ide3_pointer]
306
    mov  [cache_ide3_system_data],eax
307
    mov  [cache_ide3_system_sad_size],ecx
308
309
 
310
    mov   edi,[cache_ide3_pointer]
311
    call  clear_ide_cache
312
    pop   edi
313
314
 
315
    call calculate_for_hd
316
    add  eax,[cache_ide3_data_pointer]
317
    mov  [cache_ide3_appl_data],eax
318
    mov  [cache_ide3_appl_sad_size],ecx
319
585 mario79 320
 
580 mario79 321
    mov   edi,[cache_ide3_data_pointer]
322
    call  clear_ide_cache
323
    pop   edi
324
585 mario79 325
 
580 mario79 326
    ret
327
.cd:
328
    push ecx
329
    mov  eax,[cache_ide3_system_data_size]
330
    call calculate_for_cd
331
    add  eax,[cache_ide3_pointer]
332
    mov  [cache_ide3_system_data],eax
333
    mov  [cache_ide3_system_sad_size],ecx
334
335
 
336
    mov   edi,[cache_ide3_pointer]
337
    call  clear_ide_cache
338
    pop   edi
339
340
 
341
    call calculate_for_cd
342
    add  eax,[cache_ide3_data_pointer]
343
    mov  [cache_ide3_appl_data],eax
344
    mov  [cache_ide3_appl_sad_size],ecx
345
585 mario79 346
 
580 mario79 347
    mov   edi,[cache_ide3_data_pointer]
348
    call  clear_ide_cache
349
    pop   edi
350
585 mario79 351
 
580 mario79 352
    ret
353
354
 
355
    push eax
356
    mov  ebx,eax
357
    shr  eax,9
358
    shl  eax,3
359
    sub  ebx,eax
360
    shr  ebx,9
361
    mov  ecx,ebx
362
    shl  ebx,9
363
    pop  eax
364
    sub  eax,ebx
365
    dec  ecx
584 mario79 366
    ret
580 mario79 367
368
 
369
    push eax
370
    mov  ebx,eax
371
    shr  eax,11
372
    shl  eax,3
373
    sub  ebx,eax
374
    shr  ebx,11
375
    mov  ecx,ebx
376
    shl  ebx,11
377
    pop  eax
378
    sub  eax,ebx
379
    dec  ecx
584 mario79 380
    ret
580 mario79 381
585 mario79 382
 
580 mario79 383
    push   eax
384
    shl   ecx,1
385
    xor   eax,eax
386
    cld
387
    rep   stosd
388
    pop   eax
389
    ret
390
585 mario79 391
 
580 mario79 392
;    mov  [cache_ide0_pointer],HD_CACHE
393
;    mov  [cache_ide0_system_data],HD_CACHE+65536
394
;    mov  [cache_ide0_system_sad_size],1919
395
    popa
396