mirror of https://github.com/ipxe/ipxe.git
[int13] Test correct return status from INT 13 calls
INT 13 calls return a status value via %ah, with CF set if %ah is non-zero (indicating an error). Our wrappers zero the whole of %ax if CF is clear, to allow C code (which has no easy access to CF) to simply test for a non-zero status to detect an error. The current code assigns the returned status to a uint8_t, effectively testing %al rather than %ah. Fix by treating the returned status as a uint16_t instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/58/merge
parent
fcf7751565
commit
f8cf3ceb0b
|
@ -1751,7 +1751,7 @@ static void int13_unhook ( unsigned int drive ) {
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
|
static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
|
||||||
uint8_t status;
|
uint16_t status;
|
||||||
int discard_b, discard_c, discard_d;
|
int discard_b, discard_c, discard_d;
|
||||||
uint16_t magic;
|
uint16_t magic;
|
||||||
|
|
||||||
|
@ -1775,7 +1775,7 @@ static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
|
||||||
: "a" ( 0x0201 ), "b" ( *address ),
|
: "a" ( 0x0201 ), "b" ( *address ),
|
||||||
"c" ( 1 ), "d" ( drive ) );
|
"c" ( 1 ), "d" ( drive ) );
|
||||||
if ( status ) {
|
if ( status ) {
|
||||||
DBG ( "INT13 drive %02x could not read MBR (status %02x)\n",
|
DBG ( "INT13 drive %02x could not read MBR (status %04x)\n",
|
||||||
drive, status );
|
drive, status );
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -1818,7 +1818,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
|
||||||
struct eltorito_validation_entry valid;
|
struct eltorito_validation_entry valid;
|
||||||
struct eltorito_boot_entry boot;
|
struct eltorito_boot_entry boot;
|
||||||
} __attribute__ (( packed )) catalog;
|
} __attribute__ (( packed )) catalog;
|
||||||
uint8_t status;
|
uint16_t status;
|
||||||
|
|
||||||
/* Use INT 13, 4d to read the boot catalog */
|
/* Use INT 13, 4d to read the boot catalog */
|
||||||
__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
|
__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
|
||||||
|
@ -1833,7 +1833,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
|
||||||
"S" ( __from_data16 ( &eltorito_cmd ) ) );
|
"S" ( __from_data16 ( &eltorito_cmd ) ) );
|
||||||
if ( status ) {
|
if ( status ) {
|
||||||
DBG ( "INT13 drive %02x could not read El Torito boot catalog "
|
DBG ( "INT13 drive %02x could not read El Torito boot catalog "
|
||||||
"(status %02x)\n", drive, status );
|
"(status %04x)\n", drive, status );
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
|
copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
|
||||||
|
@ -1880,7 +1880,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
|
||||||
"S" ( __from_data16 ( &eltorito_address ) ) );
|
"S" ( __from_data16 ( &eltorito_address ) ) );
|
||||||
if ( status ) {
|
if ( status ) {
|
||||||
DBG ( "INT13 drive %02x could not read El Torito boot image "
|
DBG ( "INT13 drive %02x could not read El Torito boot image "
|
||||||
"(status %02x)\n", drive, status );
|
"(status %04x)\n", drive, status );
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue