From 0d9d2ccbaebda8bf6e6646b694532dbe54108eb4 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 19 Jul 2007 11:15:01 +0100 Subject: [PATCH] Completed definition of struct int13_cdrom_specification, and moved to int13.h. --- src/arch/i386/include/int13.h | 28 ++++++++++++++++++++++++++ src/arch/i386/interface/pcbios/int13.c | 18 ++++++++--------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/arch/i386/include/int13.h b/src/arch/i386/include/int13.h index c9d76585..32ecadc2 100644 --- a/src/arch/i386/include/int13.h +++ b/src/arch/i386/include/int13.h @@ -203,6 +203,34 @@ struct int13_disk_parameters { /** @} */ +/** Bootable CD-ROM specification packet */ +struct int13_cdrom_specification { + /** Size of packet in bytes */ + uint8_t size; + /** Boot media type */ + uint8_t media_type; + /** Drive number */ + uint8_t drive; + /** CD-ROM controller number */ + uint8_t controller; + /** LBA of disk image to emulate */ + uint32_t lba; + /** Device specification */ + uint16_t device; + /** Segment of 3K buffer for caching CD-ROM reads */ + uint16_t cache_segment; + /** Load segment for initial boot image */ + uint16_t load_segment; + /** Number of 512-byte sectors to load */ + uint16_t load_sectors; + /** Low 8 bits of cylinder number */ + uint8_t cyl; + /** Sector number, plus high 2 bits of cylinder number */ + uint8_t cyl_sector; + /** Head number */ + uint8_t head; +} __attribute__ (( packed )); + /** A C/H/S address within a partition table entry */ struct partition_chs { /** Head number */ diff --git a/src/arch/i386/interface/pcbios/int13.c b/src/arch/i386/interface/pcbios/int13.c index 0205d366..7d9de7e0 100644 --- a/src/arch/i386/interface/pcbios/int13.c +++ b/src/arch/i386/interface/pcbios/int13.c @@ -317,15 +317,6 @@ static int int13_get_extended_parameters ( struct int13_drive *drive, return 0; } -struct int13_cdrom_specification { - /** Size of packet in bytes */ - uint8_t size; - /** Boot media type */ - uint8_t media_type; - /** Drive number */ - uint8_t drive; -}; - /** * INT 13, 4b - Get CD-ROM status / terminate emulation * @@ -336,6 +327,9 @@ struct int13_cdrom_specification { static int int13_cdrom_status_terminate ( struct int13_drive *drive, struct i386_all_regs *ix86 ) { struct int13_cdrom_specification specification; + unsigned int max_cylinder = drive->cylinders - 1; + unsigned int max_head = drive->heads - 1; + unsigned int max_sector = drive->sectors_per_track; /* sic */ DBG ( "Get CD-ROM emulation parameters to %04x:%04x\n", ix86->segs.ds, ix86->regs.di ); @@ -343,6 +337,12 @@ static int int13_cdrom_status_terminate ( struct int13_drive *drive, memset ( &specification, 0, sizeof ( specification ) ); specification.size = sizeof ( specification ); specification.drive = drive->drive; + specification.cyl = ( max_cylinder & 0xff ); + specification.cyl_sector = ( ( ( max_cylinder >> 8 ) << 6 ) | + max_sector ); + specification.head = max_head; + + DBG_HD ( &specification, sizeof ( specification ) ); copy_to_real ( ix86->segs.ds, ix86->regs.si, &specification, sizeof ( specification ) );