aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/stpcpy.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/stpcpy.S
parentdbda6079a64a9dbc6dfb24280af01e871e6f7de5 (diff)
downloadglibc-fa87f4037711e92c52965e87a83c60f270292dc0.tar
glibc-fa87f4037711e92c52965e87a83c60f270292dc0.tar.gz
glibc-fa87f4037711e92c52965e87a83c60f270292dc0.tar.bz2
glibc-fa87f4037711e92c52965e87a83c60f270292dc0.zip
* 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/stpcpy.S')
-rw-r--r--sysdeps/powerpc/stpcpy.S30
1 files changed, 25 insertions, 5 deletions
diff --git a/sysdeps/powerpc/stpcpy.S b/sysdeps/powerpc/stpcpy.S
index 2dcae0738d..9a4ab0b432 100644
--- a/sysdeps/powerpc/stpcpy.S
+++ b/sysdeps/powerpc/stpcpy.S
@@ -18,22 +18,36 @@
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
/* See strlen.s for comments on how the end-of-string testing works. */
/* char * [r3] stpcpy (char *dest [r3], const char *src [r4]) */
-EALIGN (__stpcpy, 4, 0)
+EALIGN (BP_SYM (__stpcpy), 4, 0)
#define rTMP r0
-#define rDEST r3 /* pointer to previous word in dest */
-#define rSRC r4 /* pointer to previous word in src */
+#define rRTN r3
+#if __BOUNDED_POINTERS__
+# define rDEST r4 /* pointer to previous word in dest */
+# define rSRC r5 /* pointer to previous word in src */
+# define rLOW r11
+# define rHIGH r12
+#else
+# define rDEST r3 /* pointer to previous word in dest */
+# define rSRC r4 /* pointer to previous word in src */
+#endif
#define rWORD r6 /* current word from src */
#define rFEFE r7 /* 0xfefefeff */
#define r7F7F r8 /* 0x7f7f7f7f */
#define rNEG r9 /* ~(word in src | 0x7f7f7f7f) */
#define rALT r10 /* alternate word from src */
+ CHECK_BOUNDS_LOW (rSRC, rLOW, rHIGH)
+ CHECK_BOUNDS_LOW (rDEST, rLOW, rHIGH)
+ STORE_RETURN_BOUNDS (rLOW, rHIGH)
+
or rTMP, rSRC, rDEST
clrlwi. rTMP, rTMP, 30
addi rDEST, rDEST, -4
@@ -71,6 +85,8 @@ L(g1): rlwinm. rTMP, rALT, 8, 24, 31
stbu rTMP, 1(rDEST)
beqlr-
stbu rALT, 1(rDEST)
+ CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
+ STORE_RETURN_VALUE (rDEST)
blr
/* Oh well. In this case, we just do a byte-by-byte copy. */
@@ -92,9 +108,13 @@ L(u0): lbzu rALT, 1(rSRC)
cmpwi rWORD, 0
bne+ L(u0)
L(u2): stbu rWORD, 1(rDEST)
+ CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
+ STORE_RETURN_VALUE (rDEST)
blr
L(u1): stbu rALT, 1(rDEST)
+ CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
+ STORE_RETURN_VALUE (rDEST)
blr
-END (__stpcpy)
+END (BP_SYM (__stpcpy))
-weak_alias (__stpcpy, stpcpy)
+weak_alias (BP_SYM (__stpcpy), BP_SYM (stpcpy))