Browse Source

[int13] Improve debugging messages

tags/v0.9.8
Michael Brown 15 years ago
parent
commit
b0c818d7b5
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      src/arch/i386/interface/pcbios/int13.c

+ 11
- 4
src/arch/i386/interface/pcbios/int13.c View File

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

Loading…
Cancel
Save