summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2009-03-30 17:38:44 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2009-03-30 17:38:44 -0700
commit4f964b57c29db85515b68a3f59a791804aae8aae (patch)
treedfd4ad63a74d7b11be71328b7f5fc4b2b80ca472
parent1cb06f94c9c1525975254ed41942098d7a741840 (diff)
downloadsyslinux-4f964b57c29db85515b68a3f59a791804aae8aae.tar.gz
mbr/*.S: if Ctrl is pressed, force the drive number to 0x80
Impact: BIOS bug workaround, possible unexpected consequences? Escape hatch for BIOSes which pass in garbage in DL: if the Ctrl key is pressed during boot, force the drive number to 0x80. Based on a patch by "TJ <ubuntu@tjworld.net>". Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--mbr/gptmbr.S13
-rw-r--r--mbr/isohdpfx.S12
-rw-r--r--mbr/mbr.S12
3 files changed, 27 insertions, 10 deletions
diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index 385afe74..0a547b85 100644
--- a/mbr/gptmbr.S
+++ b/mbr/gptmbr.S
@@ -1,6 +1,6 @@
/* -----------------------------------------------------------------------
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -61,7 +61,6 @@ _start:
movw %sp, %si
pushw %es /* 4(%bp) es:di -> $PnP header */
pushw %di /* 2(%bp) */
- pushw %dx /* 0(%bp) = %dl -> drive number */
movw %ax, %es
sti
cld
@@ -72,8 +71,14 @@ _start:
rep; movsw
ljmpw $0, $next
-
next:
+ /* Escape for the user: if Ctrl is pressed, assume drive hd0 */
+ testb $0x04, 0x417 /* keyboard control flags: Ctrl pressed */
+ jz 1f
+ movb $0x80, %dl
+1:
+ pushw %dx /* 0(%bp) = %dl -> drive number */
+
/* Check to see if we have EBIOS */
pushw %dx /* drive number */
movb $0x41, %ah /* %al == 0 already */
@@ -210,7 +215,7 @@ boot:
missing_os:
call error
- .ascii "Operating system not bootable\r\n"
+ .ascii "OS not bootable\r\n"
saturate_stosl:
pushl %eax
diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S
index 9e9d55c3..0e15b11a 100644
--- a/mbr/isohdpfx.S
+++ b/mbr/isohdpfx.S
@@ -1,6 +1,6 @@
/* -----------------------------------------------------------------------
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -69,7 +69,6 @@ _start:
movw %sp, %si
pushw %es /* es:di -> $PnP header */
pushw %di
- pushw %dx /* dl -> drive number */
movw %ax, %es
sti
cld
@@ -80,8 +79,15 @@ _start:
rep; movsw
ljmpw $0, $next
-
next:
+
+ /* Escape for the user: if Ctrl is pressed, assume drive hd0 */
+ testb $0x04, 0x417 /* keyboard control flags: Ctrl pressed */
+ jz 1f
+ movb $0x80, %dl
+1:
+ pushw %dx /* dl -> drive number */
+
/* Check to see if we have EBIOS */
pushw %dx /* drive number */
movb $0x41, %ah /* %al == 0 already */
diff --git a/mbr/mbr.S b/mbr/mbr.S
index 722d90db..70572d59 100644
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -1,6 +1,6 @@
/* -----------------------------------------------------------------------
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -53,7 +53,6 @@ _start:
movw %sp, %si
pushw %es /* es:di -> $PnP header */
pushw %di
- pushw %dx /* dl -> drive number */
movw %ax, %es
sti
cld
@@ -64,8 +63,15 @@ _start:
rep; movsw
ljmpw $0, $next
-
next:
+
+ /* Escape for the user: if Ctrl is pressed, assume drive hd0 */
+ testb $0x04, 0x417 /* keyboard control flags: Ctrl pressed */
+ jz 1f
+ movb $0x80, %dl
+1:
+ pushw %dx /* dl -> drive number */
+
/* Check to see if we have EBIOS */
pushw %dx /* drive number */
movb $0x41, %ah /* %al == 0 already */