|
From: | Herbert Nachtnebel |
Subject: | Bug in stage2 loader (stage2/start.S) |
Date: | Mon, 9 Oct 2000 12:24:08 +0200 |
To the grub team!
If one boots with lba mode enabled, than the routine copy_buffer
in stage2/start.S alters the cx register. But the ecx register
holds the total number of sectors on disc and the geometry check
fails! A bugfix to solve this problem is appended below.
Note that failure this may also explain the behavior you solved with
the NO_BUGGY_BIOS_IN_THE_WORLD flag. I think therefore, that the change
from 2000-09-05 missed the point and this flag should go away again!
Why have nobody before spotted the problem? Well, the copy_buffer
routine sets the cx register to 0, hence the total number of sectors
is the real sector count modulus 65536. Therefore this is only a
problem when the stage2 is located at the end of the disc.
Kind regards,
Herbert Nachtnebel.
____________________________________________________________________
DI Herbert Nachtnebel address@hidden
VIENNA, UNIVERSITY of TECHNOLOGY
Institute of Industrial Electronics Tel: +43-1-58801-36663
and Material Sience (CAD-Division) Fax: +43-1-58801-36699
Gusshausstrasse 27-29/E366-2, A-1040 Wien, AUSTRIA
PS.: Patch against cvs checkout from Oct 9 appended:
--------------------------------------------------------------------
diff -u -r grub-orig/ChangeLog grub-fixed/ChangeLog
--- grub-orig/ChangeLog Sun Oct 8 05:42:36 2000
+++ grub-fixed/ChangeLog Mon Oct 9 11:53:58 2000
@@ -1,3 +1,10 @@
+2000-10-09 NACHTNEBEL Herbert <address@hidden>
+
+ * stage2/start.S: Bugfix. Altered ecx register in copy_buffer
+ routine but this register contains the total number of sectors
+ in lba mode: ouch. I think entry from 2000-09-05 missed the point
+ and NO_BUGGY_BIOS_IN_THE_WORLD option should go away!
+
2000-10-08 OKUJI Yoshinori <address@hidden>
* util/grub-install.in (grub_prefix): New variable. The default
diff -u -r grub-orig/stage2/start.S grub-fixed/stage2/start.S
--- grub-orig/stage2/start.S Sun Sep 10 10:46:52 2000
+++ grub-fixed/stage2/start.S Mon Oct 9 11:48:09 2000
@@ -103,7 +103,9 @@
jge geometry_error
#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */
- /* the maximum is limited to 0x7f because of Phoenix EDD */
+ /* the maximum is limited to 0x7f because of Phoenix EDD,
+ and even more important: we are in 16 bit mode and need
+ a buffer copy => stay away from 64K border! */
xorl %eax, %eax
movb $0x7f, %al
@@ -279,15 +281,16 @@
addw %ax, 6(%di) /* add the corrected value to the destination
address for next time */
- /* get the copy length */
- shlw $4, %ax
- movw %ax, %cx
-
- /* save addressing regs */
+ /* save regs used for rep movs */
pushw %si
pushw %di
+ pushw %cx /* %ecx contains length of disk in LBA mode */
pushw %ds
+ /* get the copy length */
+ shlw $4, %ax
+ movw %ax, %cx
+
xorw %di, %di /* zero offset of destination addresses */
xorw %si, %si /* zero offset of source addresses */
movw %bx, %ds /* restore the source segment */
@@ -302,6 +305,7 @@
(MSG modifies SI, which is saved, and unused AX and BX) */
popw %ds
MSG(notification_step)
+ popw %cx
popw %di
popw %si
[Prev in Thread] | Current Thread | [Next in Thread] |