Subversion Repositories Kolibri OS

Rev

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

Rev 3539 Rev 3742
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2011-2012. 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: 3539 $
8
$Revision: 3742 $
9
 
9
 
10
; This function is intended to replace the old 'hd_read' function when
10
; This function is intended to replace the old 'hd_read' function when
11
; [hdd_appl_data] = 0, so its input/output parameters are the same, except
11
; [hdd_appl_data] = 0, so its input/output parameters are the same, except
12
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
12
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
13
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
13
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
14
; eax is relative to partition start
14
; eax is relative to partition start
15
; out: eax = error code; 0 = ok
-
 
16
fs_read32_sys:
-
 
17
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
-
 
18
; this request should be processed by hd_read.
-
 
19
        cmp     [ebp+PARTITION.Disk], 'old'
-
 
20
        jnz     @f
-
 
21
        add     eax, dword [ebp+PARTITION.FirstSector]
-
 
22
        mov     [hdd_appl_data], 0
-
 
23
        call    hd_read
-
 
24
        mov     [hdd_appl_data], 1      ; restore to default state
-
 
25
        mov     eax, [hd_error]
-
 
26
        ret
15
; out: eax = error code; 0 = ok
27
@@:
-
 
28
; In the normal case, save ecx, set ecx to SysCache and let the common part
16
fs_read32_sys:
29
; do its work.
17
; Save ecx, set ecx to SysCache and let the common part do its work.
30
        push    ecx
18
        push    ecx
31
        mov     ecx, [ebp+PARTITION.Disk]
19
        mov     ecx, [ebp+PARTITION.Disk]
Line 37... Line 25...
37
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
25
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
38
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
26
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
39
; eax is relative to partition start
27
; eax is relative to partition start
40
; out: eax = error code; 0 = ok
28
; out: eax = error code; 0 = ok
41
fs_read32_app:
29
fs_read32_app:
42
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
-
 
43
; this request should be processed by hd_read.
-
 
44
        cmp     [ebp+PARTITION.Disk], 'old'
-
 
45
        jnz     @f
-
 
46
        add     eax, dword [ebp+PARTITION.FirstSector]
-
 
47
        mov     [hdd_appl_data], 1
-
 
48
        call    hd_read
-
 
49
        mov     eax, [hd_error]
-
 
50
        ret
-
 
51
@@:
-
 
52
; In the normal case, save ecx, set ecx to AppCache and let the common part
30
; Save ecx, set ecx to AppCache and let the common part do its work.
53
; do its work.
-
 
54
        push    ecx
31
        push    ecx
55
        mov     ecx, [ebp+PARTITION.Disk]
32
        mov     ecx, [ebp+PARTITION.Disk]
56
        add     ecx, DISK.AppCache
33
        add     ecx, DISK.AppCache
Line 57... Line 34...
57
 
34
 
Line 183... Line 160...
183
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
160
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
184
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
161
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
185
; eax is relative to partition start
162
; eax is relative to partition start
186
; out: eax = error code; 0 = ok
163
; out: eax = error code; 0 = ok
187
fs_write32_sys:
164
fs_write32_sys:
188
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
-
 
189
; this request should be processed by hd_write.
-
 
190
        cmp     [ebp+PARTITION.Disk], 'old'
-
 
191
        jnz     @f
-
 
192
        add     eax, dword [ebp+PARTITION.FirstSector]
-
 
193
        mov     [hdd_appl_data], 0
-
 
194
        call    hd_write
-
 
195
        mov     [hdd_appl_data], 1      ; restore to default state
-
 
196
        mov     eax, [hd_error]
-
 
197
        ret
-
 
198
@@:
-
 
199
; In the normal case, save ecx, set ecx to SysCache and let the common part
165
; Save ecx, set ecx to SysCache and let the common part do its work.
200
; do its work.
-
 
201
        push    ecx
166
        push    ecx
202
        mov     ecx, [ebp+PARTITION.Disk]
167
        mov     ecx, [ebp+PARTITION.Disk]
203
        add     ecx, DISK.SysCache
168
        add     ecx, DISK.SysCache
204
        jmp     fs_write32_common
169
        jmp     fs_write32_common
Line 208... Line 173...
208
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
173
; that it can't use the global variables 'hd_error' and 'hdd_appl_data'.
209
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
174
; in: eax = sector, ebx = buffer, ebp = pointer to PARTITION structure
210
; eax is relative to partition start
175
; eax is relative to partition start
211
; out: eax = error code; 0 = ok
176
; out: eax = error code; 0 = ok
212
fs_write32_app:
177
fs_write32_app:
213
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
-
 
214
; this request should be processed by hd_write.
-
 
215
        cmp     [ebp+PARTITION.Disk], 'old'
-
 
216
        jnz     @f
-
 
217
        add     eax, dword [ebp+PARTITION.FirstSector]
-
 
218
        mov     [hdd_appl_data], 1
-
 
219
        call    hd_write
-
 
220
        mov     eax, [hd_error]
-
 
221
        ret
-
 
222
@@:
-
 
223
; In the normal case, save ecx, set ecx to AppCache and let the common part
178
; Save ecx, set ecx to AppCache and let the common part do its work.
224
; do its work.
-
 
225
        push    ecx
179
        push    ecx
226
        mov     ecx, [ebp+PARTITION.Disk]
180
        mov     ecx, [ebp+PARTITION.Disk]
227
        add     ecx, DISK.AppCache
181
        add     ecx, DISK.AppCache
Line 228... Line 182...
228
 
182
 
Line 620... Line 574...
620
        ret
574
        ret
Line 621... Line 575...
621
 
575
 
622
; This function flushes all modified data from both caches for the given DISK.
576
; This function flushes all modified data from both caches for the given DISK.
623
; esi = pointer to DISK
577
; esi = pointer to DISK
624
disk_sync:
-
 
625
; Compatibility hack: if PARTITION.Disk is 'old', there is no DISK structure,
-
 
626
; this request should be processed by write_cache.
-
 
627
        cmp     esi, 'old'
-
 
628
        jnz     @f
-
 
629
        mov     [hdd_appl_data], 0
-
 
630
        call    write_cache
-
 
631
        mov     [hdd_appl_data], 1
-
 
632
        call    write_cache
-
 
633
        mov     eax, [hd_error]
-
 
634
        ret
-
 
635
@@:
578
disk_sync:
636
; The algorithm is straightforward.
579
; The algorithm is straightforward.
637
        push    esi
580
        push    esi
638
        push    esi     ; for second write_cache64
581
        push    esi     ; for second write_cache64
639
        push    esi     ; for first write_cache64
582
        push    esi     ; for first write_cache64