|
@@ -561,6 +561,8 @@ static int int13_guess_geometry_hdd ( struct int13_drive *int13, void *scratch,
|
561
|
561
|
struct master_boot_record *mbr = scratch;
|
562
|
562
|
struct partition_table_entry *partition;
|
563
|
563
|
unsigned int i;
|
|
564
|
+ unsigned int end_head;
|
|
565
|
+ unsigned int end_sector;
|
564
|
566
|
int rc;
|
565
|
567
|
|
566
|
568
|
/* Default guess is xx/255/63 */
|
|
@@ -586,10 +588,12 @@ static int int13_guess_geometry_hdd ( struct int13_drive *int13, void *scratch,
|
586
|
588
|
*/
|
587
|
589
|
for ( i = 0 ; i < 4 ; i++ ) {
|
588
|
590
|
partition = &mbr->partitions[i];
|
589
|
|
- if ( ! partition->type )
|
|
591
|
+ end_head = PART_HEAD ( partition->chs_end );
|
|
592
|
+ end_sector = PART_SECTOR ( partition->chs_end );
|
|
593
|
+ if ( ! ( partition->type && end_head && end_sector ) )
|
590
|
594
|
continue;
|
591
|
|
- *heads = ( PART_HEAD ( partition->chs_end ) + 1 );
|
592
|
|
- *sectors = PART_SECTOR ( partition->chs_end );
|
|
595
|
+ *heads = ( end_head + 1 );
|
|
596
|
+ *sectors = end_sector;
|
593
|
597
|
DBGC ( int13, "INT13 drive %02x guessing C/H/S xx/%d/%d based "
|
594
|
598
|
"on partition %d\n",
|
595
|
599
|
int13->drive, *heads, *sectors, ( i + 1 ) );
|