mirror of
https://github.com/simh/simh.git
synced 2026-01-26 04:01:38 +00:00
DISK: Fix VHD to Ensure that the CHS capacity exceeds the disk length
If the total sectors exceeds 127Gb this is not possible, but normal simh disks are smaller and the largest user settable size via RAUSER is just under 1Tb. The excessive size case (>127Gb) will have a CHS of 0xFFFF10FF. simh never cares about the CHS Disk Geometry value in the VHD footer data structure, but other applications which do care about the CHS value using the previously incorrect value as the capacity of the disk even though the Current Size indicated in the footer may have been larger.
This commit is contained in:
committed by
Mark Pizzolato
parent
292286b568
commit
93347076a1
@@ -6515,7 +6515,7 @@ if (1) { /* CHS Calculation */
|
||||
cylinderTimesHeads = totalSectors / sectorsPerTrack;
|
||||
}
|
||||
}
|
||||
cylinders = cylinderTimesHeads / heads;
|
||||
cylinders = (totalSectors + sectorsPerTrack * heads - 1) / (sectorsPerTrack * heads);
|
||||
Footer.DiskGeometry = NtoHl ((cylinders<<16)|(heads<<8)|sectorsPerTrack);
|
||||
}
|
||||
Footer.Checksum = NtoHl (CalculateVhdFooterChecksum(&Footer, sizeof(Footer)));
|
||||
|
||||
Reference in New Issue
Block a user