Subversion Repositories Kolibri OS

Rev

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

Rev 5565 Rev 5577
Line 5... Line 5...
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line -...
8
$Revision: 4420 $
-
 
9
 
8
$Revision: 4420 $
10
 
9
 
11
; Access through BIOS by diamond
10
; Disk access through BIOS
12
iglobal
11
iglobal
13
align 4
12
align 4
14
bd_callbacks:
13
bd_callbacks:
Line 21... Line 20...
21
        dd      0       ; no flush function
20
        dd      0       ; no flush function
22
        dd      0       ; use default cache size
21
        dd      0       ; use default cache size
23
.end:
22
.end:
24
endg
23
endg
Line -... Line 24...
-
 
24
 
-
 
25
uglobal
-
 
26
bios_hdpos          dd 0
-
 
27
bios_cur_sector     dd ?
-
 
28
bios_read_len       dd ?
-
 
29
cache_chain_ptr     dd ?
-
 
30
int13_regs_in       rb sizeof.v86_regs
-
 
31
int13_regs_out      rb sizeof.v86_regs
-
 
32
cache_chain_size    db ?
-
 
33
endg
25
 
34
;-----------------------------------------------------------------
26
proc bd_read_interface stdcall uses edi, \
35
proc bd_read_interface stdcall uses edi, \
27
        userdata, buffer, startsector:qword, numsectors
36
        userdata, buffer, startsector:qword, numsectors
28
        ; userdata = old [hdpos] = 80h + index in NumBiosDisks
37
        ; userdata = old [hdpos] = 80h + index in NumBiosDisks
29
        ; buffer = pointer to buffer for data
38
        ; buffer = pointer to buffer for data
Line 74... Line 83...
74
        mov     ecx, ide_mutex
83
        mov     ecx, ide_mutex
75
        call    mutex_unlock
84
        call    mutex_unlock
76
        xor     eax, eax
85
        xor     eax, eax
77
        ret
86
        ret
78
endp
87
endp
79
 
-
 
-
 
88
;-----------------------------------------------------------------
80
proc bd_write_interface stdcall uses esi edi, \
89
proc bd_write_interface stdcall uses esi edi, \
81
        userdata, buffer, startsector:qword, numsectors
90
        userdata, buffer, startsector:qword, numsectors
82
        ; userdata = old [hdpos] = 80h + index in NumBiosDisks
91
        ; userdata = old [hdpos] = 80h + index in NumBiosDisks
83
        ; buffer = pointer to buffer with data
92
        ; buffer = pointer to buffer with data
84
        ; startsector = 64-bit start sector
93
        ; startsector = 64-bit start sector
Line 140... Line 149...
140
        mov     ecx, ide_mutex
149
        mov     ecx, ide_mutex
141
        call    mutex_unlock
150
        call    mutex_unlock
142
        xor     eax, eax
151
        xor     eax, eax
143
        ret
152
        ret
144
endp
153
endp
145
 
-
 
-
 
154
;-----------------------------------------------------------------
146
; This is a stub.
155
; This is a stub.
147
proc bd_querymedia stdcall, hd_data, mediainfo
156
proc bd_querymedia stdcall, hd_data, mediainfo
148
        mov     eax, [mediainfo]
157
        mov     eax, [mediainfo]
149
        mov     [eax+DISKMEDIAINFO.Flags], 0
158
        mov     [eax+DISKMEDIAINFO.Flags], 0
150
        mov     [eax+DISKMEDIAINFO.SectorSize], 512
159
        mov     [eax+DISKMEDIAINFO.SectorSize], 512
151
        or      dword [eax+DISKMEDIAINFO.Capacity], 0xFFFFFFFF
160
        or      dword [eax+DISKMEDIAINFO.Capacity], 0xFFFFFFFF
152
        or      dword [eax+DISKMEDIAINFO.Capacity+4], 0xFFFFFFFF
161
        or      dword [eax+DISKMEDIAINFO.Capacity+4], 0xFFFFFFFF
153
        xor     eax, eax
162
        xor     eax, eax
154
        ret
163
        ret
155
endp
164
endp
156
 
-
 
157
;-----------------------------------------------------------------------------
165
;-----------------------------------------------------------------
158
; \begin{diamond}
-
 
159
uglobal
-
 
160
bios_hdpos      dd 0       ; 0 is invalid value for [hdpos]
-
 
161
bios_cur_sector dd ?
-
 
162
bios_read_len   dd ?
-
 
163
endg
-
 
164
;-----------------------------------------------------------------------------
-
 
165
align 4
-
 
166
bd_read:
166
bd_read:
167
        push    eax
167
        push    eax
168
        push    edx
168
        push    edx
169
        mov     edx, [bios_hdpos]
169
        mov     edx, [bios_hdpos]
170
        cmp     edx, [hdpos]
170
        cmp     edx, [hdpos]
Line 207... Line 207...
207
        jmp     bd_read
207
        jmp     bd_read
208
.readerr:
208
.readerr:
209
.v86err:
209
.v86err:
210
        mov     [hd_error], 1
210
        mov     [hd_error], 1
211
        jmp     hd_read_error
211
        jmp     hd_read_error
212
;-----------------------------------------------------------------------------
212
;-----------------------------------------------------------------
213
align 4
-
 
214
bd_write_cache_chain:
213
bd_write_cache_chain:
215
        pusha
214
        pusha
216
        mov     edi, OS_BASE + 0x9A000
215
        mov     edi, OS_BASE + 0x9A000
217
        movzx   ecx, [cache_chain_size]
216
        movzx   ecx, [cache_chain_size]
218
        push    ecx
217
        push    ecx
Line 232... Line 231...
232
.v86err:
231
.v86err:
233
.writeerr:
232
.writeerr:
234
        popa
233
        popa
235
        mov     [hd_error], 1
234
        mov     [hd_error], 1
236
        jmp     hd_write_error
235
        jmp     hd_write_error
237
;-----------------------------------------------------------------------------
236
;-----------------------------------------------------------------
238
uglobal
-
 
239
int13_regs_in   rb sizeof.v86_regs
-
 
240
int13_regs_out  rb sizeof.v86_regs
-
 
241
endg
-
 
242
;-----------------------------------------------------------------------------
-
 
243
align 4
-
 
244
int13_call:
237
int13_call:
245
; Because this code uses fixed addresses,
238
; Because this code uses fixed addresses,
246
; it can not be run simultaniously by many threads.
239
; it can not be run simultaniously by many threads.
247
; In current implementation it is protected by common mutex 'ide_status'
240
; In current implementation it is protected by common mutex 'ide_status'
248
        mov     word [OS_BASE + 510h], 10h             ; packet length
241
        mov     word [OS_BASE + 510h], 10h             ; packet length
Line 288... Line 281...
288
        test    byte [int13_regs_out+v86_regs.eflags], 1
281
        test    byte [int13_regs_out+v86_regs.eflags], 1
289
        jnz     @f
282
        jnz     @f
290
        mov     edx, ecx
283
        mov     edx, ecx
291
@@:
284
@@:
292
        ret
285
        ret
293
; \end{diamond}
-