summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-16 19:02:38 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-16 19:02:38 -0700
commita5545eebb18fd3da0df4976f3c64b9e38f028a7f (patch)
treecb0e19b3d93aa8e91bc316d7dd55bc8f8970bdb9
parente7ffeff65d02ea5e7ebd03adfc70376bc8789aa5 (diff)
downloadsyslinux-a5545eebb18fd3da0df4976f3c64b9e38f028a7f.tar.gz
bcopyxx/memmove: fix alignment logic for reverse moves
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>
-rw-r--r--com32/lib/memmove.S4
-rw-r--r--core/bcopyxx.inc4
2 files changed, 4 insertions, 4 deletions
diff --git a/com32/lib/memmove.S b/com32/lib/memmove.S
index 2fcb4b57..b7ac6767 100644
--- a/com32/lib/memmove.S
+++ b/com32/lib/memmove.S
@@ -93,7 +93,7 @@ memmove:
/* Initial alignment */
movl %edi,%edx
shrl $1,%edx
- jnc 21f
+ jc 21f
movsb
decl %ecx
21:
@@ -103,7 +103,7 @@ memmove:
cmpl $2,%ecx
jb 23f
shrl $1,%edx
- jnc 22f
+ jc 22f
movsw
subl $2,%ecx
22:
diff --git a/core/bcopyxx.inc b/core/bcopyxx.inc
index 4689788e..22b32b5a 100644
--- a/core/bcopyxx.inc
+++ b/core/bcopyxx.inc
@@ -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: