From 6935231fdeaaac4db13506f6f54ffb3b3d4f7e1e Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Thu, 16 May 2002 17:29:15 +0000 Subject: [PATCH] * libc/machine/sh/strcpy.S (strcpy): make sure r0 has right value at first loop exit point. --- newlib/ChangeLog | 5 +++-- newlib/libc/machine/sh/strcpy.S | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index a19ea6d6f..0bb6003b6 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,7 +1,8 @@ -Thu May 16 16:12:00 2002 J"orn Rennecke +Thu May 16 17:24:57 2002 J"orn Rennecke * libc/machine/sh/strcpy.S (strcpy): Replace LITTLE_ENDIAN with - __LITTLE_ENDIAN__. + __LITTLE_ENDIAN__. make sure r0 has right value at first loop + exit point. 2002-05-15 Thomas Fitzsimmons diff --git a/newlib/libc/machine/sh/strcpy.S b/newlib/libc/machine/sh/strcpy.S index 774f542c6..fa41cd2a5 100644 --- a/newlib/libc/machine/sh/strcpy.S +++ b/newlib/libc/machine/sh/strcpy.S @@ -14,7 +14,7 @@ ENTRY(strcpy) ldlo.q r3,0,r4 ptabs r18,tr4 shlli r3,3,r7 - add r2,r63,r0 + addi r2, 8, r0 mcmpeq.b r4,r63,r6 SHHI r6,r7,r6 bnei/u r6,0,tr1 // shortstring @@ -38,6 +38,7 @@ ENTRY(strcpy) beqi/l r6, 0, tr0 // loop add r5, r63, r4 + addi r0, 8, r0 blink tr1, r63 // shortstring no_lddst: stlo.q r2, 0, r4 @@ -46,13 +47,14 @@ no_lddst: beqi/l r6, 0, tr0 // loop add r5, r63, r4 + addi r0, 8, r0 shortstring: #ifndef __LITTLE_ENDIAN__ pta/l shortstring2,tr1 byterev r4,r4 #endif shortstring2: - st.b r0,0,r4 + st.b r0,-8,r4 andi r4,0xff,r5 shlri r4,8,r4 addi r0,1,r0 @@ -74,6 +76,7 @@ loop: beqi/l r6, 0, tr0 // loop add r5, r63, r4 + addi r0, 8, r0 blink tr1, r63 // shortstring #else /* ! __SHMEDIA__, i.e. SH 1..4 / SHcompact */