[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>
This commit is contained in:
Michael Brown
2012-06-19 18:54:22 +01:00
parent a3cba84bab
commit b9ef880c8d

View File

@@ -342,7 +342,7 @@ pmm_scan:
movw $get_pmm_image_source, %bp movw $get_pmm_image_source, %bp
call get_pmm call get_pmm
movl %esi, image_source movl %esi, image_source
jc 1f jz 1f
/* Copy ROM to image source PMM block */ /* Copy ROM to image source PMM block */
pushw %es pushw %es
xorw %ax, %ax xorw %ax, %ax
@@ -448,7 +448,7 @@ no_pmm:
* %es:0000 : PMM structure * %es:0000 : PMM structure
* Returns: * Returns:
* %ebx : PMM handle * %ebx : PMM handle
* %esi : allocated block address, or zero (with CF set) if allocation failed * %esi : allocated block address, or zero (with ZF set) if allocation failed
*/ */
get_pmm: get_pmm:
/* Preserve registers */ /* Preserve registers */
@@ -464,7 +464,10 @@ get_pmm_find:
pushw %dx pushw %dx
pushw %ax pushw %ax
popl %esi popl %esi
testl %esi, %esi /* Treat 0xffffffff (not supported) as 0x00000000 (not found) */
incl %esi
jz get_pmm_allocate
decl %esi
jz get_pmm_allocate jz get_pmm_allocate
/* Block found - check acceptability */ /* Block found - check acceptability */
call *%bp call *%bp
@@ -484,19 +487,20 @@ get_pmm_allocate:
pushw %ax pushw %ax
popl %esi popl %esi
movw $( '+' ), %di /* Indicate allocation attempt */ movw $( '+' ), %di /* Indicate allocation attempt */
testl %esi, %esi
jnz get_pmm_done
stc
get_pmm_done: get_pmm_done:
/* Print block address */ /* Print block address */
pushfw
movw %di, %ax movw %di, %ax
xorw %di, %di xorw %di, %di
call print_character call print_character
movl %esi, %eax movl %esi, %eax
call print_hex_dword call print_hex_dword
popfw /* Treat 0xffffffff (not supported) as 0x00000000 (allocation
/* Restore registers and return */ * failed), and set ZF to indicate a zero result.
*/
incl %esi
jz 1f
decl %esi
1: /* Restore registers and return */
popw %di popw %di
popl %eax popl %eax
ret ret