[syslinux] [PATCH 2/3] v2: gptmbr: Ctrl-key press forces load from first hard disk
TJ
ubuntu at tjworld.net
Mon Mar 30 14:32:38 PDT 2009
---
mbr/gptmbr.S | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index 385afe7..0ae9ddc 100644
--- a/mbr/gptmbr.S
+++ b/mbr/gptmbr.S
@@ -59,6 +59,7 @@ _start:
movw %ax, %ss
movw $stack, %sp
movw %sp, %si
+ movw %sp, %bp /* needed later if drive number is to be forced due to Ctrl key being pressed */
pushw %es /* 4(%bp) es:di -> $PnP header */
pushw %di /* 2(%bp) */
pushw %dx /* 0(%bp) = %dl -> drive number */
@@ -74,6 +75,15 @@ _start:
ljmpw $0, $next
next:
+ /* Provide a way for the user to force boot from first hard-disk by pressing a Ctrl key */
+get_shift_keys: /* Provide a way for the user to force CHS addressing mode by pressing either Shift key */
+ testb $0x04, 0x0417 /* I/O memory-mapped keyboard shift flags: control key pressed? */
+ jz detect_bios_type
+force_first_hard_disk:
+ movb $0x80, -6(%bp) /* offset from top-of-stack to drive number; force it to be first hard disk */
+ movb $0x80, %dl /* change the drive number about to be used in detect_bios_type */
+
+detect_bios_type:
/* Check to see if we have EBIOS */
pushw %dx /* drive number */
movb $0x41, %ah /* %al == 0 already */
@@ -210,7 +220,7 @@ boot:
missing_os:
call error
- .ascii "Operating system not bootable\r\n"
+ .ascii "OS unbootable\r\n"
saturate_stosl:
pushl %eax
@@ -265,7 +275,7 @@ read_common:
disk_error:
call error
- .ascii "Disk error on boot\r\n"
+ .ascii "Disk boot error\r\n"
/*
* Print error messages. This is invoked with "call", with the
--
1.6.0.4
More information about the Syslinux
mailing list