diff options
author | Nick Clifton <nickc@redhat.com> | 2011-10-04 20:02:25 +0400 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2011-10-04 20:02:25 +0400 |
commit | de0ae33544adf49802814294babbabfa3df02544 (patch) | |
tree | 23ccb2ff686241ecf7716500c1d235cb90204a04 /newlib/libc/machine | |
parent | 35ddfc9e28dd27ce87fdc584544658cd729a2b78 (diff) |
* libc/machine/arm/memcpy.S: Fix unaligned access copying.
Diffstat (limited to 'newlib/libc/machine')
-rw-r--r-- | newlib/libc/machine/arm/memcpy.S | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/newlib/libc/machine/arm/memcpy.S b/newlib/libc/machine/arm/memcpy.S index f86454cd1..e408ed0e0 100644 --- a/newlib/libc/machine/arm/memcpy.S +++ b/newlib/libc/machine/arm/memcpy.S @@ -364,7 +364,7 @@ src_not_word_aligned: #ifdef __ARM_FEATURE_UNALIGNED /* Copy word by word using LDR when alignment can be done in hardware, i.e., SCTLR.A is set, supporting unaligned access in LDR and STR. */ - cmp r2, #60 + subs r2, r2, #60 blt 8f 7: @@ -380,12 +380,18 @@ src_not_word_aligned: bge 7b 8: - /* Get here if there is less than 64 btyes to copy, - where the number of bytes to copy is r2 + 4. */ + /* Get here if less than 64 bytes to copy, -64 <= r2 < 0. + Check if there is more than 3 bytes to copy. */ + adds r2, r2, #60 + blt copy_less_than_4 + +9: + /* Get here if there is less than 64 but at least 4 bytes to copy, + where the number of bytes to copy is r2+4. */ ldr r3, [r1], #4 str r3, [r0], #4 subs r2, r2, #4 - bge 8b + bge 9b b copy_less_than_4 |