aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/memset.S
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-06-30 21:35:52 +0000
committerGreg McGary <greg@mcgary.org>2000-06-30 21:35:52 +0000
commitfa87f4037711e92c52965e87a83c60f270292dc0 (patch)
treedd90b952e4f46f3fa4d1b36a51a05a03a960d422 /sysdeps/powerpc/memset.S
parentdbda6079a64a9dbc6dfb24280af01e871e6f7de5 (diff)
downloadglibc-fa87f4037711e92c52965e87a83c60f270292dc0.zip
glibc-fa87f4037711e92c52965e87a83c60f270292dc0.tar.gz
glibc-fa87f4037711e92c52965e87a83c60f270292dc0.tar.bz2
* sysdeps/powerpc/bp-asm.h: New file.
* sysdeps/powerpc/__longjmp.S: Check bounds. Wrap extern symbols in BP_SYM (). * sysdeps/powerpc/bsd-_setjmp.S: Likewise. * sysdeps/powerpc/bsd-setjmp.S: Likewise. * sysdeps/powerpc/setjmp.S: Likewise. * sysdeps/powerpc/add_n.S: Likewise. * sysdeps/powerpc/addmul_1.S: Likewise. * sysdeps/powerpc/lshift.S: Likewise. * sysdeps/powerpc/rshift.S: Likewise. * sysdeps/powerpc/mul_1.S: Likewise. * sysdeps/powerpc/sub_n.S: Likewise. * sysdeps/powerpc/submul_1.S: Likewise. * sysdeps/powerpc/strlen.S: Likewise. * sysdeps/powerpc/memset.S: Likewise. * sysdeps/powerpc/stpcpy.S: Likewise. * sysdeps/powerpc/strcmp.S: Likewise. * sysdeps/powerpc/strcpy.S: Likewise. * sysdeps/powerpc/elf/bzero.S: Likewise. * sysdeps/powerpc/bp-asm.h: New file. * sysdeps/powerpc/__longjmp.S: Check bounds. Wrap extern symbols in BP_SYM (). * sysdeps/powerpc/bsd-_setjmp.S: Likewise. * sysdeps/powerpc/bsd-setjmp.S: Likewise. * sysdeps/powerpc/setjmp.S: Likewise. * sysdeps/powerpc/add_n.S: Likewise. * sysdeps/powerpc/addmul_1.S: Likewise. * sysdeps/powerpc/lshift.S: Likewise. * sysdeps/powerpc/rshift.S: Likewise. * sysdeps/powerpc/mul_1.S: Likewise. * sysdeps/powerpc/sub_n.S: Likewise. * sysdeps/powerpc/submul_1.S: Likewise. * sysdeps/powerpc/strlen.S: Likewise. * sysdeps/powerpc/memset.S: Likewise. * sysdeps/powerpc/stpcpy.S: Likewise. * sysdeps/powerpc/strcmp.S: Likewise. * sysdeps/powerpc/strcpy.S: Likewise. * sysdeps/powerpc/elf/bzero.S: Likewise.
Diffstat (limited to 'sysdeps/powerpc/memset.S')
-rw-r--r--sysdeps/powerpc/memset.S39
1 files changed, 29 insertions, 10 deletions
diff --git a/sysdeps/powerpc/memset.S b/sysdeps/powerpc/memset.S
index c48c0af..2a09c24 100644
--- a/sysdeps/powerpc/memset.S
+++ b/sysdeps/powerpc/memset.S
@@ -18,6 +18,8 @@
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
Returns 's'.
@@ -26,13 +28,21 @@
cache line (256 bits). There is a special case for setting cache lines
to 0, to take advantage of the dcbz instruction. */
-EALIGN (memset, 5, 1)
+EALIGN (BP_SYM (memset), 5, 1)
#define rTMP r0
-#define rRTN r3 /* initial value of 1st argument */
-#define rCHR r4 /* char to set in each byte */
-#define rLEN r5 /* length of region to set */
-#define rMEMP r6 /* address at which we are storing */
+#define rRTN r3 /* initial value of 1st argument */
+#if __BOUNDED_POINTERS__
+# define rMEMP0 r4 /* original value of 1st arg */
+# define rCHR r5 /* char to set in each byte */
+# define rLEN r6 /* length of region to set */
+# define rMEMP r10 /* address at which we are storing */
+#else
+# define rMEMP0 r3 /* original value of 1st arg */
+# define rCHR r4 /* char to set in each byte */
+# define rLEN r5 /* length of region to set */
+# define rMEMP r6 /* address at which we are storing */
+#endif
#define rALIGN r7 /* number of bytes we are setting now (when aligning) */
#define rMEMP2 r8
@@ -40,21 +50,30 @@ EALIGN (memset, 5, 1)
#define rNEG64 r8 /* constant -64 for clearing with dcbz */
#define rNEG32 r9 /* constant -32 for clearing with dcbz */
+#if __BOUNDED_POINTERS__
+ cmplwi cr1, rRTN, 0
+ CHECK_BOUNDS_BOTH_WIDE (rMEMP0, rTMP, rTMP2, rLEN)
+ beq cr1, L(b0)
+ STORE_RETURN_VALUE (rMEMP0)
+ STORE_RETURN_BOUNDS (rTMP, rTMP2)
+L(b0):
+#endif
+
/* take care of case for size <= 4 */
cmplwi cr1, rLEN, 4
- andi. rALIGN, rRTN, 3
- mr rMEMP, rRTN
+ andi. rALIGN, rMEMP0, 3
+ mr rMEMP, rMEMP0
ble- cr1, L(small)
/* align to word boundary */
cmplwi cr5, rLEN, 31
rlwimi rCHR, rCHR, 8, 16, 23
beq+ L(aligned) /* 8th instruction from .align */
- mtcrf 0x01, rRTN
+ mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
bf+ 31, L(g0)
- stb rCHR, 0(rRTN)
+ stb rCHR, 0(rMEMP0)
bt 30, L(aligned)
L(g0): sth rCHR, -2(rMEMP) /* 16th instruction from .align */
/* take care of case for size < 31 */
@@ -207,4 +226,4 @@ L(medium_28t):
stw rCHR, -4(rMEMP)
stw rCHR, -8(rMEMP)
blr
-END(memset)
+END (BP_SYM (memset))