Преглед на файлове

[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 години
родител
ревизия
b9ef880c8d
променени са 1 файла, в които са добавени 13 реда и са изтрити 9 реда
  1. 13
    9
      src/arch/i386/prefix/romprefix.S

+ 13
- 9
src/arch/i386/prefix/romprefix.S Целия файл

342
 	movw	$get_pmm_image_source, %bp
342
 	movw	$get_pmm_image_source, %bp
343
 	call	get_pmm
343
 	call	get_pmm
344
 	movl	%esi, image_source
344
 	movl	%esi, image_source
345
-	jc	1f
345
+	jz	1f
346
 	/* Copy ROM to image source PMM block */
346
 	/* Copy ROM to image source PMM block */
347
 	pushw	%es
347
 	pushw	%es
348
 	xorw	%ax, %ax
348
 	xorw	%ax, %ax
448
  *  %es:0000 : PMM structure
448
  *  %es:0000 : PMM structure
449
  * Returns:
449
  * Returns:
450
  *  %ebx : PMM handle
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
 get_pmm:
453
 get_pmm:
454
 	/* Preserve registers */
454
 	/* Preserve registers */
464
 	pushw	%dx
464
 	pushw	%dx
465
 	pushw	%ax
465
 	pushw	%ax
466
 	popl	%esi
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
 	jz	get_pmm_allocate
471
 	jz	get_pmm_allocate
469
 	/* Block found - check acceptability */
472
 	/* Block found - check acceptability */
470
 	call	*%bp
473
 	call	*%bp
484
 	pushw	%ax
487
 	pushw	%ax
485
 	popl	%esi
488
 	popl	%esi
486
 	movw	$( '+' ), %di	/* Indicate allocation attempt */
489
 	movw	$( '+' ), %di	/* Indicate allocation attempt */
487
-	testl	%esi, %esi
488
-	jnz	get_pmm_done
489
-	stc
490
 get_pmm_done:
490
 get_pmm_done:
491
 	/* Print block address */
491
 	/* Print block address */
492
-	pushfw
493
 	movw	%di, %ax
492
 	movw	%di, %ax
494
 	xorw	%di, %di
493
 	xorw	%di, %di
495
 	call	print_character
494
 	call	print_character
496
 	movl	%esi, %eax
495
 	movl	%esi, %eax
497
 	call	print_hex_dword
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
 	popw	%di
504
 	popw	%di
501
 	popl	%eax
505
 	popl	%eax
502
 	ret
506
 	ret

Loading…
Отказ
Запис