[FREELDR] Workaround for BIOSes that report unusual geometry for CD-ROMs

This is needed for ISO filesystem driver to work correctly,
as it assumes 2048 bytes per sector for CD-ROM media.

Happens on 86Box with board `[i430FX] ASUS P/I-P55TP4XE`,
Bochs emulator with `01/17/97-i440FX-2A69HV3CC-00` BIOS,
and some other real machines.

CORE-20640
This commit is contained in:
Stanislav Motylkov
2026-06-25 19:58:51 +03:00
parent f17d904d2d
commit 2f514a5127
+11
View File
@@ -90,6 +90,7 @@ DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
GEOMETRY Geometry;
ULONGLONG SectorOffset;
ULONGLONG SectorCount;
static BOOLEAN PrintForce = FALSE;
if (DiskReadBufferSize == 0)
{
@@ -141,6 +142,16 @@ DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
if (!Context)
return ENOMEM;
if (DriveType == CdromController && SectorSize != 2048)
{
/* Workaround for CORE-20640 */
if (!PrintForce)
{
ERR("BIOS reports BytesPerSector = %d for CD-ROM, forcing 2048\n", SectorSize);
PrintForce = TRUE;
}
SectorSize = 2048;
}
Context->DriveNumber = DriveNumber;
Context->IsFloppy = (DriveType == FloppyDiskPeripheral);
Context->SectorSize = SectorSize;