Browse Source

[romprefix] Treat 0xffffffff as an error return from PMM

PMM defines the return code 0xffffffff as meaning "unsupported
function".  It's hard to imagine a PMM BIOS that doesn't support
pmmAllocate(), but apparently such things do exist.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
b9ef880c8d
1 changed files with 13 additions and 9 deletions
  1. 13
    9
      src/arch/i386/prefix/romprefix.S

+ 13
- 9
src/arch/i386/prefix/romprefix.S View File

@@ -342,7 +342,7 @@ pmm_scan:
342 342
 	movw	$get_pmm_image_source, %bp
343 343
 	call	get_pmm
344 344
 	movl	%esi, image_source
345
-	jc	1f
345
+	jz	1f
346 346
 	/* Copy ROM to image source PMM block */
347 347
 	pushw	%es
348 348
 	xorw	%ax, %ax
@@ -448,7 +448,7 @@ no_pmm:
448 448
  *  %es:0000 : PMM structure
449 449
  * Returns:
450 450
  *  %ebx : PMM handle
451
- *  %esi : allocated block address, or zero (with CF set) if allocation failed
451
+ *  %esi : allocated block address, or zero (with ZF set) if allocation failed
452 452
  */
453 453
 get_pmm:
454 454
 	/* Preserve registers */
@@ -464,7 +464,10 @@ get_pmm_find:
464 464
 	pushw	%dx
465 465
 	pushw	%ax
466 466
 	popl	%esi
467
-	testl	%esi, %esi
467
+	/* Treat 0xffffffff (not supported) as 0x00000000 (not found) */
468
+	incl	%esi
469
+	jz	get_pmm_allocate
470
+	decl	%esi
468 471
 	jz	get_pmm_allocate
469 472
 	/* Block found - check acceptability */
470 473
 	call	*%bp
@@ -484,19 +487,20 @@ get_pmm_allocate:
484 487
 	pushw	%ax
485 488
 	popl	%esi
486 489
 	movw	$( '+' ), %di	/* Indicate allocation attempt */
487
-	testl	%esi, %esi
488
-	jnz	get_pmm_done
489
-	stc
490 490
 get_pmm_done:
491 491
 	/* Print block address */
492
-	pushfw
493 492
 	movw	%di, %ax
494 493
 	xorw	%di, %di
495 494
 	call	print_character
496 495
 	movl	%esi, %eax
497 496
 	call	print_hex_dword
498
-	popfw
499
-	/* Restore registers and return */
497
+	/* Treat 0xffffffff (not supported) as 0x00000000 (allocation
498
+	 * failed), and set ZF to indicate a zero result.
499
+	 */
500
+	incl	%esi
501
+	jz	1f
502
+	decl	%esi
503
+1:	/* Restore registers and return */
500 504
 	popw	%di
501 505
 	popl	%eax
502 506
 	ret

Loading…
Cancel
Save