Rev 3908 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3908 | Rev 5201 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line -... | Line 8... | ||
- | 8 | $Revision: 5201 $ |
|
8 | $Revision: 3908 $ |
9 | |
Line 9... | Line 10... | ||
9 | 10 | ;----------------------------------------------------------------------------- |
|
10 | pusha |
11 | pusha |
11 | 12 | ||
Line 18... | Line 19... | ||
18 | ; translate pages in butes *4096 |
19 | ; translate pages in butes *4096 |
19 | shl eax, 12 |
20 | shl eax, 12 |
20 | ; check a upper size of the cache, no more than 1 Mb on the physical device |
21 | ; check a upper size of the cache, no more than 1 Mb on the physical device |
21 | cmp eax, 1024*1024 |
22 | cmp eax, 1024*1024 |
22 | jbe @f |
23 | jbe @f |
- | 24 | ||
23 | mov eax, 1024*1024 |
25 | mov eax, 1024*1024 |
24 | jmp .continue |
26 | jmp .continue |
- | 27 | ;-------------------------------------- |
|
25 | @@: |
28 | @@: |
26 | ; check a lower size of the cache, not less than 128 Kb on the physical device |
29 | ; check a lower size of the cache, not less than 128 Kb on the physical device |
27 | cmp eax, 128*1024 |
30 | cmp eax, 128*1024 |
28 | jae @f |
31 | jae .continue |
- | 32 | ||
29 | mov eax, 128*1024 |
33 | mov eax, 128*1024 |
30 | @@: |
- | |
- | 34 | ;-------------------------------------- |
|
31 | .continue: |
35 | .continue: |
- | 36 | push ecx |
|
32 | mov [cache_ide0_size], eax |
37 | mov ecx, 12 |
33 | mov [cache_ide1_size], eax |
38 | mov esi, cache_ide0+IDE_CACHE.size |
- | 39 | cld |
|
- | 40 | @@: |
|
34 | mov [cache_ide2_size], eax |
41 | mov [esi], eax |
35 | mov [cache_ide3_size], eax |
42 | add esi, sizeof.IDE_CACHE |
- | 43 | loop @b |
|
- | 44 | ||
- | 45 | pop ecx |
|
- | 46 | ||
36 | xor eax, eax |
47 | xor eax, eax |
37 | mov [hdd_appl_data], 1;al |
48 | mov [hdd_appl_data], 1 ;al |
38 | mov [cd_appl_data], 1 |
49 | mov [cd_appl_data], 1 |
- | 50 | ;-------------------------------------- |
|
- | 51 | test byte [DRIVE_DATA+1], 0x80 |
|
- | 52 | je @f |
|
Line -... | Line 53... | ||
- | 53 | ||
- | 54 | mov esi, cache_ide0 |
|
- | 55 | call get_cache_ide |
|
- | 56 | ;-------------------------------------- |
|
39 | 57 | @@: |
|
40 | test byte [DRIVE_DATA+1], 2 |
58 | test byte [DRIVE_DATA+1], 0x20 |
- | 59 | je @f |
|
41 | je .ide2 |
60 | |
42 | mov esi, cache_ide3 |
61 | mov esi, cache_ide1 |
- | 62 | call get_cache_ide |
|
43 | call get_cache_ide |
63 | ;-------------------------------------- |
44 | .ide2: |
64 | @@: |
45 | test byte [DRIVE_DATA+1], 8 |
65 | test byte [DRIVE_DATA+1], 8 |
- | 66 | je @f |
|
46 | je .ide1 |
67 | |
47 | mov esi, cache_ide2 |
68 | mov esi, cache_ide2 |
- | 69 | call get_cache_ide |
|
48 | call get_cache_ide |
70 | ;-------------------------------------- |
49 | .ide1: |
71 | @@: |
50 | test byte [DRIVE_DATA+1], 0x20 |
72 | test byte [DRIVE_DATA+1], 2 |
- | 73 | je @f |
|
51 | je .ide0 |
74 | |
52 | mov esi, cache_ide1 |
75 | mov esi, cache_ide3 |
- | 76 | call get_cache_ide |
|
53 | call get_cache_ide |
77 | ;-------------------------------------- |
54 | .ide0: |
78 | @@: |
55 | test byte [DRIVE_DATA+1], 0x80 |
79 | test byte [DRIVE_DATA+6], 0x80 |
- | 80 | je @f |
|
56 | je @f |
81 | |
57 | mov esi, cache_ide0 |
82 | mov esi, cache_ide4 |
- | 83 | call get_cache_ide |
|
58 | call get_cache_ide |
84 | ;-------------------------------------- |
- | 85 | @@: |
|
59 | @@: |
86 | test byte [DRIVE_DATA+6], 0x20 |
Line -... | Line 87... | ||
- | 87 | je @f |
|
- | 88 | ||
- | 89 | mov esi, cache_ide5 |
|
- | 90 | call get_cache_ide |
|
- | 91 | ;-------------------------------------- |
|
- | 92 | @@: |
|
- | 93 | test byte [DRIVE_DATA+6], 8 |
|
- | 94 | je @f |
|
- | 95 | ||
- | 96 | mov esi, cache_ide6 |
|
- | 97 | call get_cache_ide |
|
- | 98 | ;-------------------------------------- |
|
- | 99 | @@: |
|
- | 100 | test byte [DRIVE_DATA+6], 2 |
|
- | 101 | je @f |
|
- | 102 | ||
- | 103 | mov esi, cache_ide7 |
|
- | 104 | call get_cache_ide |
|
- | 105 | ;-------------------------------------- |
|
- | 106 | @@: |
|
- | 107 | test byte [DRIVE_DATA+11], 0x80 |
|
- | 108 | je @f |
|
- | 109 | ||
- | 110 | mov esi, cache_ide8 |
|
- | 111 | call get_cache_ide |
|
- | 112 | ;-------------------------------------- |
|
- | 113 | @@: |
|
- | 114 | test byte [DRIVE_DATA+11], 0x20 |
|
- | 115 | je @f |
|
- | 116 | ||
- | 117 | mov esi, cache_ide9 |
|
- | 118 | call get_cache_ide |
|
- | 119 | ;-------------------------------------- |
|
- | 120 | @@: |
|
- | 121 | test byte [DRIVE_DATA+11], 8 |
|
- | 122 | je @f |
|
- | 123 | ||
- | 124 | mov esi, cache_ide10 |
|
- | 125 | call get_cache_ide |
|
- | 126 | ;-------------------------------------- |
|
- | 127 | @@: |
|
- | 128 | test byte [DRIVE_DATA+11], 2 |
|
- | 129 | je end_get_cache |
|
- | 130 | ||
- | 131 | mov esi, cache_ide11 |
|
- | 132 | call get_cache_ide |
|
- | 133 | ||
60 | jmp end_get_cache |
134 | jmp end_get_cache |
61 | 135 | ;----------------------------------------------------------------------------- |
|
62 | get_cache_ide: |
136 | get_cache_ide: |
- | 137 | and [esi+IDE_CACHE.search_start], 0 |
|
63 | and [esi+cache_ide0_search_start-cache_ide0], 0 |
138 | and [esi+IDE_CACHE.appl_search_start], 0 |
- | 139 | ||
64 | and [esi+cache_ide0_appl_search_start-cache_ide0], 0 |
140 | push ecx |
65 | push ecx |
141 | ; DEBUGF 1, "K : IDE_CACHE.size %x\n", [esi+IDE_CACHE.size] |
66 | stdcall kernel_alloc, [esi+cache_ide0_size-cache_ide0] |
142 | stdcall kernel_alloc, [esi+IDE_CACHE.size] |
- | 143 | mov [esi+IDE_CACHE.pointer], eax |
|
67 | mov [esi+cache_ide0_pointer-cache_ide0], eax |
144 | pop ecx |
68 | pop ecx |
145 | |
69 | mov edx, eax |
146 | mov edx, eax |
- | 147 | mov eax, [esi+IDE_CACHE.size] |
|
70 | mov eax, [esi+cache_ide0_size-cache_ide0] |
148 | shr eax, 3 |
71 | shr eax, 3 |
149 | ; DEBUGF 1, "K : IDE_CACHE.system_data_size %x\n", eax |
72 | mov [esi+cache_ide0_system_data_size-cache_ide0], eax |
150 | mov [esi+IDE_CACHE.system_data_size], eax |
- | 151 | mov ebx, eax |
|
73 | mov ebx, eax |
152 | imul eax, 7 |
74 | imul eax, 7 |
153 | ; DEBUGF 1, "K : IDE_CACHE.appl_data_size %x\n", eax |
75 | mov [esi+cache_ide0_appl_data_size-cache_ide0], eax |
154 | mov [esi+IDE_CACHE.appl_data_size], eax |
Line 76... | Line 155... | ||
76 | add ebx, edx |
155 | add ebx, edx |
77 | mov [esi+cache_ide0_data_pointer-cache_ide0], ebx |
156 | mov [esi+IDE_CACHE.data_pointer], ebx |
78 | 157 | ||
79 | .cd: |
158 | .cd: |
80 | push ecx |
159 | push ecx |
81 | mov eax, [esi+cache_ide0_system_data_size-cache_ide0] |
160 | mov eax, [esi+IDE_CACHE.system_data_size] |
82 | call calculate_for_cd |
161 | call calculate_for_cd |
Line 83... | Line 162... | ||
83 | add eax, [esi+cache_ide0_pointer-cache_ide0] |
162 | add eax, [esi+IDE_CACHE.pointer] |
84 | mov [esi+cache_ide0_system_data-cache_ide0], eax |
163 | mov [esi+IDE_CACHE.system_data], eax |
85 | mov [esi+cache_ide0_system_sad_size-cache_ide0], ecx |
164 | mov [esi+IDE_CACHE.system_sad_size], ecx |
86 | 165 | ||
Line 87... | Line 166... | ||
87 | push edi |
166 | push edi |
88 | mov edi, [esi+cache_ide0_pointer-cache_ide0] |
167 | mov edi, [esi+IDE_CACHE.pointer] |
89 | call clear_ide_cache |
168 | call clear_ide_cache |
90 | pop edi |
169 | pop edi |
91 | 170 | ||
Line 92... | Line 171... | ||
92 | mov eax, [esi+cache_ide0_appl_data_size-cache_ide0] |
171 | mov eax, [esi+IDE_CACHE.appl_data_size] |
93 | call calculate_for_cd |
172 | call calculate_for_cd |
94 | add eax, [esi+cache_ide0_data_pointer-cache_ide0] |
173 | add eax, [esi+IDE_CACHE.data_pointer] |
95 | mov [esi+cache_ide0_appl_data-cache_ide0], eax |
174 | mov [esi+IDE_CACHE.appl_data], eax |
Line 96... | Line 175... | ||
96 | mov [esi+cache_ide0_appl_sad_size-cache_ide0], ecx |
175 | mov [esi+IDE_CACHE.appl_sad_size], ecx |
97 | 176 | ||
98 | push edi |
- | |
- | 177 | push edi |
|
99 | mov edi, [esi+cache_ide0_data_pointer-cache_ide0] |
178 | mov edi, [esi+IDE_CACHE.data_pointer] |
100 | call clear_ide_cache |
179 | call clear_ide_cache |
101 | pop edi |
180 | pop edi |
102 | 181 | ||
103 | pop ecx |
182 | pop ecx |
Line 114... | Line 193... | ||
114 | shl ebx, 11 |
193 | shl ebx, 11 |
115 | pop eax |
194 | pop eax |
116 | sub eax, ebx |
195 | sub eax, ebx |
117 | dec ecx |
196 | dec ecx |
118 | ret |
197 | ret |
119 | - | ||
- | 198 | ;----------------------------------------------------------------------------- |
|
120 | clear_ide_cache: |
199 | clear_ide_cache: |
121 | push eax |
200 | push eax |
122 | shl ecx, 1 |
201 | shl ecx, 1 |
123 | xor eax, eax |
202 | xor eax, eax |
124 | cld |
203 | cld |
125 | rep stosd |
204 | rep stosd |
126 | pop eax |
205 | pop eax |
127 | ret |
206 | ret |
128 | - | ||
- | 207 | ;----------------------------------------------------------------------------- |
|
129 | end_get_cache: |
208 | end_get_cache: |
130 | popa |
209 | popa |