This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
[ Uli, if Geoff must approve the file with binary changes, could you please approve the ones files that have no binary differences? ] Only one file shows binary differences for non-BP: --- /home/gkm/libc/NATIVE-powerpc-unknown-linux-gnu/string/strchr.dis Fri Jun 30 13:27:15 2000 +++ /home/gkm/libc-bp/NATIVE-powerpc-unknown-linux-gnu/string/strchr.dis Fri Jun 30 13:27:20 2000 @@ -1,60 +1,60 @@ string/strchr.o: file format elf32-powerpc Disassembly of section .text: 00000000 <strchr>: 0: 50 84 44 2e rlwimi r4,r4,8,16,23 4: 39 60 ff ff li r11,-1 8: 50 84 80 1e rlwimi r4,r4,16,0,15 - c: 3c c0 fe ff lis r6,-257 - 10: 3c e0 7f 7f lis r7,32639 - 14: 54 68 00 3a rlwinm r8,r3,0,0,29 - 18: 38 e7 7f 7f addi r7,r7,32639 - 1c: 38 c6 fe ff addi r6,r6,-257 - 20: 54 6a 1e f8 rlwinm r10,r3,3,27,28 <<<< move this ... - 24: 80 a8 00 00 lwz r5,0(r8) + c: 54 6a 1e f8 rlwinm r10,r3,3,27,28 <<<< ... up, so that it precedes ... + 10: 3c c0 fe ff lis r6,-257 + 14: 3c e0 7f 7f lis r7,32639 + 18: 54 63 00 3a rlwinm r3,r3,0,0,29 <<<< ... this + 1c: 38 e7 7f 7f addi r7,r7,32639 + 20: 38 c6 fe ff addi r6,r6,-257 + 24: 80 a3 00 00 lwz r5,0(r3) 28: 7d 6b 54 30 srw r11,r11,r10 2c: 7c a5 5b 38 orc r5,r5,r11 30: 7c 06 2a 14 add r0,r6,r5 34: 7c e9 28 f8 nor r9,r7,r5 38: 7c 00 48 39 and. r0,r0,r9 3c: 7c 8c 2a 78 xor r12,r4,r5 40: 7d 8c 5b 38 orc r12,r12,r11 44: 48 00 00 20 b 64 <strchr+0x64> - 48: 84 a8 00 04 lwzu r5,4(r8) + 48: 84 a3 00 04 lwzu r5,4(r3) 4c: 7c 00 48 39 and. r0,r0,r9 50: 7c 06 2a 14 add r0,r6,r5 54: 7c e9 28 f8 nor r9,r7,r5 58: 40 82 00 5c bne b4 <strchr+0xb4> 5c: 7c 00 48 39 and. r0,r0,r9 60: 7c 8c 2a 78 xor r12,r4,r5 64: 7c 06 62 14 add r0,r6,r12 68: 7c e9 60 f8 nor r9,r7,r12 6c: 41 82 ff dc beq 48 <strchr+0x48> 70: 7c 00 48 39 and. r0,r0,r9 74: 38 60 00 00 li r3,0 78: 4d 82 00 20 beqlr 7c: 7c e6 28 38 and r6,r7,r5 80: 7c eb 2b 78 or r11,r7,r5 84: 7c e0 60 38 and r0,r7,r12 88: 7c ea 63 78 or r10,r7,r12 8c: 7c c6 3a 14 add r6,r6,r7 90: 7c 00 3a 14 add r0,r0,r7 94: 7d 65 30 f8 nor r5,r11,r6 98: 7d 49 00 f8 nor r9,r10,r0 9c: 7c 05 48 40 cmplw r5,r9 a0: 4d 81 00 20 bgtlr a4: 7d 24 00 34 cntlzw r4,r9 a8: 54 84 e8 fe rlwinm r4,r4,29,3,31 - ac: 7c 68 22 14 add r3,r8,r4 + ac: 7c 63 22 14 add r3,r3,r4 b0: 4e 80 00 20 blr b4: 7c e0 60 38 and r0,r7,r12 b8: 7c ea 63 78 or r10,r7,r12 bc: 7c 00 3a 14 add r0,r0,r7 c0: 7d 49 00 f8 nor r9,r10,r0 c4: 7d 24 00 34 cntlzw r4,r9 - c8: 39 08 ff fc addi r8,r8,-4 + c8: 38 63 ff fc addi r3,r3,-4 cc: 54 84 e8 fe rlwinm r4,r4,29,3,31 - d0: 7c 68 22 14 add r3,r8,r4 + d0: 7c 63 22 14 add r3,r3,r4 d4: 4e 80 00 20 blr [ basically, s/r8/r3/g, which necessitates the insn move above so that we can use r3's value before it's altered. ] 2000-06-30 Greg McGary <greg@mcgary.org> * 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/strchr.S: Likewise. * sysdeps/powerpc/strcmp.S: Likewise. * sysdeps/powerpc/strcpy.S: Likewise. * sysdeps/powerpc/elf/bzero.S: Likewise. Index: sysdeps/powerpc/bp-asm.h =================================================================== RCS file: bp-asm.h diff -N bp-asm.h --- /dev/null Tue May 5 13:32:27 1998 +++ bp-asm.h Fri Jun 30 12:20:48 2000 @@ -0,0 +1,115 @@ +/* Bounded-pointer definitions for PowerPC assembler. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Greg McGary <greg@mcgary.org> + + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in the GNU MP Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if __BOUNDED_POINTERS__ + +/* Byte offsets of BP components. */ +# define oVALUE 0 +# define oLOW 4 +# define oHIGH 8 + +/* Don't check bounds, just convert the BP register to its simple + pointer value. */ + +# define UNCHECK_BOUNDS(rBP) \ + lwz rBP, oVALUE(rBP) + +/* Check low bound, with the side effect that the BP register is converted + its simple pointer value. Move the high bound into a register for + later use. */ + +# define CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH) \ + lwz rHIGH, oHIGH(rBP); \ + lwz rLOW, oLOW(rBP); \ + lwz rBP, oVALUE(rBP); \ + twllt rBP, rLOW + +/* Check the high bound, which is in a register, using the given + conditional trap instruction. */ + +# define CHECK_BOUNDS_HIGH(rVALUE, rHIGH, TWLcc) \ + TWLcc rVALUE, rHIGH + +/* Check the high bound, which is stored at the return-value's high + bound slot, using the given conditional trap instruction. */ + +# define CHECK_BOUNDS_HIGH_RTN(rVALUE, rHIGH, TWLcc) \ + lwz rHIGH, oHIGH(rRTN); \ + TWLcc rVALUE, rHIGH + +/* Check both bounds, with the side effect that the BP register is + converted to its simple pointer value. */ + +# define CHECK_BOUNDS_BOTH(rBP, rLOW, rHIGH) \ + CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH); \ + twlge rBP, rHIGH + +/* Check bounds on a memory region of given length, with the side + effect that the BP register is converted to its simple pointer + value. */ + +# define CHECK_BOUNDS_BOTH_WIDE(rBP, rLOW, rHIGH, rLENGTH) \ + CHECK_BOUNDS_LOW (rBP, rLOW, rHIGH); \ + sub rHIGH, rHIGH, rLENGTH; \ + twlgt rBP, rHIGH + +# define CHECK_BOUNDS_BOTH_WIDE_LIT(rBP, rLOW, rHIGH, LENGTH) \ + CHECK_BOUNDS_LOW (rBP, rLOW, rHIGH); \ + subi rHIGH, rHIGH, LENGTH; \ + twlgt rBP, rHIGH + +/* Store a pointer value register into the return-value's pointer + value slot. */ + +# define STORE_RETURN_VALUE(rVALUE) \ + stw rVALUE, oVALUE(rRTN) + +/* Store a low and high bounds into the return-value's pointer bounds + slots. */ + +# define STORE_RETURN_BOUNDS(rLOW, rHIGH) \ + stw rLOW, oLOW(rRTN); \ + stw rHIGH, oHIGH(rRTN) + +/* Stuff zero value/low/high into the BP addressed by rRTN. */ + +# define RETURN_NULL_BOUNDED_POINTER \ + li r4, 0; \ + STORE_RETURN_VALUE (r4); \ + STORE_RETURN_BOUNDS (r4, r4) + +#else + +# define UNCHECK_BOUNDS(rBP) +# define CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH) +# define CHECK_BOUNDS_HIGH(rVALUE, rHIGH, TWLcc) +# define CHECK_BOUNDS_HIGH_RTN(rVALUE, rHIGH, TWLcc) +# define CHECK_BOUNDS_BOTH(rBP, rLOW, rHIGH) +# define CHECK_BOUNDS_BOTH_WIDE(rBP, rLOW, rHIGH, rLENGTH) +# define CHECK_BOUNDS_BOTH_WIDE_LIT(rBP, rLOW, rHIGH, LENGTH) +# define STORE_RETURN_VALUE(rVALUE) +# define STORE_RETURN_BOUNDS(rLOW, rHIGH) + +# define RETURN_NULL_BOUNDED_POINTER li rRTN, 0 + +#endif + Index: sysdeps/powerpc/__longjmp.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/__longjmp.S,v retrieving revision 1.9 diff -u -p -r1.9 __longjmp.S --- __longjmp.S 1999/10/11 23:08:14 1.9 +++ __longjmp.S 2000/06/30 19:20:48 @@ -1,5 +1,5 @@ /* longjmp for PowerPC. - Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,12 @@ #define _ASM #define _SETJMP_H #include <bits/setjmp.h> +#include <bp-sym.h> +#include <bp-asm.h> -ENTRY (__longjmp) +ENTRY (BP_SYM (__longjmp)) + CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE) + lwz r1,(JB_GPR1*4)(r3) lwz r2,(JB_GPR2*4)(r3) lwz r0,(JB_LR*4)(r3) @@ -67,4 +71,4 @@ ENTRY (__longjmp) lfd fp31,((JB_FPRS+17*2)*4)(r3) mr r3,r4 blr -END (__longjmp) +END (BP_SYM (__longjmp)) Index: sysdeps/powerpc/add_n.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/add_n.S,v retrieving revision 1.3 diff -u -p -r1.3 add_n.S --- add_n.S 2000/02/28 22:15:38 1.3 +++ add_n.S 2000/06/30 19:20:48 @@ -18,6 +18,8 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) @@ -27,7 +29,14 @@ possible 2-unrolled inner loop will not be. Also, watch out for the alignment... */ -EALIGN(__mpn_add_n,3,0) +EALIGN (BP_SYM (__mpn_add_n), 3, 0) + +#if __BOUNDED_POINTERS__ + slwi r10,r6,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r5, r8, r9, r10) +#endif /* Set up for loop below. */ mtcrf 0x01,r6 srwi. r7,r6,1 @@ -65,4 +74,4 @@ L(0): lwz r9,4(r4) /* Return the carry. */ L(1): addze r3,r10 blr -END(__mpn_add_n) +END (BP_SYM (__mpn_add_n)) Index: sysdeps/powerpc/addmul_1.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/addmul_1.S,v retrieving revision 1.3 diff -u -p -r1.3 addmul_1.S --- addmul_1.S 2000/02/28 22:16:33 1.3 +++ addmul_1.S 2000/06/30 19:20:48 @@ -18,11 +18,18 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_addmul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_size_t s1_size, mp_limb_t s2_limb) Calculate res+s1*s2 and put result back in res; return carry. */ -ENTRY(__mpn_addmul_1) +ENTRY (BP_SYM (__mpn_addmul_1)) +#if __BOUNDED_POINTERS__ + slwi r10,r5,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) +#endif mtctr r5 lwz r0,0(r4) @@ -46,4 +53,4 @@ L(0): lwzu r0,4(r4) L(1): stw r8,4(r3) addze r3,r10 blr -END(__mpn_addmul_1) +END (BP_SYM (__mpn_addmul_1)) Index: sysdeps/powerpc/bsd-_setjmp.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/bsd-_setjmp.S,v retrieving revision 1.5 diff -u -p -r1.5 bsd-_setjmp.S --- bsd-_setjmp.S 1999/10/11 22:13:05 1.5 +++ bsd-_setjmp.S 2000/06/30 19:20:48 @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC version. - Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,9 @@ in setjmp doesn't clobber the state restored by longjmp. */ #include <sysdep.h> +#include <bp-sym.h> -ENTRY (_setjmp) +ENTRY (BP_SYM (_setjmp)) li r4,0 /* Set second argument to 0. */ - b JUMPTARGET(__sigsetjmp) -END (_setjmp) + b JUMPTARGET(BP_SYM (__sigsetjmp)) +END (BP_SYM (_setjmp)) Index: sysdeps/powerpc/bsd-setjmp.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/bsd-setjmp.S,v retrieving revision 1.5 diff -u -p -r1.5 bsd-setjmp.S --- bsd-setjmp.S 1999/10/11 22:13:19 1.5 +++ bsd-setjmp.S 2000/06/30 19:20:48 @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC version. - Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,11 +22,12 @@ in setjmp doesn't clobber the state restored by longjmp. */ #include <sysdep.h> +#include <bp-sym.h> -ENTRY (__setjmp) +ENTRY (BP_SYM (__setjmp)) li r4,1 /* Set second argument to 1. */ - b JUMPTARGET(__sigsetjmp) -END (__setjmp) + b JUMPTARGET(BP_SYM (__sigsetjmp)) +END (BP_SYM (__setjmp)) - .globl setjmp - .set setjmp,__setjmp + .globl BP_SYM (setjmp) + .set BP_SYM (setjmp), BP_SYM (__setjmp) Index: sysdeps/powerpc/lshift.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/lshift.S,v retrieving revision 1.3 diff -u -p -r1.3 lshift.S --- lshift.S 2000/02/28 22:17:44 1.3 +++ lshift.S 2000/06/30 19:20:48 @@ -18,11 +18,19 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize, unsigned int cnt) */ -EALIGN(__mpn_lshift,3,0) +EALIGN (BP_SYM (__mpn_lshift), 3, 0) + +#if __BOUNDED_POINTERS__ + slwi r10,r5,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) +#endif mtctr r5 # copy size into CTR cmplwi cr0,r5,16 # is size < 16 slwi r0,r5,2 @@ -120,4 +128,4 @@ L(n): lwzu r10,-4(r4); \ DO_LSHIFT(30) DO_LSHIFT(31) -END(__mpn_lshift) +END (BP_SYM (__mpn_lshift)) Index: sysdeps/powerpc/mul_1.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/mul_1.S,v retrieving revision 1.3 diff -u -p -r1.3 mul_1.S --- mul_1.S 2000/02/28 22:20:39 1.3 +++ mul_1.S 2000/06/30 19:20:48 @@ -18,12 +18,19 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_mul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_size_t s1_size, mp_limb_t s2_limb) Calculate s1*s2 and put result in res_ptr; return carry. */ -ENTRY(__mpn_mul_1) +ENTRY (BP_SYM (__mpn_mul_1)) +#if __BOUNDED_POINTERS__ + slwi r10,r5,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) +#endif mtctr r5 lwz r0,0(r4) @@ -43,4 +50,4 @@ L(0): lwzu r0,4(r4) L(1): stw r7,4(r3) addze r3,r10 blr -END(__mpn_mul_1) +END (BP_SYM (__mpn_mul_1)) Index: sysdeps/powerpc/rshift.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/rshift.S,v retrieving revision 1.3 diff -u -p -r1.3 rshift.S --- rshift.S 2000/02/28 22:21:33 1.3 +++ rshift.S 2000/06/30 19:20:48 @@ -18,6 +18,8 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* INPUT PARAMETERS res_ptr r3 @@ -25,7 +27,12 @@ size r5 cnt r6 */ -ENTRY(__mpn_rshift) +ENTRY (BP_SYM (__mpn_rshift)) +#if __BOUNDED_POINTERS__ + slwi r10,r5,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) +#endif mtctr r5 # copy size into CTR addi r7,r3,-4 # move adjusted res_ptr to free return reg subfic r8,r6,32 @@ -53,4 +60,4 @@ L(1): srw r0,r11,r6 L(2): srw r0,r10,r6 stw r0,4(r7) blr -END(__mpn_rshift) +END (BP_SYM (__mpn_rshift)) Index: sysdeps/powerpc/setjmp.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/setjmp.S,v retrieving revision 1.9 diff -u -p -r1.9 setjmp.S --- setjmp.S 1999/10/11 23:06:33 1.9 +++ setjmp.S 2000/06/30 19:20:48 @@ -1,5 +1,5 @@ /* setjmp for PowerPC. - Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,12 @@ #define _ASM #define _SETJMP_H #include <bits/setjmp.h> +#include <bp-sym.h> +#include <bp-asm.h> -ENTRY (__sigsetjmp) +ENTRY (BP_SYM (__sigsetjmp)) + CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE) + stw r1,(JB_GPR1*4)(3) mflr r0 stw r2,(JB_GPR2*4)(3) @@ -65,5 +69,5 @@ ENTRY (__sigsetjmp) stfd fp30,((JB_FPRS+16*2)*4)(3) stw r31,((JB_GPRS+17)*4)(3) stfd fp31,((JB_FPRS+17*2)*4)(3) - b JUMPTARGET(__sigjmp_save) -END (__sigsetjmp) + b JUMPTARGET (BP_SYM (__sigjmp_save)) +END (BP_SYM (__sigsetjmp)) Index: sysdeps/powerpc/strlen.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/strlen.S,v retrieving revision 1.5 diff -u -p -r1.5 strlen.S --- strlen.S 2000/06/06 22:37:40 1.5 +++ strlen.S 2000/06/30 19:20:48 @@ -18,6 +18,8 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* The algorithm here uses the following techniques: @@ -71,7 +73,7 @@ /* int [r3] strlen (char *s [r3]) */ -ENTRY (strlen) +ENTRY (BP_SYM (strlen)) #define rTMP1 r0 #define rRTN r3 /* incoming STR arg, outgoing result */ @@ -87,6 +89,8 @@ ENTRY (strlen) #define rTMP3 r11 #define rTMP4 r12 + CHECK_BOUNDS_LOW (rRTN, rTMP1, rTMP2) + clrrwi rSTR, rRTN, 2 lis r7F7F, 0x7f7f rlwinm rPADN, rRTN, 3, 27, 28 @@ -150,5 +154,6 @@ L(done0): subf rTMP1, rRTN, rSTR srwi rTMP3, rTMP3, 3 add rRTN, rTMP1, rTMP3 + /* GKM FIXME: check high bound. */ blr -END (strlen) +END (BP_SYM (strlen)) Index: sysdeps/powerpc/sub_n.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/sub_n.S,v retrieving revision 1.3 diff -u -p -r1.3 sub_n.S --- sub_n.S 2000/02/28 22:34:10 1.3 +++ sub_n.S 2000/06/30 19:20:48 @@ -18,6 +18,8 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) @@ -27,7 +29,15 @@ possible 2-unrolled inner loop will not be. Also, watch out for the alignment... */ -EALIGN(__mpn_sub_n,3,1) +EALIGN (BP_SYM (__mpn_sub_n), 3, 1) + +#if __BOUNDED_POINTERS__ + slwi r10,r6,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r5, r8, r9, r10) +#endif + /* Set up for loop below. */ mtcrf 0x01,r6 srwi. r7,r6,1 @@ -65,4 +75,4 @@ L(0): L(1): subfe r3,r3,r3 neg r3,r3 blr -END(__mpn_sub_n) +END (BP_SYM (__mpn_sub_n)) Index: sysdeps/powerpc/submul_1.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/submul_1.S,v retrieving revision 1.3 diff -u -p -r1.3 submul_1.S --- submul_1.S 2000/02/28 22:34:48 1.3 +++ submul_1.S 2000/06/30 19:20:48 @@ -18,12 +18,19 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* mp_limb_t mpn_submul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_size_t s1_size, mp_limb_t s2_limb) Calculate res-s1*s2 and put result back in res; return carry. */ -ENTRY(__mpn_submul_1) +ENTRY (BP_SYM (__mpn_submul_1)) +#if __BOUNDED_POINTERS__ + slwi r10,r5,2 /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) + CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) +#endif mtctr r5 lwz r0,0(r4) @@ -49,4 +56,4 @@ L(0): lwzu r0,4(r4) L(1): stw r8,4(r3) addze r3,r10 blr -END(__mpn_submul_1) +END (BP_SYM (__mpn_submul_1)) Index: sysdeps/powerpc/memset.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/memset.S,v retrieving revision 1.5 diff -u -p -r1.5 memset.S --- memset.S 2000/06/06 22:37:40 1.5 +++ memset.S 2000/06/30 19:20:48 @@ -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,29 @@ 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 + mr rMEMP, rMEMP0 /* take care of case for size <= 4 */ cmplwi cr1, rLEN, 4 - andi. rALIGN, rRTN, 3 - mr rMEMP, rRTN + andi. rALIGN, rMEMP, 3 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, rMEMP 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 +225,4 @@ L(medium_28t): stw rCHR, -4(rMEMP) stw rCHR, -8(rMEMP) blr -END(memset) +END (BP_SYM (memset)) Index: sysdeps/powerpc/stpcpy.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/stpcpy.S,v retrieving revision 1.4 diff -u -p -r1.4 stpcpy.S --- stpcpy.S 2000/06/30 18:26:00 1.4 +++ stpcpy.S 2000/06/30 19:20:48 @@ -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)) Index: sysdeps/powerpc/strchr.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/strchr.S,v retrieving revision 1.3 diff -u -p -r1.3 strchr.S --- strchr.S 2000/06/06 22:37:40 1.3 +++ strchr.S 2000/06/30 19:20:48 @@ -18,36 +18,45 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> +#include <bp-asm.h> /* See strlen.s for comments on how this works. */ /* char * [r3] strchr (const char *s [r3] , int c [r4] ) */ -ENTRY (strchr) +ENTRY (BP_SYM (strchr)) #define rTMP1 r0 #define rRTN r3 /* outgoing result */ -#define rSTRin r3 /* incoming string arg */ -#define rCHR r4 /* byte we're looking for, spread over the whole word */ +#if __BOUNDED_POINTERS__ +# define rSTR r4 +# define rCHR r5 /* byte we're looking for, spread over the whole word */ +#else +# define rSTR r3 /* current word pointer */ +# define rCHR r4 /* byte we're looking for, spread over the whole word */ +#endif #define rCLZB rCHR /* leading zero byte count */ -#define rWORD r5 /* the current word */ #define rFEFE r6 /* constant 0xfefefeff (-0x01010101) */ #define r7F7F r7 /* constant 0x7f7f7f7f */ -#define rSTR r8 /* current word pointer */ +#define rWORD r8 /* the current word */ #define rTMP2 r9 #define rIGN r10 /* number of bits we should ignore in the first word */ #define rMASK r11 /* mask with the bits to ignore set to 0 */ #define rTMP3 r12 + CHECK_BOUNDS_LOW (rSTR, rTMP1, rTMP2) + STORE_RETURN_BOUNDS (rTMP1, rTMP2) + rlwimi rCHR, rCHR, 8, 16, 23 li rMASK, -1 rlwimi rCHR, rCHR, 16, 0, 15 lis rFEFE, -0x101 lis r7F7F, 0x7f7f - clrrwi rSTR, rSTRin, 2 + rlwinm rIGN, rSTR, 3, 27, 28 addi r7F7F, r7F7F, 0x7f7f addi rFEFE, rFEFE, -0x101 - rlwinm rIGN, rSTRin, 3, 27, 28 + clrrwi rSTR, rSTR, 2 /* Test the first (partial?) word. */ lwz rWORD, 0(rSTR) srw rMASK, rMASK, rIGN @@ -80,7 +89,8 @@ L(loopentry): happened, though. */ L(missed): and. rTMP1, rTMP1, rTMP2 - li rRTN, 0 + li rSTR, 0 + STORE_RETURN_VALUE (rSTR) beqlr /* It did happen. Decide which one was first... I'm not sure if this is actually faster than a sequence of @@ -97,7 +107,9 @@ L(missed): bgtlr cntlzw rCLZB, rTMP2 srwi rCLZB, rCLZB, 3 - add rRTN, rSTR, rCLZB + add rSTR, rSTR, rCLZB + CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge) + STORE_RETURN_VALUE (rSTR) blr L(foundit): @@ -108,8 +120,10 @@ L(foundit): cntlzw rCLZB, rTMP2 subi rSTR, rSTR, 4 srwi rCLZB, rCLZB, 3 - add rRTN, rSTR, rCLZB + add rSTR, rSTR, rCLZB + CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge) + STORE_RETURN_VALUE (rSTR) blr -END (strchr) +END (BP_SYM (strchr)) -weak_alias(strchr, index) +weak_alias (BP_SYM (strchr), BP_SYM (index)) Index: sysdeps/powerpc/strcmp.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/strcmp.S,v retrieving revision 1.5 diff -u -p -r1.5 strcmp.S --- strcmp.S 2000/06/06 22:37:40 1.5 +++ strcmp.S 2000/06/30 19:20:48 @@ -18,24 +18,33 @@ 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. */ /* int [r3] strcmp (const char *s1 [r3], const char *s2 [r4]) */ -EALIGN (strcmp, 4, 0) +EALIGN (BP_SYM (strcmp), 4, 0) #define rTMP r0 -#define rRTN r3 /* return value */ +#define rRTN r3 #define rSTR1 r3 /* first string arg */ #define rSTR2 r4 /* second string arg */ +#if __BOUNDED_POINTERS__ +# define rHIGH1 r11 +# define rHIGH2 r12 +#endif #define rWORD1 r5 /* current word in s1 */ #define rWORD2 r6 /* current word in s2 */ #define rFEFE r7 /* constant 0xfefefeff (-0x01010101) */ -#define r7F7F r8 /* constant 0x7f7f7f7f */ +#define r7F7F r8 /* constant 0x7f7f7f7f */ #define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f) */ #define rBITDIF r10 /* bits that differ in s1 & s2 words */ + CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1) + CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2) + or rTMP, rSTR2, rSTR1 clrlwi. rTMP, rTMP, 30 lis rFEFE, -0x101 @@ -74,6 +83,7 @@ L(endstring): bgelr+ cr1 L(equal): li rRTN, 0 + /* GKM FIXME: check high bounds. */ blr L(different): @@ -83,6 +93,7 @@ L(different): bgelr+ L(highbit): ori rRTN, rWORD2, 1 + /* GKM FIXME: check high bounds. */ blr @@ -106,8 +117,10 @@ L(u1): cmpwi cr1, rWORD1, 0 cmpw rWORD1, rWORD2 bne+ cr1, L(u0) L(u3): sub rRTN, rWORD1, rWORD2 + /* GKM FIXME: check high bounds. */ blr L(u4): lbz rWORD1, -1(rSTR1) sub rRTN, rWORD1, rWORD2 + /* GKM FIXME: check high bounds. */ blr -END(strcmp) +END (BP_SYM (strcmp)) Index: sysdeps/powerpc/strcpy.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/strcpy.S,v retrieving revision 1.4 diff -u -p -r1.4 strcpy.S --- strcpy.S 2000/06/06 22:37:40 1.4 +++ strcpy.S 2000/06/30 19:20:48 @@ -18,26 +18,43 @@ 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] strcpy (char *dest [r3], const char *src [r4]) */ -EALIGN(strcpy, 4, 0) +EALIGN (BP_SYM (strcpy), 4, 0) #define rTMP r0 #define rRTN r3 /* incoming DEST arg preserved as result */ -#define rSRC r4 /* pointer to previous word in src */ -#define rDEST r5 /* pointer to previous word in dest */ -#define rWORD r6 /* current word from src */ +#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 rSRC r4 /* pointer to previous word in src */ +# define rDEST r5 /* pointer to previous word in dest */ +#endif +#define rWORD r6 /* current word from src */ #define rFEFE r7 /* constant 0xfefefeff (-0x01010101) */ -#define r7F7F r8 /* constant 0x7f7f7f7f */ +#define r7F7F r8 /* constant 0x7f7f7f7f */ #define rNEG r9 /* ~(word in s1 | 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, rRTN clrlwi. rTMP, rTMP, 30 +#if __BOUNDED_POINTERS__ + addi rDEST, rDEST, -4 +#else addi rDEST, rRTN, -4 +#endif bne L(unaligned) lis rFEFE, -0x101 @@ -72,6 +89,7 @@ L(g1): rlwinm. rTMP, rALT, 8, 24, 31 stb rTMP, 6(rDEST) beqlr- stb rALT, 7(rDEST) + /* GKM FIXME: check high bound. */ blr /* Oh well. In this case, we just do a byte-by-byte copy. */ @@ -93,8 +111,10 @@ L(u0): lbzu rALT, 1(rSRC) cmpwi rWORD, 0 bne+ L(u0) L(u2): stb rWORD, 1(rDEST) + /* GKM FIXME: check high bound. */ blr L(u1): stb rALT, 1(rDEST) + /* GKM FIXME: check high bound. */ blr -END(strcpy) +END (BP_SYM (strcpy)) Index: sysdeps/powerpc/elf/bzero.S =================================================================== RCS file: /cvs/glibc/libc/sysdeps/powerpc/elf/bzero.S,v retrieving revision 1.1 diff -u -p -r1.1 bzero.S --- bzero.S 2000/02/25 20:28:45 1.1 +++ bzero.S 2000/06/30 19:20:48 @@ -1,5 +1,5 @@ /* Optimized bzero `implementation' for PowerPC. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,10 +18,20 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include <bp-sym.h> -ENTRY(__bzero) +ENTRY (BP_SYM (__bzero)) + +#if __BOUNDED_POINTERS__ + mr r6,r4 + li r5,0 + mr r4,r3 + /* Tell memset that we don't want a return value. */ + li r3,0 +#else mr r5,r4 li r4,0 - b memset@local -END(__bzero) -weak_alias (__bzero, bzero) +#endif + b BP_SYM (memset)@local +END (BP_SYM (__bzero)) +weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |