grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix boot device in chainloader


From: Pavel Roskin
Subject: [PATCH] Fix boot device in chainloader
Date: Sun, 03 Feb 2008 12:15:46 -0500

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  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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 via email to

[Prev in Thread] Current Thread [Next in Thread]