Explorar el Código

[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 hace 7 años
padre
commit
f8cf3ceb0b
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5
    5
      src/arch/x86/interface/pcbios/int13.c

+ 5
- 5
src/arch/x86/interface/pcbios/int13.c Ver fichero

@@ -1751,7 +1751,7 @@ static void int13_unhook ( unsigned int drive ) {
1751 1751
  * @ret rc		Return status code
1752 1752
  */
1753 1753
 static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
1754
-	uint8_t status;
1754
+	uint16_t status;
1755 1755
 	int discard_b, discard_c, discard_d;
1756 1756
 	uint16_t magic;
1757 1757
 
@@ -1775,7 +1775,7 @@ static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
1775 1775
 			       : "a" ( 0x0201 ), "b" ( *address ),
1776 1776
 				 "c" ( 1 ), "d" ( drive ) );
1777 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 1779
 		      drive, status );
1780 1780
 		return -EIO;
1781 1781
 	}
@@ -1818,7 +1818,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
1818 1818
 		struct eltorito_validation_entry valid;
1819 1819
 		struct eltorito_boot_entry boot;
1820 1820
 	} __attribute__ (( packed )) catalog;
1821
-	uint8_t status;
1821
+	uint16_t status;
1822 1822
 
1823 1823
 	/* Use INT 13, 4d to read the boot catalog */
1824 1824
 	__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
@@ -1833,7 +1833,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
1833 1833
 				 "S" ( __from_data16 ( &eltorito_cmd ) ) );
1834 1834
 	if ( status ) {
1835 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 1837
 		return -EIO;
1838 1838
 	}
1839 1839
 	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 ) {
1880 1880
 				 "S" ( __from_data16 ( &eltorito_address ) ) );
1881 1881
 	if ( status ) {
1882 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 1884
 		return -EIO;
1885 1885
 	}
1886 1886
 

Loading…
Cancelar
Guardar