All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix boot device in chainloader
@ 2008-02-03 17:15 Pavel Roskin
  2008-02-03 17:34 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2008-02-03 17:15 UTC (permalink / raw)
  To: grub-devel

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-03 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-03 17:15 [PATCH] Fix boot device in chainloader Pavel Roskin
2008-02-03 17:34 ` Yoshinori K. Okuji
2008-02-03 18:12   ` Pavel Roskin

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.