ソースを参照

[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>
tags/v0.9.8
Michael Brown 15年前
コミット
7a3a159af5
1個のファイルの変更20行の追加7行の削除
  1. 20
    7
      src/arch/i386/prefix/romprefix.S

+ 20
- 7
src/arch/i386/prefix/romprefix.S ファイルの表示

@@ -238,24 +238,37 @@ no_pci3:
238 238
 	popl	%edx
239 239
 	popl	%ebx
240 240
 
241
-	/* Check for PnP BIOS */
242
-	testw	$0x0f, %bx	/* PnP signature must be aligned - bochs    */
243
-	jnz	no_bbs		/* uses unalignment to indicate 'fake' PnP. */
244
-	cmpl	$PNP_SIGNATURE, %es:0(%bx)
245
-	jne	no_bbs
241
+	/* Check for PnP BIOS.  Although %es:di should point to the
242
+	 * PnP BIOS signature on entry, some BIOSes fail to do this.
243
+	 */
244
+	movw	$( 0xf000 - 1 ), %bx
245
+pnp_scan:
246
+	incw	%bx
247
+	jz	no_pnp
248
+	movw	%bx, %es
249
+	cmpl	$PNP_SIGNATURE, %es:0
250
+	jne	pnp_scan
251
+	xorw	%dx, %dx
252
+	xorw	%si, %si
253
+	movzbw	%es:5, %cx
254
+1:	es lodsb
255
+	addb	%al, %dl
256
+	loop	1b
257
+	jnz	pnp_scan
246 258
 	/* Is PnP: print PnP message */
247 259
 	movw	$init_message_pnp, %si
248 260
 	xorw	%di, %di
249 261
 	call	print_message
250 262
 	/* Check for BBS */
251
-	pushw	%es:0x1b(%bx)	/* Real-mode data segment */
263
+	pushw	%es:0x1b	/* Real-mode data segment */
252 264
 	pushw	%ds		/* &(bbs_version) */
253 265
 	pushw	$bbs_version
254 266
 	pushw	$PNP_GET_BBS_VERSION
255
-	lcall	*%es:0xd(%bx)
267
+	lcall	*%es:0xd
256 268
 	addw	$8, %sp
257 269
 	testw	%ax, %ax
258 270
 	je	got_bbs
271
+no_pnp:	/* Not PnP-compliant - therefore cannot be BBS-compliant */
259 272
 no_bbs:	/* Not BBS-compliant - must hook INT 19 */
260 273
 	movw	$init_message_int19, %si
261 274
 	xorw	%di, %di

読み込み中…
キャンセル
保存