summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2016-03-20 10:16:13 +0100
committerMichael Brown2016-03-22 10:55:09 +0100
commitab5b3abbbac98eb52109c34058e1999df7dd0b86 (patch)
treedd5564fe02cc6ac8f69c21ad98142edf75f7c69e /src/arch
parent[gdb] Add support for x86_64 (diff)
downloadipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.tar.gz
ipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.tar.xz
ipxe-ab5b3abbbac98eb52109c34058e1999df7dd0b86.zip
[int13] Allow drive to be hooked using the natural drive number
Interpret the maximum drive number (0xff for hard disks, 0x7f for floppy disks) as meaning "use natural drive number". Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/interface/pcbios/int13.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/arch/x86/interface/pcbios/int13.c b/src/arch/x86/interface/pcbios/int13.c
index 38880e4f..3b3f8730 100644
--- a/src/arch/x86/interface/pcbios/int13.c
+++ b/src/arch/x86/interface/pcbios/int13.c
@@ -1588,7 +1588,7 @@ static void int13_free ( struct refcnt *refcnt ) {
*
* @v uri URI
* @v drive Drive number
- * @ret rc Return status code
+ * @ret drive Drive number, or negative error
*
* Registers the drive with the INT 13 emulation subsystem, and hooks
* the INT 13 interrupt vector (if not already hooked).
@@ -1603,6 +1603,10 @@ static int int13_hook ( struct uri *uri, unsigned int drive ) {
int13_sync_num_drives();
natural_drive = ( ( drive & 0x80 ) ? ( num_drives | 0x80 ) : num_fdds );
+ /* Use natural drive number if directed to do so */
+ if ( ( drive & 0x7f ) == 0x7f )
+ drive = natural_drive;
+
/* Check that drive number is not in use */
list_for_each_entry ( int13, &int13s, list ) {
if ( int13->drive == drive ) {
@@ -1661,7 +1665,7 @@ static int int13_hook ( struct uri *uri, unsigned int drive ) {
int13_sync_num_drives();
free ( scratch );
- return 0;
+ return drive;
err_guess_geometry:
err_parse_iso9660: