[1927] * kern/i386/loader.S (grub_multiboot_backward_relocator): Improve

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 1927
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1927
Author:   robertmh
Date:     2008-11-22 15:00:39 +0000 (Sat, 22 Nov 2008)

Log Message:
-----------
        * kern/i386/loader.S (grub_multiboot_backward_relocator): Improve
        comments.  Avoid copiing one more byte than necessary (just in case).

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/kern/i386/loader.S

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2008-11-22 14:56:52 UTC (rev 1926)
+++ trunk/grub2/ChangeLog	2008-11-22 15:00:39 UTC (rev 1927)
@@ -5,6 +5,9 @@
 	(grub_vga_text_term): Use grub_vga_text_init_fini() instead of
 	grub_vga_text_cls().
 
+	* kern/i386/loader.S (grub_multiboot_backward_relocator): Improve
+	comments.  Avoid copiing one more byte than necessary (just in case).
+
 2008-11-20  Robert Millan  <[email protected]>
 
 	* kern/i386/coreboot/init.c (grub_time_tics): Remove variable.

Modified: trunk/grub2/kern/i386/loader.S
===================================================================
--- trunk/grub2/kern/i386/loader.S	2008-11-22 14:56:52 UTC (rev 1926)
+++ trunk/grub2/kern/i386/loader.S	2008-11-22 15:00:39 UTC (rev 1927)
@@ -141,24 +141,32 @@
  * edx:	Offset of the entry point (relative to the beginning of the block).
  */
 VARIABLE(grub_multiboot_forward_relocator)
+	/* Add entry offset.  */
+	addl	%edi, %edx
+
+	/* Forward copy.  */
 	cld
-	addl	%edi, %edx
 	rep
 	movsb
+
 	jmp	*%edx
 VARIABLE(grub_multiboot_forward_relocator_end)
 
 VARIABLE(grub_multiboot_backward_relocator)
+	/* Add entry offset (before %edi is mangled).  */
+	addl	%edi, %edx
+
+	/* Backward movsb is implicitly off-by-one.  compensate that.  */
+	decl	%esi
+	decl	%edi
+
+	/* Backward copy.  */
 	std
 	addl	%ecx, %esi
 	addl	%ecx, %edi
-	/* backward movsb is implicitly off-by-one.  compensate that. */
-	incl	%ecx
 	rep
 	movsb
-	/* same problem again. */
-	incl	%edi
-	addl	%edi, %edx
+
 	jmp	*%edx
 VARIABLE(grub_multiboot_backward_relocator_end)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.