All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: grub-devel@gnu.org
Subject: [PATCH] Fix boot device in chainloader
Date: Sun, 03 Feb 2008 12:15:46 -0500	[thread overview]
Message-ID: <1202058946.12671.7.camel@rd> (raw)

Hello!

That's a very serious bug, which prevents Windows Vista from loading
(and perhaps many other OSes depend on it too).  Applying the patch
fixes it.  The patch needs to be applied before 1.96 is released, if
possible.

The boot drive setting is held in the %edx register, which is clobbered
by grub_gate_a20() when called from grub_chainloader_real_boot().  %edx
and %esi are preserved around grub_dl_unload_all(), but not around
grub_gate_a20().

I'm not sure, but the bug may be relevant to the thread "root seems to
be incorrectly set after install".

 ChangeLog              |    6 ++++++
 kern/i386/pc/startup.S |    8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)


diff --git a/ChangeLog b/ChangeLog
index c92168b..eb5d8ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-03  Pavel Roskin  <proski@gnu.org>
+
+	* a/kern/i386/pc/startup.S (grub_chainloader_real_boot): Pop
+	%edx and %esi from stack only after grub_gate_a20() is called.
+	grub_gate_a20() clobbers %edx.
+
 2008-02-03  Yoshinori K. Okuji  <okuji@enbug.org>
 
 	* configure.ac (AC_INIT): Bumped to 1.96.
diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S
index e4101a6..0bfe2b3 100644
--- a/kern/i386/pc/startup.S
+++ b/kern/i386/pc/startup.S
@@ -594,16 +594,16 @@ FUNCTION(grub_chainloader_real_boot)
 
 	call	EXT_C(grub_dl_unload_all)
 
+	/* Turn off Gate A20 */
+	xorl	%eax, %eax
+	call	EXT_C(grub_gate_a20)
+
 	/* set up to pass boot drive */
 	popl	%edx
 
 	/* ESI must point to a partition table entry */
 	popl	%esi
 
-	/* Turn off Gate A20 */
-	xorl	%eax, %eax
-	call	EXT_C(grub_gate_a20)
-	
 	call	prot_to_real
 	.code16
 	ljmp	$0, $GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR


-- 
Regards,
Pavel Roskin



             reply	other threads:[~2008-02-03 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 17:15 Pavel Roskin [this message]
2008-02-03 17:34 ` [PATCH] Fix boot device in chainloader Yoshinori K. Okuji
2008-02-03 18:12   ` Pavel Roskin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1202058946.12671.7.camel@rd \
    --to=proski@gnu.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.