Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2002-06-13 22:25:19 +0400
committerJoern Rennecke <joern.rennecke@embecosm.com>2002-06-13 22:25:19 +0400
commit13f7d71fee36dda6a9bc4d81f4c5215d2d2a605a (patch)
tree4e0dd43f29bec67347ac6510d8c77802eca19a5b /newlib/libc
parent7bbed7083231cddaf9857b60f6ec7882add424d9 (diff)
* libc/machine/sh/strcpy.S (strcpy, __SHMEDIA__ code):
Fix clobbering bytes before destination if src and dst have same non-zero misalignment.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/machine/sh/strcpy.S8
1 files changed, 6 insertions, 2 deletions
diff --git a/newlib/libc/machine/sh/strcpy.S b/newlib/libc/machine/sh/strcpy.S
index fa41cd2a5..da951cd03 100644
--- a/newlib/libc/machine/sh/strcpy.S
+++ b/newlib/libc/machine/sh/strcpy.S
@@ -27,9 +27,11 @@ ENTRY(strcpy)
pta/l loop, tr0
ori r2,-8,r22
mcmpeq.b r5, r63, r6
- bge/u r22, r23, tr2 // no_lddst
+ bgt/u r22, r23, tr2 // no_lddst
- // r22 < r23 ; Need to do a load from the destination.
+ // r22 < r23 : Need to do a load from the destination.
+ // r22 == r23 : Doesn't actually need to load from destination,
+ // but still can be handled here.
ldlo.q r2, 0, r9
movi -1, r8
SHLO r8, r7, r8
@@ -41,6 +43,8 @@ ENTRY(strcpy)
addi r0, 8, r0
blink tr1, r63 // shortstring
no_lddst:
+ // r22 > r23: note that for r22 == r23 the sthi.q would clobber
+ // bytes before the destination region.
stlo.q r2, 0, r4
SHHI r4, r7, r4
sthi.q r0, -1, r4