瀏覽代碼

[int13] Improve debugging messages

tags/v0.9.8
Michael Brown 15 年之前
父節點
當前提交
b0c818d7b5
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11
    4
      src/arch/i386/interface/pcbios/int13.c

+ 11
- 4
src/arch/i386/interface/pcbios/int13.c 查看文件

@@ -98,6 +98,7 @@ static int int13_rw_sectors ( struct int13_drive *drive,
98 98
 	unsigned long lba;
99 99
 	unsigned int count;
100 100
 	userptr_t buffer;
101
+	int rc;
101 102
 
102 103
 	/* Validate blocksize */
103 104
 	if ( blockdev->blksize != INT13_BLKSIZE ) {
@@ -122,8 +123,10 @@ static int int13_rw_sectors ( struct int13_drive *drive,
122 123
 	      head, sector, lba, ix86->segs.es, ix86->regs.bx, count );
123 124
 
124 125
 	/* Read from / write to block device */
125
-	if ( io ( blockdev, lba, count, buffer ) != 0 )
126
+	if ( ( rc = io ( blockdev, lba, count, buffer ) ) != 0 ) {
127
+		DBG ( "INT 13 failed: %s\n", strerror ( rc ) );
126 128
 		return -INT13_STATUS_READ_ERROR;
129
+	}
127 130
 
128 131
 	return 0;
129 132
 }
@@ -248,6 +251,7 @@ static int int13_extended_rw ( struct int13_drive *drive,
248 251
 	uint64_t lba;
249 252
 	unsigned long count;
250 253
 	userptr_t buffer;
254
+	int rc;
251 255
 
252 256
 	/* Read parameters from disk address structure */
253 257
 	copy_from_real ( &addr, ix86->segs.ds, ix86->regs.si, sizeof ( addr ));
@@ -259,8 +263,10 @@ static int int13_extended_rw ( struct int13_drive *drive,
259 263
 	      addr.buffer.segment, addr.buffer.offset, count );
260 264
 	
261 265
 	/* Read from / write to block device */
262
-	if ( io ( blockdev, lba, count, buffer ) != 0 )
266
+	if ( ( rc = io ( blockdev, lba, count, buffer ) ) != 0 ) {
267
+		DBG ( "INT 13 failed: %s\n", strerror ( rc ) );
263 268
 		return -INT13_STATUS_READ_ERROR;
269
+	}
264 270
 
265 271
 	return 0;
266 272
 }
@@ -387,7 +393,7 @@ static __asmcall void int13 ( struct i386_all_regs *ix86 ) {
387 393
 		/* Negative status indicates an error */
388 394
 		if ( status < 0 ) {
389 395
 			status = -status;
390
-			DBG ( "INT13 failed with status %x\n", status );
396
+			DBG ( "INT 13 returning failure status %x\n", status );
391 397
 		} else {
392 398
 			ix86->flags &= ~CF;
393 399
 		}
@@ -652,7 +658,8 @@ int int13_boot ( unsigned int drive ) {
652 658
 
653 659
 	/* Jump to boot sector */
654 660
 	if ( ( rc = call_bootsector ( 0x0, 0x7c00, drive ) ) != 0 ) {
655
-		DBG ( "INT 13 drive %02x boot returned\n", drive );
661
+		DBG ( "INT 13 drive %02x boot returned: %s\n",
662
+		      drive, strerror ( rc ) );
656 663
 		return rc;
657 664
 	}
658 665
 

Loading…
取消
儲存