diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-08-08 14:36:10 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-08-08 15:32:28 +0100 |
commit | 7a3a159af54d48158cb260f05043d8b503de7992 (patch) | |
tree | 0b8d0026c00cc004e25fd20dcaaca32e0529dab3 | |
parent | ad66465b3c436b828d9631e41deb00f5a32f606a (diff) | |
download | ipxe-7a3a159af54d48158cb260f05043d8b503de7992.tar.gz |
[romprefix] Cope with PnP BIOSes that fail to set %es:%di on entry
Some BIOSes support the BIOS Boot Specification (BBS) but fail to set
%es:%di correctly when calling the option ROM initialisation entry
point. This causes gPXE to identify the BIOS as non-PnP (and so
non-BBS), leaving the user unable to control the boot order.
Fix by scanning for the $PnP signature ourselves, rather than relying
on the BIOS having passed in %es:%di correctly.
Tested-by: Helmut Adrigan <helmut.adrigan@chello.at>
-rw-r--r-- | src/arch/i386/prefix/romprefix.S | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S index a4cfb5a0f..4b9d5447d 100644 --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S @@ -238,24 +238,37 @@ no_pci3: popl %edx popl %ebx - /* Check for PnP BIOS */ - testw $0x0f, %bx /* PnP signature must be aligned - bochs */ - jnz no_bbs /* uses unalignment to indicate 'fake' PnP. */ - cmpl $PNP_SIGNATURE, %es:0(%bx) - jne no_bbs + /* Check for PnP BIOS. Although %es:di should point to the + * PnP BIOS signature on entry, some BIOSes fail to do this. + */ + movw $( 0xf000 - 1 ), %bx +pnp_scan: + incw %bx + jz no_pnp + movw %bx, %es + cmpl $PNP_SIGNATURE, %es:0 + jne pnp_scan + xorw %dx, %dx + xorw %si, %si + movzbw %es:5, %cx +1: es lodsb + addb %al, %dl + loop 1b + jnz pnp_scan /* Is PnP: print PnP message */ movw $init_message_pnp, %si xorw %di, %di call print_message /* Check for BBS */ - pushw %es:0x1b(%bx) /* Real-mode data segment */ + pushw %es:0x1b /* Real-mode data segment */ pushw %ds /* &(bbs_version) */ pushw $bbs_version pushw $PNP_GET_BBS_VERSION - lcall *%es:0xd(%bx) + lcall *%es:0xd addw $8, %sp testw %ax, %ax je got_bbs +no_pnp: /* Not PnP-compliant - therefore cannot be BBS-compliant */ no_bbs: /* Not BBS-compliant - must hook INT 19 */ movw $init_message_int19, %si xorw %di, %di |