From 3f61fb8c0097c6e58c1a5c08a7e1c1514f2b9c68 Mon Sep 17 00:00:00 2001 From: amylaar Date: Thu, 3 Apr 2003 13:06:01 +0000 Subject: [PATCH] * libc/machine/sh/memset.S: Fix problem with alloco region exceeding destination region for length >= 88 bytes, start & 0x16 == 0, end & 0x1f == 18. --- newlib/ChangeLog | 6 ++++++ newlib/libc/machine/sh/memset.S | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 5a692191a2..d66f67d004 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,9 @@ +Thu Apr 3 14:01:16 2003 J"orn Rennecke + + * libc/machine/sh/memset.S: Fix problem with alloco region + exceeding destination region for length >= 88 bytes, start + & 0x16 == 0, end & 0x1f == 18. + 2001-04-03 Corinna Vinschen * libc/string/wcscoll.c: Fix comment. diff --git a/newlib/libc/machine/sh/memset.S b/newlib/libc/machine/sh/memset.S index 3d37e33e3e..ab71d95809 100644 --- a/newlib/libc/machine/sh/memset.S +++ b/newlib/libc/machine/sh/memset.S @@ -12,14 +12,16 @@ ENTRY(memset) #if __SHMEDIA__ pta/l multiquad, tr0 - andi r2, 7, r22 - ptabs r18, tr2 mshflo.b r3,r3,r3 - add r4, r22, r23 + ptabs r18, tr2 mperm.w r3, r63, r3 // Fill pattern now in every byte of r3 - movi 8, r9 - bgtu/u r23, r9, tr0 // multiquad + andi r2, -8, r25 + add r2, r4, r5 + addi r5, -1, r20 // calculate end address. + andi r20, -8, r20 + cmveq r4, r25, r20 + bne/u r25, r20, tr0 // multiquad ldlo.q r2, 0, r7 shlli r4, 2, r4 @@ -33,18 +35,16 @@ ENTRY(memset) multiquad: pta/l lastquad, tr0 stlo.q r2, 0, r3 - shlri r23, 3, r24 - add r2, r4, r5 - beqi/u r24, 1, tr0 // lastquad + sub r20, r25, r24 + movi 64, r9 + beqi/u r24, 8, tr0 // lastquad pta/l loop, tr1 - sub r2, r22, r25 - andi r5, -8, r20 // calculate end address and addi r20, -7*8, r8 // loop end address; This might overflow, so we need // to use a different test before we start the loop - bge/u r24, r9, tr1 // loop + bgeu/u r24, r9, tr1// loop st.q r25, 8, r3 + shlri r24, 4, r24 st.q r20, -8, r3 - shlri r24, 1, r24 beqi/u r24, 1, tr0 // lastquad st.q r25, 16, r3 st.q r20, -16, r3 -- 2.11.0