* 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:
parent
7bbed70832
commit
13f7d71fee
|
@ -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):
|
* libc/machine/sh/memset.S (memset, __SHMEDIA__ code):
|
||||||
Fixed bug in writing end of set region.
|
Fixed bug in writing end of set region.
|
||||||
|
|
|
@ -27,9 +27,11 @@ ENTRY(strcpy)
|
||||||
pta/l loop, tr0
|
pta/l loop, tr0
|
||||||
ori r2,-8,r22
|
ori r2,-8,r22
|
||||||
mcmpeq.b r5, r63, r6
|
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
|
ldlo.q r2, 0, r9
|
||||||
movi -1, r8
|
movi -1, r8
|
||||||
SHLO r8, r7, r8
|
SHLO r8, r7, r8
|
||||||
|
@ -41,6 +43,8 @@ ENTRY(strcpy)
|
||||||
addi r0, 8, r0
|
addi r0, 8, r0
|
||||||
blink tr1, r63 // shortstring
|
blink tr1, r63 // shortstring
|
||||||
no_lddst:
|
no_lddst:
|
||||||
|
// r22 > r23: note that for r22 == r23 the sthi.q would clobber
|
||||||
|
// bytes before the destination region.
|
||||||
stlo.q r2, 0, r4
|
stlo.q r2, 0, r4
|
||||||
SHHI r4, r7, r4
|
SHHI r4, r7, r4
|
||||||
sthi.q r0, -1, r4
|
sthi.q r0, -1, r4
|
||||||
|
|
Loading…
Reference in New Issue