Skip to contentSkip to conversation

Fix boot device in chainloader

PATCH In review Pavel Roskin 2 participants 3 messages Feb 3, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix boot device in chainloader

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(-)
ChangeLog +6 -0
index c92168b..eb5d8ad 100644
@@ -1,3 +1,9 @@
+2008-02-03  Pavel Roskin  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* configure.ac (AC_INIT): Bumped to 1.96.
kern/i386/pc/startup.S +4 -4
index e4101a6..0bfe2b3 100644
@@ -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
Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw
Quoted 4 lines · Pavel Roskin

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.

Sorry that it's a bit too late. But thank you for finding this bug. Please go ahead.

Okuji

#2 lore raw

Quoting "Yoshinori K. Okuji" <[email protected]>:

Quoted 8 lines · Pavel Roskin
Quoted 4 lines

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.

Sorry that it's a bit too late. But thank you for finding this bug. Please go ahead.

Committed. Hopefully 1.97 won't take too long :)

Signature · 2 lines
Regards,
Pavel Roskin