aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2005-08-29 20:23:14 +0000
committerhpa <hpa>2005-08-29 20:23:14 +0000
commit75ed4390a205bf02c8391de94c26a6bf147a5275 (patch)
tree4dd63ac9ef56625243afeb0c8793acf22dd9fe82
parenta255373bf896f2bf0ecc9e61cc9a01f32db965a9 (diff)
downloadsyslinux-75ed4390a205bf02c8391de94c26a6bf147a5275.tar.gz
syslinux-75ed4390a205bf02c8391de94c26a6bf147a5275.tar.xz
syslinux-75ed4390a205bf02c8391de94c26a6bf147a5275.zip
Workaround for the no physical floppy scenario
-rw-r--r--NEWS2
-rw-r--r--memdisk/setup.c25
2 files changed, 13 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index 45037ed9..e23fbd9f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ Changes in 3.11:
handle command lines above 256 characters.
* PXELINUX: revert memory allocation change that caused
problems on some network cards.
+ * MEMDISK: Try work around a bug on some BIOSes when no
+ physical floppy disk is present in the system.
Changes in 3.10:
* gcc 4.0.1 compilation fixes.
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 53ace201..ed349887 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -692,6 +692,10 @@ uint32_t setup(syscall_t cs_syscall, void *cs_bounce)
pptr->drivecnt = regs.edx.b[0]+1;
}
+ /* Discontiguous drive space. There is no really good solution for this. */
+ if ( pptr->drivecnt <= (geometry->driveno & 0x7f) )
+ pptr->drivecnt = (geometry->driveno & 0x7f) + 1;
+
/* Pointer to the command line */
pptr->cmdline_off = bin_size + (nranges+1)*sizeof(ranges[0]);
pptr->cmdline_seg = driverseg;
@@ -718,11 +722,7 @@ uint32_t setup(syscall_t cs_syscall, void *cs_bounce)
if ( geometry->driveno & 0x80 ) {
/* Update BIOS hard disk count */
- int nhd = rdz_8(BIOS_HD_COUNT);
-
- nhd++;
- if ( nhd <= (geometry->driveno & 0x7f) )
- nhd = (geometry->driveno & 0x7f) + 1;
+ uint8_t nhd = pptr->drivecnt;
if ( nhd > 128 )
nhd = 128;
@@ -731,18 +731,15 @@ uint32_t setup(syscall_t cs_syscall, void *cs_bounce)
} else {
/* Update BIOS floppy disk count */
uint8_t equip = rdz_8(BIOS_EQUIP);
- int nflop = (equip & 1) ? (equip >> 6)+1 : 0;
+ uint8_t nflop = pptr->drivecnt;
- nflop++;
- if ( nflop <= geometry->driveno )
- nflop = geometry->driveno + 1;
-
- if ( nflop > 4 )
+ if ( nflop > 4 ) /* Limit of equipment byte */
nflop = 4;
- equip |= 1;
- equip &= ~(3 << 6);
- equip |= (nflop-1) << 6;
+ equip &= 0x3E;
+ if ( nflop )
+ equip |= ((nflop-1) << 6) | 0x01;
+
wrz_8(BIOS_EQUIP, equip);
}