Browse Source

[int13] Fix number of sectors returned by INT 13,15

INT 13,15 should return the number of sectors, not the number of
cylinders.
tags/v1.0.0-rc1
Michael Brown 15 years ago
parent
commit
89de3e29e1
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      src/arch/i386/interface/pcbios/int13.c

+ 6
- 2
src/arch/i386/interface/pcbios/int13.c View File

@@ -207,9 +207,13 @@ static int int13_get_parameters ( struct int13_drive *drive,
207 207
  */
208 208
 static int int13_get_disk_type ( struct int13_drive *drive,
209 209
 				 struct i386_all_regs *ix86 ) {
210
+	uint32_t blocks;
211
+
210 212
 	DBG ( "Get disk type\n" );
211
-	ix86->regs.cx = ( drive->cylinders >> 16 );
212
-	ix86->regs.dx = ( drive->cylinders & 0xffff );
213
+	blocks = ( ( drive->blockdev->blocks <= 0xffffffffUL ) ?
214
+		   drive->blockdev->blocks : 0xffffffffUL );
215
+	ix86->regs.cx = ( blocks >> 16 );
216
+	ix86->regs.dx = ( blocks & 0xffff );
213 217
 	return INT13_DISK_TYPE_HDD;
214 218
 }
215 219
 

Loading…
Cancel
Save