Browse Source

[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>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
f8cf3ceb0b
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/arch/x86/interface/pcbios/int13.c

+ 5
- 5
src/arch/x86/interface/pcbios/int13.c View File

1751
  * @ret rc		Return status code
1751
  * @ret rc		Return status code
1752
  */
1752
  */
1753
 static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
1753
 static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
1754
-	uint8_t status;
1754
+	uint16_t status;
1755
 	int discard_b, discard_c, discard_d;
1755
 	int discard_b, discard_c, discard_d;
1756
 	uint16_t magic;
1756
 	uint16_t magic;
1757
 
1757
 
1775
 			       : "a" ( 0x0201 ), "b" ( *address ),
1775
 			       : "a" ( 0x0201 ), "b" ( *address ),
1776
 				 "c" ( 1 ), "d" ( drive ) );
1776
 				 "c" ( 1 ), "d" ( drive ) );
1777
 	if ( status ) {
1777
 	if ( status ) {
1778
-		DBG ( "INT13 drive %02x could not read MBR (status %02x)\n",
1778
+		DBG ( "INT13 drive %02x could not read MBR (status %04x)\n",
1779
 		      drive, status );
1779
 		      drive, status );
1780
 		return -EIO;
1780
 		return -EIO;
1781
 	}
1781
 	}
1818
 		struct eltorito_validation_entry valid;
1818
 		struct eltorito_validation_entry valid;
1819
 		struct eltorito_boot_entry boot;
1819
 		struct eltorito_boot_entry boot;
1820
 	} __attribute__ (( packed )) catalog;
1820
 	} __attribute__ (( packed )) catalog;
1821
-	uint8_t status;
1821
+	uint16_t status;
1822
 
1822
 
1823
 	/* Use INT 13, 4d to read the boot catalog */
1823
 	/* Use INT 13, 4d to read the boot catalog */
1824
 	__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
1824
 	__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
1833
 				 "S" ( __from_data16 ( &eltorito_cmd ) ) );
1833
 				 "S" ( __from_data16 ( &eltorito_cmd ) ) );
1834
 	if ( status ) {
1834
 	if ( status ) {
1835
 		DBG ( "INT13 drive %02x could not read El Torito boot catalog "
1835
 		DBG ( "INT13 drive %02x could not read El Torito boot catalog "
1836
-		      "(status %02x)\n", drive, status );
1836
+		      "(status %04x)\n", drive, status );
1837
 		return -EIO;
1837
 		return -EIO;
1838
 	}
1838
 	}
1839
 	copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
1839
 	copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
1880
 				 "S" ( __from_data16 ( &eltorito_address ) ) );
1880
 				 "S" ( __from_data16 ( &eltorito_address ) ) );
1881
 	if ( status ) {
1881
 	if ( status ) {
1882
 		DBG ( "INT13 drive %02x could not read El Torito boot image "
1882
 		DBG ( "INT13 drive %02x could not read El Torito boot image "
1883
-		      "(status %02x)\n", drive, status );
1883
+		      "(status %04x)\n", drive, status );
1884
 		return -EIO;
1884
 		return -EIO;
1885
 	}
1885
 	}
1886
 
1886
 

Loading…
Cancel
Save