Subversion Repositories Kolibri OS

Rev

Rev 837 | Rev 887 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 837 Rev 864
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. 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 8... Line 8...
8
$Revision: 820 $
8
$Revision: 864 $
9
 
9
 
10
 
10
 
Line 131... Line 131...
131
        neg     eax
131
        neg     eax
132
        mov     ecx, eax
132
        mov     ecx, eax
133
        mov     eax, 1
133
        mov     eax, 1
134
        shl     eax, cl
134
        shl     eax, cl
135
.4:
135
.4:
-
 
136
        mov ecx, [ntfs_data.frs_size]
136
        mov     [ntfs_data.iab_size], eax
137
        mov     [ntfs_data.iab_size], eax
137
; allocate space for buffers
138
; allocate space for buffers
138
        add     eax, [ntfs_data.frs_size]
139
        add     ecx, eax
139
        push    eax
140
        mov edx, PG_SW
140
        call    kernel_alloc
141
        call    @mem_alloc@8
141
        test    eax, eax
142
        test    eax, eax
142
        jz      problem_fat_dec_count
-
 
143
        mov     [ntfs_data.frs_buffer], eax
143
        mov     [ntfs_data.frs_buffer], eax
-
 
144
        jz      problem_fat_dec_count
144
        add     eax, [ntfs_data.frs_size]
145
        add     eax, [ntfs_data.frs_size]
145
        mov     [ntfs_data.iab_buffer], eax
146
        mov     [ntfs_data.iab_buffer], eax
146
; read $MFT disposition
147
; read $MFT disposition
147
        mov     eax, [ntfs_data.mft_cluster]
148
        mov     eax, [ntfs_data.mft_cluster]
148
        mul     [ntfs_data.sectors_per_cluster]
149
        mul     [ntfs_data.sectors_per_cluster]
Line 175... Line 176...
175
        call    kernel_free
176
        call    kernel_free
176
        jmp     .fail_free_frs
177
        jmp     .fail_free_frs
177
.mftok:
178
.mftok:
178
; read $MFT table retrieval information
179
; read $MFT table retrieval information
179
; start with one page, increase if not enough (when MFT too fragmented)
180
; start with one page, increase if not enough (when MFT too fragmented)
180
        push    ebx
181
        mov ecx, 0x1000
181
        push    0x1000
182
        mov edx, PG_SW
182
        call    kernel_alloc
183
        call    @mem_alloc@8
183
        pop     ebx
-
 
184
        test    eax, eax
184
        test    eax, eax
185
        jz      .fail_free_frs
185
        jz      .fail_free_frs
186
        mov     [ntfs_data.mft_retrieval], eax
186
        mov     [ntfs_data.mft_retrieval], eax
187
        and     [ntfs_data.mft_retrieval_size], 0
187
        and     [ntfs_data.mft_retrieval_size], 0
188
        mov     [ntfs_data.mft_retrieval_alloc], 0x1000/8
188
        mov     [ntfs_data.mft_retrieval_alloc], 0x1000/8
Line 223... Line 223...
223
        add     esp, 10h
223
        add     esp, 10h
224
; there may be other portions of $DATA attribute in auxiliary records;
224
; there may be other portions of $DATA attribute in auxiliary records;
225
; if they will be needed, they will be loaded later
225
; if they will be needed, they will be loaded later
Line 226... Line 226...
226
 
226
 
227
        mov     [ntfs_data.cur_index_size], 0x1000/0x200
227
        mov     [ntfs_data.cur_index_size], 0x1000/0x200
-
 
228
        mov ecx, 0x1000
228
        push    0x1000
229
        mov edx, PG_SW
229
        call    kernel_alloc
230
        call    @mem_alloc@8
230
        test    eax, eax
-
 
231
        jz      .fail_free_mft
231
        test    eax, eax
-
 
232
        mov     [ntfs_data.cur_index_buf], eax
Line 232... Line 233...
232
        mov     [ntfs_data.cur_index_buf], eax
233
        jz      .fail_free_mft
233
 
234
 
234
        popad
235
        popad
235
        call    free_hd_channel
236
        call    free_hd_channel
Line 239... Line 240...
239
.get_mft_retrieval_ptr:
240
.get_mft_retrieval_ptr:
240
        pushad
241
        pushad
241
        mov     eax, [ntfs_data.mft_retrieval_size]
242
        mov     eax, [ntfs_data.mft_retrieval_size]
242
        cmp     eax, [ntfs_data.mft_retrieval_alloc]
243
        cmp     eax, [ntfs_data.mft_retrieval_alloc]
243
        jnz     .ok
244
        jnz     .ok
-
 
245
 
244
        add     eax, 0x1000/8
246
        lea ecx, [eax+0x1000/8]
245
        mov     [ntfs_data.mft_retrieval_alloc], eax
247
        mov     [ntfs_data.mft_retrieval_alloc], ecx
246
        shl     eax, 3
248
        shl     ecx, 3
247
        push    eax
249
        mov edx, PG_SW
248
        call    kernel_alloc
250
        call    @mem_alloc@8
249
        test    eax, eax
251
        test    eax, eax
250
        jnz     @f
252
        jnz     @f
251
        popad
253
        popad
252
        add     esp, 14h
254
        add     esp, 14h
253
        jmp     .fail_free_mft
255
        jmp     .fail_free_mft
Line 978... Line 980...
978
@@:
980
@@:
979
; reallocate
981
; reallocate
980
        push    eax
982
        push    eax
981
        push    [ntfs_data.cur_index_buf]
983
        push    [ntfs_data.cur_index_buf]
982
        call    kernel_free
984
        call    kernel_free
983
        pop     eax
985
        pop     ecx
984
        mov     [ntfs_data.cur_index_size], eax
986
        mov     [ntfs_data.cur_index_size], ecx
985
        push    eax
987
        mov edx, PG_SW
986
        call    kernel_alloc
988
        call    @mem_alloc@8
987
        test    eax, eax
989
        test    eax, eax
988
        jnz     @f
990
        jnz     @f
989
        and     [ntfs_data.cur_index_size], 0
991
        and     [ntfs_data.cur_index_size], 0
990
        and     [ntfs_data.cur_index_buf], 0
992
        and     [ntfs_data.cur_index_buf], 0
991
        jmp     .stc_ret
993
        jmp     .stc_ret
Line 996... Line 998...
996
.readok1:
998
.readok1:
997
        mov     ebp, [esi+8]    ; subnode_size
999
        mov     ebp, [esi+8]    ; subnode_size
998
        shr     ebp, 9
1000
        shr     ebp, 9
999
        cmp     ebp, [ntfs_data.cur_index_size]
1001
        cmp     ebp, [ntfs_data.cur_index_size]
1000
        jbe     .ok2
1002
        jbe     .ok2
-
 
1003
 
1001
        push    esi ebp
1004
        mov ecx, ebp
1002
        push    ebp
1005
        mov edx, PG_SW
1003
        call    kernel_alloc
1006
        call    @mem_alloc@8
1004
        pop     ebp esi
-
 
1005
        test    eax, eax
1007
        test    eax, eax
1006
        jz      .stc_ret
1008
        jz      .stc_ret
-
 
1009
 
1007
        mov     edi, eax
1010
        mov     edi, eax
1008
        mov     ecx, [ntfs_data.cur_index_size]
1011
        mov     ecx, [ntfs_data.cur_index_size]
1009
        shl     ecx, 9-2
1012
        shl     ecx, 9-2
1010
        rep     movsd
1013
        rep     movsd
1011
        mov     esi, eax
1014
        mov     esi, eax
Line 1324... Line 1327...
1324
@@:
1327
@@:
1325
; reallocate
1328
; reallocate
1326
        push    eax
1329
        push    eax
1327
        push    [ntfs_data.cur_index_buf]
1330
        push    [ntfs_data.cur_index_buf]
1328
        call    kernel_free
1331
        call    kernel_free
1329
        pop     eax
1332
        pop     ecx
1330
        mov     [ntfs_data.cur_index_size], eax
1333
        mov     [ntfs_data.cur_index_size], ecx
1331
        push    eax
1334
        mov edx, PG_SW
1332
        call    kernel_alloc
1335
        call    @mem_alloc@8
1333
        test    eax, eax
1336
        test    eax, eax
1334
        jnz     @f
1337
        jnz     @f
1335
        and     [ntfs_data.cur_index_size], 0
1338
        and     [ntfs_data.cur_index_size], 0
1336
        and     [ntfs_data.cur_index_buf], 0
1339
        and     [ntfs_data.cur_index_buf], 0
1337
.nomem:
1340
.nomem:
Line 1347... Line 1350...
1347
.readok1:
1350
.readok1:
1348
        mov     ebp, [esi+8]    ; subnode_size
1351
        mov     ebp, [esi+8]    ; subnode_size
1349
        shr     ebp, 9
1352
        shr     ebp, 9
1350
        cmp     ebp, [ntfs_data.cur_index_size]
1353
        cmp     ebp, [ntfs_data.cur_index_size]
1351
        jbe     .ok2
1354
        jbe     .ok2
-
 
1355
 
1352
        push    esi ebp
1356
        mov ecx, ebp
1353
        push    ebp
1357
        mov edx, PG_SW
1354
        call    kernel_alloc
1358
        call    @mem_alloc@8
1355
        pop     ebp esi
-
 
1356
        test    eax, eax
1359
        test    eax, eax
1357
        jz      .nomem
1360
        jz      .nomem
-
 
1361
 
1358
        mov     edi, eax
1362
        mov     edi, eax
1359
        mov     ecx, [ntfs_data.cur_index_size]
1363
        mov     ecx, [ntfs_data.cur_index_size]
1360
        shl     ecx, 9-2
1364
        shl     ecx, 9-2
1361
        rep     movsd
1365
        rep     movsd
1362
        mov     esi, eax
1366
        mov     esi, eax