[syslinux] Problems booting with memdisk, with fix

Neil Newell nk at icenoir.net
Thu Aug 12 04:44:50 PDT 2004


Hi,

We have a number of HP PC's which were refusing to netboot both floppy and
hard disk images with memdisk. Testing the problem under DOS for
simplicity, the cause was because the INT 13 AH=0 Disk Reset function call
is passed on to the BIOS by memdisk, and it appears that AMI's BIOS (V2.00)
returns with the carry set flag if there are no (physical) disks present.

This causes a failure in the bootstrap, because it checks for an error
return from the 'Disk Reset' BIOS call - if it receives one it gives up,
assuming the system to be non-bootable.

This is likely to be a common problem for people booting completely
diskless terminals (at least with AMI BIOS) via memdisk, and quitre
possibly also terminals where the floppy is provided via USB.

The solution we've adopted is to pass the Disk Reset call on to the BIOS
via a call rather than a jump. This means we get control back afterwards,
and can zero out the error status before returning to the caller. It seems
unlikely that an error return from a Disk Reset is of much use anyway, so
this patch shouldn't have much of a downside, if any.

Patch is against syslinux-2.10

8<=================================================================
--- memdisk.asm.orig	Thu Aug 12 10:51:01 2004
+++ memdisk.asm	Thu Aug 12 12:02:11 2004
@@ -185,15 +185,17 @@
 		; BIOS equipment byte, top two bits + 1 == total # of floppies
 		test byte [es:0x410],0C0h	
 		jz success
-		; ... otherwise pass it to the BIOS
+		; ... otherwise pass it to the BIOS. This is done with a call
+		; rather than a jump so we regain control and can force the
+		; return status to "ok" - this is because some BIOS's return
+		; an error if there are no drives present, and this screws up
+		; bootstrap routines (e.g. DOS gives "Non-System disk or
+		; Disk Error") - NN 12-Aug-04.
 .pass_on:
-		pop ax			; Drop return address
-		popad			; Restore all registers
-		pop es
-		pop ds
-		lss esp,[cs:Stack]	; Restore the stack
-		and dl,80h		; Clear all but the type bit
-		jmp far [cs:OldInt13]
+		pushf
+		call far [cs:OldInt13] ; Call the BIOS
+		xor ax,ax		; Force success result
+		ret
 
 
 Invalid:
8<=================================================================

Regards

Neil Newell





More information about the Syslinux mailing list