From e828b2c8b55369039258c8a1435fa38c78f99ce2 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Sat, 21 Jan 2017 00:21:05 +0000 Subject: [PATCH] Enable capacity checks for Protective MBR and GPT git-svn-id: svn://kolibrios.org@6844 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/disk.inc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/trunk/blkdev/disk.inc b/kernel/trunk/blkdev/disk.inc index 506d4f6d9e..343045c985 100644 --- a/kernel/trunk/blkdev/disk.inc +++ b/kernel/trunk/blkdev/disk.inc @@ -923,10 +923,9 @@ endl sub eax, dword[_mylba+0] sbb edx, dword[_mylba+4] cmp eax, dword[ebx+GPTH.AlternateLBA+0] -; DISK.MediaInfo.Capacity is -1 for ATA devices, disable this check for now. -; jnz .fail_free_gpt + jnz .fail_free_gpt cmp edx, dword[ebx+GPTH.AlternateLBA+4] -; jnz .fail_free_gpt + jnz .fail_free_gpt ; Compute GPT Partition Entry Array (GPEA) length in bytes mov eax, [ebx+GPTH.NumberOfPartitionEntries] @@ -1022,15 +1021,14 @@ is_protective_mbr: jnz .exit cmp dword[ecx+8], 1 jnz .exit -; DISK.MediaInfo.Capacity is -1 for ATA devices, disable this check for now. -; cmp dword[esi+DISK.MediaInfo.Capacity+4], eax -; mov edi, 0xFFFFFFFF -; jnz @f -; mov edi, dword[esi+DISK.MediaInfo.Capacity+0] -; dec edi -;@@: -; cmp dword[ecx+12], edi -; jnz .exit + cmp dword[esi+DISK.MediaInfo.Capacity+4], eax + mov edi, 0xFFFFFFFF + jnz @f + mov edi, dword[esi+DISK.MediaInfo.Capacity+0] + dec edi +@@: + cmp dword[ecx+12], edi + jnz .exit ; Check that partition records 1-3 are filled with zero lea edi, [ecx+16]