mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-27 16:59:41 +03:00
Fix parsing of Protective MBR and GPT headers
git-svn-id: svn://kolibrios.org@6828 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
34df6be0da
commit
56b3fa9987
@ -227,7 +227,7 @@ struct GPTH
|
|||||||
HeaderCRC32 dd ?
|
HeaderCRC32 dd ?
|
||||||
; Set this field to zero, compute CRC32 via 0xEDB88320, compare.
|
; Set this field to zero, compute CRC32 via 0xEDB88320, compare.
|
||||||
Reserved dd ?
|
Reserved dd ?
|
||||||
; Myst be zero.
|
; Must be zero.
|
||||||
MyLBA dq ?
|
MyLBA dq ?
|
||||||
; LBA of the sector containing this GPT header.
|
; LBA of the sector containing this GPT header.
|
||||||
AlternateLBA dq ?
|
AlternateLBA dq ?
|
||||||
@ -846,6 +846,7 @@ disk_scan_partitions:
|
|||||||
; This function is called from disk_scan_partitions to validate and parse
|
; This function is called from disk_scan_partitions to validate and parse
|
||||||
; primary and backup GPTs.
|
; primary and backup GPTs.
|
||||||
proc disk_scan_gpt
|
proc disk_scan_gpt
|
||||||
|
push ecx
|
||||||
; Scan primary GPT (second sector)
|
; Scan primary GPT (second sector)
|
||||||
stdcall scan_gpt, 1, 0
|
stdcall scan_gpt, 1, 0
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -864,6 +865,7 @@ proc disk_scan_gpt
|
|||||||
DEBUGF 1, 'K : Backup GPT is also corrupt, fallback to legacy MBR\n'
|
DEBUGF 1, 'K : Backup GPT is also corrupt, fallback to legacy MBR\n'
|
||||||
.exit:
|
.exit:
|
||||||
; Return value is ZF
|
; Return value is ZF
|
||||||
|
pop ecx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -955,8 +957,8 @@ endl
|
|||||||
mov al, DISKFUNC.read
|
mov al, DISKFUNC.read
|
||||||
stdcall disk_call_driver, edi, dword[ebx+GPTH.PartitionEntryLBA+0], \
|
stdcall disk_call_driver, edi, dword[ebx+GPTH.PartitionEntryLBA+0], \
|
||||||
dword[ebx+GPTH.PartitionEntryLBA+4], esp
|
dword[ebx+GPTH.PartitionEntryLBA+4], esp
|
||||||
pop ecx
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
pop eax
|
||||||
jnz .fail_free_gpea_gpt
|
jnz .fail_free_gpea_gpt
|
||||||
; Compute and check CRC32 of GPEA
|
; Compute and check CRC32 of GPEA
|
||||||
mov edx, [ebx+GPTH.PartitionEntryArrayCRC32]
|
mov edx, [ebx+GPTH.PartitionEntryArrayCRC32]
|
||||||
@ -1009,12 +1011,12 @@ endp
|
|||||||
is_protective_mbr:
|
is_protective_mbr:
|
||||||
push ecx edi
|
push ecx edi
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cmp [ecx-6], eax
|
; cmp [ecx-6], eax
|
||||||
jnz .exit
|
; jnz .exit
|
||||||
cmp [ecx-2], eax
|
cmp [ecx-2], ax
|
||||||
jnz .exit
|
jnz .exit
|
||||||
; Partition record 0 has specific fields
|
; Partition record 0 has specific fields
|
||||||
cmp dword[ecx+0], 0x00020000
|
cmp [ecx+0], al
|
||||||
jnz .exit
|
jnz .exit
|
||||||
cmp byte[ecx+4], 0xEE
|
cmp byte[ecx+4], 0xEE
|
||||||
jnz .exit
|
jnz .exit
|
||||||
|
Loading…
Reference in New Issue
Block a user