Browse Source

Completed definition of struct int13_cdrom_specification, and moved to

int13.h.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
0d9d2ccbae
2 changed files with 37 additions and 9 deletions
  1. 28
    0
      src/arch/i386/include/int13.h
  2. 9
    9
      src/arch/i386/interface/pcbios/int13.c

+ 28
- 0
src/arch/i386/include/int13.h View File

203
 
203
 
204
 /** @} */ 
204
 /** @} */ 
205
 
205
 
206
+/** Bootable CD-ROM specification packet */
207
+struct int13_cdrom_specification {
208
+	/** Size of packet in bytes */
209
+	uint8_t size;
210
+	/** Boot media type */
211
+	uint8_t media_type;
212
+	/** Drive number */
213
+	uint8_t drive;
214
+	/** CD-ROM controller number */
215
+	uint8_t controller;
216
+	/** LBA of disk image to emulate */
217
+	uint32_t lba;
218
+	/** Device specification */
219
+	uint16_t device;
220
+	/** Segment of 3K buffer for caching CD-ROM reads */
221
+	uint16_t cache_segment;
222
+	/** Load segment for initial boot image */
223
+	uint16_t load_segment;
224
+	/** Number of 512-byte sectors to load */
225
+	uint16_t load_sectors;
226
+	/** Low 8 bits of cylinder number */
227
+	uint8_t cyl;
228
+	/** Sector number, plus high 2 bits of cylinder number */
229
+	uint8_t cyl_sector;
230
+	/** Head number */
231
+	uint8_t head;
232
+} __attribute__ (( packed ));
233
+
206
 /** A C/H/S address within a partition table entry */
234
 /** A C/H/S address within a partition table entry */
207
 struct partition_chs {
235
 struct partition_chs {
208
 	/** Head number */
236
 	/** Head number */

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

317
 	return 0;
317
 	return 0;
318
 }
318
 }
319
 
319
 
320
-struct int13_cdrom_specification {
321
-	/** Size of packet in bytes */
322
-	uint8_t size;
323
-	/** Boot media type */
324
-	uint8_t media_type;
325
-	/** Drive number */
326
-	uint8_t drive;
327
-};
328
-
329
 /**
320
 /**
330
  * INT 13, 4b - Get CD-ROM status / terminate emulation
321
  * INT 13, 4b - Get CD-ROM status / terminate emulation
331
  *
322
  *
336
 static int int13_cdrom_status_terminate ( struct int13_drive *drive,
327
 static int int13_cdrom_status_terminate ( struct int13_drive *drive,
337
 					  struct i386_all_regs *ix86 ) {
328
 					  struct i386_all_regs *ix86 ) {
338
 	struct int13_cdrom_specification specification;
329
 	struct int13_cdrom_specification specification;
330
+	unsigned int max_cylinder = drive->cylinders - 1;
331
+	unsigned int max_head = drive->heads - 1;
332
+	unsigned int max_sector = drive->sectors_per_track; /* sic */
339
 
333
 
340
 	DBG ( "Get CD-ROM emulation parameters to %04x:%04x\n",
334
 	DBG ( "Get CD-ROM emulation parameters to %04x:%04x\n",
341
 	      ix86->segs.ds, ix86->regs.di );
335
 	      ix86->segs.ds, ix86->regs.di );
343
 	memset ( &specification, 0, sizeof ( specification ) );
337
 	memset ( &specification, 0, sizeof ( specification ) );
344
 	specification.size = sizeof ( specification );
338
 	specification.size = sizeof ( specification );
345
 	specification.drive = drive->drive;
339
 	specification.drive = drive->drive;
340
+	specification.cyl = ( max_cylinder & 0xff );
341
+	specification.cyl_sector = ( ( ( max_cylinder >> 8 ) << 6 ) |
342
+				     max_sector );
343
+	specification.head = max_head;
344
+
345
+	DBG_HD ( &specification, sizeof ( specification ) );
346
 
346
 
347
 	copy_to_real ( ix86->segs.ds, ix86->regs.si, &specification,
347
 	copy_to_real ( ix86->segs.ds, ix86->regs.si, &specification,
348
 		       sizeof ( specification ) );
348
 		       sizeof ( specification ) );

Loading…
Cancel
Save