* libc/machine/sh/strcpy.S (strcpy, __SHMEDIA__ code):

Fix clobbering bytes before destination if src and dst have same
	non-zero misalignment.
This commit is contained in:
Joern Rennecke 2002-06-13 18:25:19 +00:00
parent 7bbed70832
commit 13f7d71fee
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,8 @@
Thu Jun 13 15:52:03 2002 J"orn Rennecke <joern.rennecke@superh.com>
Thu Jun 13 19:23:40 2002 J"orn Rennecke <joern.rennecke@superh.com>
* libc/machine/sh/strcpy.S (strcpy, __SHMEDIA__ code):
Fix clobbering bytes before destination if src and dst have same
non-zero misalignment.
* libc/machine/sh/memset.S (memset, __SHMEDIA__ code):
Fixed bug in writing end of set region.

View File

@ -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