bcopyxx/memmove: fix alignment logic for reverse moves
authorH. Peter Anvin <hpa@zytor.com>
Sun, 17 May 2009 02:02:38 +0000 (19:02 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 17 May 2009 02:02:38 +0000 (19:02 -0700)
The alignment logic for reverse moves is reversed, because the initial
edi, and therefore edx, points to the last byte, not to one byte
beyond the end.  Therefore, in the fully aligned case it will end in
11 binary, not in 00 binary as for the forward case.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/lib/memmove.S
core/bcopyxx.inc

index 2fcb4b5..b7ac676 100644 (file)
@@ -93,7 +93,7 @@ memmove:
        /* Initial alignment */
        movl    %edi,%edx
        shrl    $1,%edx
-       jnc     21f
+       j     21f
        movsb
        decl    %ecx
 21:
@@ -103,7 +103,7 @@ memmove:
        cmpl    $2,%ecx
        jb      23f
        shrl    $1,%edx
-       jnc     22f
+       j     22f
        movsw
        subl    $2,%ecx
 22:
index 4689788..22b32b5 100644 (file)
@@ -103,7 +103,7 @@ pm_bcopy:
                ; Initial alignment
                mov dx,di
                shr dx,1
-               jnc .raa1
+               jc .raa1
                a32 movsb
                dec ecx
 .raa1:
@@ -114,7 +114,7 @@ pm_bcopy:
                cmp ecx,2
                jb .r_tiny
                shr dx,1
-               jnc .raa2
+               jc .raa2
                a32 movsw
                sub ecx,2
 .raa2: