forked from KolibriOS/kolibrios
Return capacity and bytes per sector of bios disks
This patch makes bd_querymedia return valid Capacity and SectorSize values. Bios disks detection code saves the values to extended BiosDiskData structure, bd_querymedia copies them to DISKMEDIAINFO. git-svn-id: svn://kolibrios.org@6843 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
26611cadd0
commit
dbe9918dc6
@ -31,6 +31,14 @@ int13_regs_in rb sizeof.v86_regs
|
||||
int13_regs_out rb sizeof.v86_regs
|
||||
cache_chain_size db ?
|
||||
endg
|
||||
|
||||
struct BiosDiskData
|
||||
DriveNumber db ?
|
||||
IRQ db ?
|
||||
ATADEVbit dw ?
|
||||
SectorSize dd ?
|
||||
Capacity dq ?
|
||||
ends
|
||||
;-----------------------------------------------------------------
|
||||
proc bd_read_interface stdcall uses edi, \
|
||||
userdata, buffer, startsector:qword, numsectors
|
||||
@ -152,13 +160,18 @@ endl
|
||||
ret
|
||||
endp
|
||||
;-----------------------------------------------------------------
|
||||
; This is a stub.
|
||||
proc bd_querymedia stdcall, hd_data, mediainfo
|
||||
mov eax, [mediainfo]
|
||||
mov [eax+DISKMEDIAINFO.Flags], 0
|
||||
mov [eax+DISKMEDIAINFO.SectorSize], 512
|
||||
or dword [eax+DISKMEDIAINFO.Capacity], 0xFFFFFFFF
|
||||
or dword [eax+DISKMEDIAINFO.Capacity+4], 0xFFFFFFFF
|
||||
mov edx, [mediainfo]
|
||||
mov eax, [hd_data]
|
||||
lea eax, [(eax-80h)*4]
|
||||
lea eax, [BiosDisksData+eax*4]
|
||||
mov [edx+DISKMEDIAINFO.Flags], 0
|
||||
mov ecx, [eax+BiosDiskData.SectorSize]
|
||||
mov [edx+DISKMEDIAINFO.SectorSize], ecx
|
||||
mov ecx, dword [eax+BiosDiskData.Capacity+0]
|
||||
mov eax, dword [eax+BiosDiskData.Capacity+4]
|
||||
mov dword [edx+DISKMEDIAINFO.Capacity+0], ecx
|
||||
mov dword [edx+DISKMEDIAINFO.Capacity+4], eax
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
@ -253,7 +266,8 @@ int13_call:
|
||||
rep stosd
|
||||
mov byte [ebx+v86_regs.eax+1], dl
|
||||
mov eax, [hdpos]
|
||||
lea eax, [BiosDisksData+(eax-80h)*4]
|
||||
lea eax, [(eax-80h)*4]
|
||||
lea eax, [BiosDisksData+eax*4]
|
||||
mov dl, [eax]
|
||||
mov byte [ebx+v86_regs.edx], dl
|
||||
movzx edx, byte [eax+1]
|
||||
|
@ -454,7 +454,7 @@ lba_read_enabled dd ? ; 0 = disabled , 1 = enabled
|
||||
pci_access_enabled dd ? ; 0 = disabled , 1 = enabled
|
||||
|
||||
NumBiosDisks dd ?
|
||||
BiosDisksData rb 200h
|
||||
BiosDisksData rb 200h ; struct BiosDiskData
|
||||
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
|
||||
BiosDiskPartitions rd 80h
|
||||
|
||||
|
@ -11,6 +11,7 @@ $Revision$
|
||||
; Detect all BIOS hard drives.
|
||||
; diamond, 2008
|
||||
; Do not include USB mass storages. CleverMouse, 2013
|
||||
; Read the number of sectors, bytes per sector. dunkaist, 2017
|
||||
|
||||
xor cx, cx
|
||||
mov es, cx
|
||||
@ -65,6 +66,7 @@ bdds:
|
||||
mov al, dl
|
||||
stosb
|
||||
push ds
|
||||
push si
|
||||
lds si, [es:si+1Ah]
|
||||
mov al, [si+6]
|
||||
and al, 0xF
|
||||
@ -82,8 +84,9 @@ bdds:
|
||||
; mov ax, -1
|
||||
@@:
|
||||
stosw
|
||||
pop si
|
||||
pop ds
|
||||
jmp bddc2
|
||||
jmp bddc3
|
||||
.noide:
|
||||
cmp word [es:si], 42h
|
||||
jb .nousb
|
||||
@ -103,6 +106,13 @@ bdds:
|
||||
; stosb
|
||||
; mov ax, -1
|
||||
; stosw
|
||||
bddc3:
|
||||
movzx eax, word[es:si+24]
|
||||
stosd
|
||||
mov eax, [es:si+16]
|
||||
stosd
|
||||
mov eax, [es:si+20]
|
||||
stosd
|
||||
bddc2:
|
||||
cmp cl, [es:0x475]
|
||||
jae bdde
|
||||
|
@ -216,7 +216,8 @@ search_partitions:
|
||||
push 'bd'
|
||||
.bdloop:
|
||||
; 3b. Get the drive number for using in /bd* name.
|
||||
movzx eax, byte [BiosDisksData+esi*4]
|
||||
lea eax, [esi*4]
|
||||
movzx eax, [BiosDisksData+eax*4+BiosDiskData.DriveNumber]
|
||||
sub al, 80h
|
||||
; 3c. Convert eax to decimal and store starting with [esp+3].
|
||||
; First 2 bytes in [esp] are "bd".
|
||||
|
@ -451,6 +451,7 @@ high_code:
|
||||
movzx ecx, byte [esi-1]
|
||||
mov [NumBiosDisks], ecx
|
||||
mov edi, BiosDisksData
|
||||
shl ecx, 2
|
||||
rep movsd
|
||||
|
||||
; -------- Fast System Call init ----------
|
||||
|
Loading…
Reference in New Issue
Block a user