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