diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/rpc/auth.h | 187 | ||||
-rw-r--r-- | sysdeps/generic/rpc/auth_des.h | 46 | ||||
-rw-r--r-- | sysdeps/generic/svc_auth.c | 117 | ||||
-rw-r--r-- | sysdeps/mach/hurd/Dist | 9 | ||||
-rw-r--r-- | sysdeps/mach/hurd/mips/Dist | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/Dist | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/add_n.s | 68 | ||||
-rw-r--r-- | sysdeps/powerpc/addmul_1.s | 50 | ||||
-rw-r--r-- | sysdeps/powerpc/lshift.s | 479 | ||||
-rw-r--r-- | sysdeps/powerpc/memset.s | 202 | ||||
-rw-r--r-- | sysdeps/powerpc/mul_1.s | 47 | ||||
-rw-r--r-- | sysdeps/powerpc/rshift.s | 59 | ||||
-rw-r--r-- | sysdeps/powerpc/strchr.s | 118 | ||||
-rw-r--r-- | sysdeps/powerpc/strcmp.s | 273 | ||||
-rw-r--r-- | sysdeps/powerpc/sub_n.s | 69 | ||||
-rw-r--r-- | sysdeps/powerpc/submul_1.s | 52 | ||||
-rw-r--r-- | sysdeps/sparc/Dist | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/Dist | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv8/Dist | 6 | ||||
-rw-r--r-- | sysdeps/stub/des_impl.c | 27 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/Dist | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/Dist | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/Dist | 1 |
23 files changed, 1466 insertions, 353 deletions
diff --git a/sysdeps/generic/rpc/auth.h b/sysdeps/generic/rpc/auth.h deleted file mode 100644 index b4022853d5..0000000000 --- a/sysdeps/generic/rpc/auth.h +++ /dev/null @@ -1,187 +0,0 @@ -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - -#ifndef _RPC_AUTH_H - -#define _RPC_AUTH_H 1 -#include <features.h> -#include <sys/types.h> -#include <rpc/types.h> -#include <rpc/xdr.h> - -__BEGIN_DECLS - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -union des_block { - struct { - u_int32_t high; - u_int32_t low; - } key; - char c[8]; -}; -typedef union des_block des_block; -extern bool_t xdr_des_block __P ((XDR *__xdrs, des_block *__blkp)); - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct AUTH AUTH; -struct AUTH { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf) __P ((AUTH *)); - int (*ah_marshal) __P ((AUTH *, XDR *)); /* nextverf & serialize */ - int (*ah_validate) __P ((AUTH *, struct opaque_auth *)); - /* validate verifier */ - int (*ah_refresh) __P ((AUTH *)); /* refresh credentials */ - void (*ah_destroy) __P ((AUTH *)); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -}; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - - -extern struct opaque_auth _null_auth; - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -extern AUTH *authunix_create __P ((char *__machname, __uid_t __uid, - __gid_t __gid, int __len, - __gid_t *__aup_gids)); -extern AUTH *authunix_create_default __P ((void)); -extern AUTH *authnone_create __P ((void)); -extern AUTH *authdes_create __P ((char *__servername, u_int __window, - struct sockaddr *__syncaddr, - des_block *__ckey)); - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_SYS 1 /* unix style (uid, gids) */ -#define AUTH_UNIX AUTH_SYS -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ -#define AUTH_KERB 4 /* kerberos style */ - -/* - * XDR an opaque authentication struct. - */ -extern bool_t xdr_opaque_auth __P ((XDR *__xdrs, struct opaque_auth *__ap)); - -__END_DECLS - -#endif /* rpc/auth.h */ diff --git a/sysdeps/generic/rpc/auth_des.h b/sysdeps/generic/rpc/auth_des.h deleted file mode 100644 index 8c2f794691..0000000000 --- a/sysdeps/generic/rpc/auth_des.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1996, 1997 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 - 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. */ - -#ifndef _RPC_AUTH_DES_H - -#define _RPC_AUTH_DES_H 1 -#include <sys/cdefs.h> - -__BEGIN_DECLS - -/* This is no complete version of this header. More definitions with - the real authentication stuff will come in 1997. For now we only - need to define the function for handling public keys. */ - - -/* Get the public key for NAME and place it in KEY. NAME can only be - up to MAXNETNAMELEN bytes long and the destination buffer KEY should - have HEXKEYBATES + 1 bytes long to fit all characters from the key. */ -extern int getpublickey __P ((__const char *__name, char *__key)); - -/* Get the secret key for NAME and place it in KEY. PASSWD is used to - decrypt the encrypted key stored in the database. NAME can only be - up to MAXNETNAMELEN bytes long and the destination buffer KEY - should have HEXKEYBATES + 1 bytes long to fit all characters from - the key. */ -extern int getsecretkey __P ((__const char *__name, char *__key, - __const char *__passwd)); - -__END_DECLS - -#endif /* rpc/auth_des.h */ diff --git a/sysdeps/generic/svc_auth.c b/sysdeps/generic/svc_auth.c deleted file mode 100644 index 9f7ed5eca6..0000000000 --- a/sysdeps/generic/svc_auth.c +++ /dev/null @@ -1,117 +0,0 @@ -/* @(#)svc_auth.c 2.4 88/08/15 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc_auth.c 1.19 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_auth.c, Server-side rpc authenticator interface. - * *WITHOUT* DES authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> -#include <rpc/svc.h> -#include <rpc/svc_auth.h> - -/* - * svcauthsw is the bdevsw of server side authentication. - * - * Server side authenticators are called from authenticate by - * using the client auth struct flavor field to index into svcauthsw. - * The server auth flavors must implement a routine that looks - * like: - * - * enum auth_stat - * flavorx_auth(rqst, msg) - * register struct svc_req *rqst; - * register struct rpc_msg *msg; - * - */ - -static enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *); - /* no authentication */ -extern enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *); - /* unix style (uid, gids) */ -extern enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *); - /* short hand unix style */ - -static const struct - { - enum auth_stat (*authenticator) (struct svc_req *, struct rpc_msg *); - } -svcauthsw[] = -{ - { _svcauth_null }, /* AUTH_NULL */ - { _svcauth_unix }, /* AUTH_UNIX */ - { _svcauth_short } /* AUTH_SHORT */ -}; -#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */ - - -/* - * The call rpc message, msg has been obtained from the wire. The msg contains - * the raw form of credentials and verifiers. authenticate returns AUTH_OK - * if the msg is successfully authenticated. If AUTH_OK then the routine also - * does the following things: - * set rqst->rq_xprt->verf to the appropriate response verifier; - * sets rqst->rq_client_cred to the "cooked" form of the credentials. - * - * NB: rqst->rq_cxprt->verf must be pre-allocated; - * its length is set appropriately. - * - * The caller still owns and is responsible for msg->u.cmb.cred and - * msg->u.cmb.verf. The authentication system retains ownership of - * rqst->rq_client_cred, the cooked credentials. - * - * There is an assumption that any flavour less than AUTH_NULL is - * invalid. - */ -enum auth_stat -_authenticate (register struct svc_req *rqst, struct rpc_msg *msg) -{ - register int cred_flavor; - - rqst->rq_cred = msg->rm_call.cb_cred; - rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor; - rqst->rq_xprt->xp_verf.oa_length = 0; - cred_flavor = rqst->rq_cred.oa_flavor; - if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) - return (*(svcauthsw[cred_flavor].authenticator)) (rqst, msg); - - return AUTH_REJECTEDCRED; -} - -static enum auth_stat -_svcauth_null (struct svc_req *rqst, struct rpc_msg *msg) -{ - return AUTH_OK; -} diff --git a/sysdeps/mach/hurd/Dist b/sysdeps/mach/hurd/Dist index e6067b8a73..084c314649 100644 --- a/sysdeps/mach/hurd/Dist +++ b/sysdeps/mach/hurd/Dist @@ -1,4 +1,11 @@ -errnos.awk err_hurd.sub +errnos.awk +err_hurd.sub libc-ldscript libc_p-ldscript cthreads.c +net/ethernet.h +net/if.h +net/if_arp.h +net/if_ether.h +net/if_ppp.h +net/route.h diff --git a/sysdeps/mach/hurd/mips/Dist b/sysdeps/mach/hurd/mips/Dist new file mode 100644 index 0000000000..b6f3ffa4c3 --- /dev/null +++ b/sysdeps/mach/hurd/mips/Dist @@ -0,0 +1,3 @@ +longjmp-ctx.c +init-fault.c +dl-machine.c diff --git a/sysdeps/powerpc/Dist b/sysdeps/powerpc/Dist index 282cf1394e..a3de7b3c96 100644 --- a/sysdeps/powerpc/Dist +++ b/sysdeps/powerpc/Dist @@ -1,3 +1,5 @@ fenv_const.c fenv_libc.h quad_float.h +fe_nomask.c +t_sqrt.c diff --git a/sysdeps/powerpc/add_n.s b/sysdeps/powerpc/add_n.s new file mode 100644 index 0000000000..609f0a502a --- /dev/null +++ b/sysdeps/powerpc/add_n.s @@ -0,0 +1,68 @@ + # Add two limb vectors of equal, non-zero length for PowerPC. + # Copyright (C) 1997 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 + # 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. + + # mp_limb_t mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, + # mp_size_t size) + # Calculate s1+s2 and put result in res_ptr; return carry, 0 or 1. + + # Note on optimisation: This code is optimal for the 601. Almost every other + # possible 2-unrolled inner loop will not be. Also, watch out for the + # alignment... + + .align 3 + .globl __mpn_add_n + .type __mpn_add_n,@function +__mpn_add_n: + # Set up for loop below. + mtcrf 0x01,%r6 + srwi. %r7,%r6,1 + li %r10,0 + mtctr %r7 + bt 31,2f + + # Clear the carry. + addic %r0,%r0,0 + # Adjust pointers for loop. + addi %r3,%r3,-4 + addi %r4,%r4,-4 + addi %r5,%r5,-4 + b 0f + +2: lwz %r7,0(%r5) + lwz %r6,0(%r4) + addc %r6,%r6,%r7 + stw %r6,0(%r3) + beq 1f + + # The loop. + + # Align start of loop to an odd word boundary to guarantee that the + # last two words can be fetched in one access (for 601). +0: lwz %r9,4(%r4) + lwz %r8,4(%r5) + lwzu %r6,8(%r4) + lwzu %r7,8(%r5) + adde %r8,%r9,%r8 + stw %r8,4(%r3) + adde %r6,%r6,%r7 + stwu %r6,8(%r3) + bdnz 0b + # return the carry +1: addze %r3,%r10 + blr diff --git a/sysdeps/powerpc/addmul_1.s b/sysdeps/powerpc/addmul_1.s new file mode 100644 index 0000000000..cf8fd2a555 --- /dev/null +++ b/sysdeps/powerpc/addmul_1.s @@ -0,0 +1,50 @@ + # Multiply a limb vector by a single limb, for PowerPC. + # Copyright (C) 1993, 1994, 1995, 1997 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 + # 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. + + # 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. + + .align 2 + .globl __mpn_addmul_1 + .type __mpn_addmul_1,@function +__mpn_addmul_1: + mtctr %r5 + + lwz %r0,0(%r4) + mullw %r7,%r0,%r6 + mulhwu %r10,%r0,%r6 + lwz %r9,0(%r3) + addc %r8,%r7,%r9 + addi %r3,%r3,-4 # adjust res_ptr + bdz Lend + +Loop: lwzu %r0,4(%r4) + stwu %r8,4(%r3) + mullw %r8,%r0,%r6 + adde %r7,%r8,%r10 + mulhwu %r10,%r0,%r6 + lwz %r9,4(%r3) + addze %r10,%r10 + addc %r8,%r7,%r9 + bdnz Loop + +Lend: stw %r8,4(%r3) + addze %r3,%r10 + blr diff --git a/sysdeps/powerpc/lshift.s b/sysdeps/powerpc/lshift.s new file mode 100644 index 0000000000..9612a3dbec --- /dev/null +++ b/sysdeps/powerpc/lshift.s @@ -0,0 +1,479 @@ + # Shift a limb left, low level routine. + # Copyright (C) 1996, 1997 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 + # 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. + + # mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize, + # unsigned int cnt) + + .align 3 + .globl __mpn_lshift + .type __mpn_lshift,@function +__mpn_lshift: + mtctr %r5 # copy size into CTR + cmplwi %cr0,%r5,16 # is size < 16 + slwi %r0,%r5,2 + add %r7,%r3,%r0 # make r7 point at end of res + add %r4,%r4,%r0 # make r4 point at end of s1 + lwzu %r11,-4(%r4) # load first s1 limb + subfic %r8,%r6,32 + srw %r3,%r11,%r8 # compute function return value + bge %cr0,Lbig # branch if size >= 16 + + bdz Lend1 + +Loop: lwzu %r10,-4(%r4) + slw %r9,%r11,%r6 + srw %r12,%r10,%r8 + or %r9,%r9,%r12 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slw %r9,%r10,%r6 + srw %r12,%r11,%r8 + or %r9,%r9,%r12 + stwu %r9,-4(%r7) + bdnz Loop + b Lend1 + + # Guaranteed not to succeed. +LBoom: tweq %r0,%r0 + + # We imitate a case statement, by using (yuk!) fixed-length code chunks, + # of size 4*12 bytes. We have to do this (or something) to make this PIC. +Lbig: mflr %r9 + bltl %cr0,LBoom # Never taken, only used to set LR. + slwi %r10,%r6,4 + mflr %r12 + add %r10,%r12,%r10 + slwi %r8,%r6,5 + add %r10,%r8,%r10 + mtctr %r10 + addi %r5,%r5,-1 + mtlr %r9 + bctr + +Lend1: slw %r0,%r11,%r6 + stw %r0,-4(%r7) + blr + + mtctr %r5 +Loop1: lwzu %r10,-4(%r4) + slwi %r9,%r11,1 + inslwi %r9,%r10,1,31 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,1 + inslwi %r9,%r11,1,31 + stwu %r9,-4(%r7) + bdnz Loop1 + b Lend1 + + mtctr %r5 +Loop2: lwzu %r10,-4(%r4) + slwi %r9,%r11,2 + inslwi %r9,%r10,2,30 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,2 + inslwi %r9,%r11,2,30 + stwu %r9,-4(%r7) + bdnz Loop2 + b Lend1 + + mtctr %r5 +Loop3: lwzu %r10,-4(%r4) + slwi %r9,%r11,3 + inslwi %r9,%r10,3,29 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,3 + inslwi %r9,%r11,3,29 + stwu %r9,-4(%r7) + bdnz Loop3 + b Lend1 + + mtctr %r5 +Loop4: lwzu %r10,-4(%r4) + slwi %r9,%r11,4 + inslwi %r9,%r10,4,28 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,4 + inslwi %r9,%r11,4,28 + stwu %r9,-4(%r7) + bdnz Loop4 + b Lend1 + + mtctr %r5 +Loop5: lwzu %r10,-4(%r4) + slwi %r9,%r11,5 + inslwi %r9,%r10,5,27 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,5 + inslwi %r9,%r11,5,27 + stwu %r9,-4(%r7) + bdnz Loop5 + b Lend1 + + mtctr %r5 +Loop6: lwzu %r10,-4(%r4) + slwi %r9,%r11,6 + inslwi %r9,%r10,6,26 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,6 + inslwi %r9,%r11,6,26 + stwu %r9,-4(%r7) + bdnz Loop6 + b Lend1 + + mtctr %r5 +Loop7: lwzu %r10,-4(%r4) + slwi %r9,%r11,7 + inslwi %r9,%r10,7,25 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,7 + inslwi %r9,%r11,7,25 + stwu %r9,-4(%r7) + bdnz Loop7 + b Lend1 + + mtctr %r5 +Loop8: lwzu %r10,-4(%r4) + slwi %r9,%r11,8 + inslwi %r9,%r10,8,24 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,8 + inslwi %r9,%r11,8,24 + stwu %r9,-4(%r7) + bdnz Loop8 + b Lend1 + + mtctr %r5 +Loop9: lwzu %r10,-4(%r4) + slwi %r9,%r11,9 + inslwi %r9,%r10,9,23 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,9 + inslwi %r9,%r11,9,23 + stwu %r9,-4(%r7) + bdnz Loop9 + b Lend1 + + mtctr %r5 +Loop10: lwzu %r10,-4(%r4) + slwi %r9,%r11,10 + inslwi %r9,%r10,10,22 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,10 + inslwi %r9,%r11,10,22 + stwu %r9,-4(%r7) + bdnz Loop10 + b Lend1 + + mtctr %r5 +Loop11: lwzu %r10,-4(%r4) + slwi %r9,%r11,11 + inslwi %r9,%r10,11,21 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,11 + inslwi %r9,%r11,11,21 + stwu %r9,-4(%r7) + bdnz Loop11 + b Lend1 + + mtctr %r5 +Loop12: lwzu %r10,-4(%r4) + slwi %r9,%r11,12 + inslwi %r9,%r10,12,20 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,12 + inslwi %r9,%r11,12,20 + stwu %r9,-4(%r7) + bdnz Loop12 + b Lend1 + + mtctr %r5 +Loop13: lwzu %r10,-4(%r4) + slwi %r9,%r11,13 + inslwi %r9,%r10,13,19 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,13 + inslwi %r9,%r11,13,19 + stwu %r9,-4(%r7) + bdnz Loop13 + b Lend1 + + mtctr %r5 +Loop14: lwzu %r10,-4(%r4) + slwi %r9,%r11,14 + inslwi %r9,%r10,14,18 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,14 + inslwi %r9,%r11,14,18 + stwu %r9,-4(%r7) + bdnz Loop14 + b Lend1 + + mtctr %r5 +Loop15: lwzu %r10,-4(%r4) + slwi %r9,%r11,15 + inslwi %r9,%r10,15,17 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,15 + inslwi %r9,%r11,15,17 + stwu %r9,-4(%r7) + bdnz Loop15 + b Lend1 + + mtctr %r5 +Loop16: lwzu %r10,-4(%r4) + slwi %r9,%r11,16 + inslwi %r9,%r10,16,16 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,16 + inslwi %r9,%r11,16,16 + stwu %r9,-4(%r7) + bdnz Loop16 + b Lend1 + + mtctr %r5 +Loop17: lwzu %r10,-4(%r4) + slwi %r9,%r11,17 + inslwi %r9,%r10,17,15 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,17 + inslwi %r9,%r11,17,15 + stwu %r9,-4(%r7) + bdnz Loop17 + b Lend1 + + mtctr %r5 +Loop18: lwzu %r10,-4(%r4) + slwi %r9,%r11,18 + inslwi %r9,%r10,18,14 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,18 + inslwi %r9,%r11,18,14 + stwu %r9,-4(%r7) + bdnz Loop18 + b Lend1 + + mtctr %r5 +Loop19: lwzu %r10,-4(%r4) + slwi %r9,%r11,19 + inslwi %r9,%r10,19,13 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,19 + inslwi %r9,%r11,19,13 + stwu %r9,-4(%r7) + bdnz Loop19 + b Lend1 + + mtctr %r5 +Loop20: lwzu %r10,-4(%r4) + slwi %r9,%r11,20 + inslwi %r9,%r10,20,12 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,20 + inslwi %r9,%r11,20,12 + stwu %r9,-4(%r7) + bdnz Loop20 + b Lend1 + + mtctr %r5 +Loop21: lwzu %r10,-4(%r4) + slwi %r9,%r11,21 + inslwi %r9,%r10,21,11 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,21 + inslwi %r9,%r11,21,11 + stwu %r9,-4(%r7) + bdnz Loop21 + b Lend1 + + mtctr %r5 +Loop22: lwzu %r10,-4(%r4) + slwi %r9,%r11,22 + inslwi %r9,%r10,22,10 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,22 + inslwi %r9,%r11,22,10 + stwu %r9,-4(%r7) + bdnz Loop22 + b Lend1 + + mtctr %r5 +Loop23: lwzu %r10,-4(%r4) + slwi %r9,%r11,23 + inslwi %r9,%r10,23,9 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,23 + inslwi %r9,%r11,23,9 + stwu %r9,-4(%r7) + bdnz Loop23 + b Lend1 + + mtctr %r5 +Loop24: lwzu %r10,-4(%r4) + slwi %r9,%r11,24 + inslwi %r9,%r10,24,8 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,24 + inslwi %r9,%r11,24,8 + stwu %r9,-4(%r7) + bdnz Loop24 + b Lend1 + + mtctr %r5 +Loop25: lwzu %r10,-4(%r4) + slwi %r9,%r11,25 + inslwi %r9,%r10,25,7 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,25 + inslwi %r9,%r11,25,7 + stwu %r9,-4(%r7) + bdnz Loop25 + b Lend1 + + mtctr %r5 +Loop26: lwzu %r10,-4(%r4) + slwi %r9,%r11,26 + inslwi %r9,%r10,26,6 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,26 + inslwi %r9,%r11,26,6 + stwu %r9,-4(%r7) + bdnz Loop26 + b Lend1 + + mtctr %r5 +Loop27: lwzu %r10,-4(%r4) + slwi %r9,%r11,27 + inslwi %r9,%r10,27,5 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,27 + inslwi %r9,%r11,27,5 + stwu %r9,-4(%r7) + bdnz Loop27 + b Lend1 + + mtctr %r5 +Loop28: lwzu %r10,-4(%r4) + slwi %r9,%r11,28 + inslwi %r9,%r10,28,4 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,28 + inslwi %r9,%r11,28,4 + stwu %r9,-4(%r7) + bdnz Loop28 + b Lend1 + + mtctr %r5 +Loop29: lwzu %r10,-4(%r4) + slwi %r9,%r11,29 + inslwi %r9,%r10,29,3 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,29 + inslwi %r9,%r11,29,3 + stwu %r9,-4(%r7) + bdnz Loop29 + b Lend1 + + mtctr %r5 +Loop30: lwzu %r10,-4(%r4) + slwi %r9,%r11,30 + inslwi %r9,%r10,30,2 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,30 + inslwi %r9,%r11,30,2 + stwu %r9,-4(%r7) + bdnz Loop30 + b Lend1 + + mtctr %r5 +Loop31: lwzu %r10,-4(%r4) + slwi %r9,%r11,31 + inslwi %r9,%r10,31,1 + stwu %r9,-4(%r7) + bdz Lend2 + lwzu %r11,-4(%r4) + slwi %r9,%r10,31 + inslwi %r9,%r11,31,1 + stwu %r9,-4(%r7) + bdnz Loop31 + b Lend1 + +Lend2: slw %r0,%r10,%r6 + stw %r0,-4(%r7) + blr diff --git a/sysdeps/powerpc/memset.s b/sysdeps/powerpc/memset.s new file mode 100644 index 0000000000..4c8bf8c6b4 --- /dev/null +++ b/sysdeps/powerpc/memset.s @@ -0,0 +1,202 @@ + # Optimized memset implementation for PowerPC. + # Copyright (C) 1997 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 + # 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. + + .section ".text" + .align 5 + nop + + .globl memset + .type memset,@function +memset: + # __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5])); + # Returns 's'. + + # The memset is done in three sizes: byte (8 bits), word (32 bits), + # cache line (256 bits). There is a special case for setting cache lines + # to 0, to take advantage of the dcbz instruction. + # r6: current address we are storing at + # r7: number of bytes we are setting now (when aligning) + + # take care of case for size <= 4 + cmplwi %cr1,%r5,4 + andi. %r7,%r3,3 + mr %r6,%r3 + ble- %cr1,small + # align to word boundary + cmplwi %cr5,%r5,31 + rlwimi %r4,%r4,8,16,23 + beq+ aligned # 8th instruction from .align + mtcrf 0x01,%r3 + subfic %r7,%r7,4 + add %r6,%r6,%r7 + sub %r5,%r5,%r7 + bf+ 31,0f + stb %r4,0(%r3) + bt 30,aligned +0: sth %r4,-2(%r6) # 16th instruction from .align + # take care of case for size < 31 +aligned: + mtcrf 0x01,%r5 + rlwimi %r4,%r4,16,0,15 + ble %cr5,medium + # align to cache line boundary... + andi. %r7,%r6,0x1C + subfic %r7,%r7,0x20 + beq caligned + mtcrf 0x01,%r7 + add %r6,%r6,%r7 + sub %r5,%r5,%r7 + cmplwi %cr1,%r7,0x10 + mr %r8,%r6 + bf 28,1f + stw %r4,-4(%r8) + stwu %r4,-8(%r8) +1: blt %cr1,2f + stw %r4,-4(%r8) # 32nd instruction from .align + stw %r4,-8(%r8) + stw %r4,-12(%r8) + stwu %r4,-16(%r8) +2: bf 29,caligned + stw %r4,-4(%r8) + # now aligned to a cache line. +caligned: + cmplwi %cr1,%r4,0 + clrrwi. %r7,%r5,5 + mtcrf 0x01,%r5 # 40th instruction from .align + beq %cr1,zloopstart # special case for clearing memory using dcbz + srwi %r0,%r7,5 + mtctr %r0 + beq medium # we may not actually get to do a full line + clrlwi. %r5,%r5,27 + add %r6,%r6,%r7 +0: li %r8,-0x40 + bdz cloopdone # 48th instruction from .align + +cloop: dcbz %r8,%r6 + stw %r4,-4(%r6) + stw %r4,-8(%r6) + stw %r4,-12(%r6) + stw %r4,-16(%r6) + nop # let 601 fetch last 4 instructions of loop + stw %r4,-20(%r6) + stw %r4,-24(%r6) # 56th instruction from .align + nop # let 601 fetch first 8 instructions of loop + stw %r4,-28(%r6) + stwu %r4,-32(%r6) + bdnz cloop +cloopdone: + stw %r4,-4(%r6) + stw %r4,-8(%r6) + stw %r4,-12(%r6) + stw %r4,-16(%r6) # 64th instruction from .align + stw %r4,-20(%r6) + cmplwi %cr1,%r5,16 + stw %r4,-24(%r6) + stw %r4,-28(%r6) + stwu %r4,-32(%r6) + beqlr + add %r6,%r6,%r7 + b medium_tail2 # 72nd instruction from .align + + .align 5 + nop +# clear lines of memory in 128-byte chunks. +zloopstart: + clrlwi %r5,%r5,27 + mtcrf 0x02,%r7 + srwi. %r0,%r7,7 + mtctr %r0 + li %r7,0x20 + li %r8,-0x40 + cmplwi %cr1,%r5,16 # 8 + bf 26,0f + dcbz 0,%r6 + addi %r6,%r6,0x20 +0: li %r9,-0x20 + bf 25,1f + dcbz 0,%r6 + dcbz %r7,%r6 + addi %r6,%r6,0x40 # 16 +1: cmplwi %cr5,%r5,0 + beq medium +zloop: + dcbz 0,%r6 + dcbz %r7,%r6 + addi %r6,%r6,0x80 + dcbz %r8,%r6 + dcbz %r9,%r6 + bdnz zloop + beqlr %cr5 + b medium_tail2 + + .align 5 +small: + # Memset of 4 bytes or less. + cmplwi %cr5,%r5,1 + cmplwi %cr1,%r5,3 + bltlr %cr5 + stb %r4,0(%r6) + beqlr %cr5 + nop + stb %r4,1(%r6) + bltlr %cr1 + stb %r4,2(%r6) + beqlr %cr1 + nop + stb %r4,3(%r6) + blr + +# memset of 0-31 bytes + .align 5 +medium: + cmplwi %cr1,%r5,16 +medium_tail2: + add %r6,%r6,%r5 +medium_tail: + bt- 31,medium_31t + bt- 30,medium_30t +medium_30f: + bt- 29,medium_29t +medium_29f: + bge- %cr1,medium_27t + bflr- 28 + stw %r4,-4(%r6) # 8th instruction from .align + stw %r4,-8(%r6) + blr + +medium_31t: + stbu %r4,-1(%r6) + bf- 30,medium_30f +medium_30t: + sthu %r4,-2(%r6) + bf- 29,medium_29f +medium_29t: + stwu %r4,-4(%r6) + blt- %cr1,medium_27f # 16th instruction from .align +medium_27t: + stw %r4,-4(%r6) + stw %r4,-8(%r6) + stw %r4,-12(%r6) + stwu %r4,-16(%r6) +medium_27f: + bflr- 28 +medium_28t: + stw %r4,-4(%r6) + stw %r4,-8(%r6) + blr diff --git a/sysdeps/powerpc/mul_1.s b/sysdeps/powerpc/mul_1.s new file mode 100644 index 0000000000..d6eb623bd4 --- /dev/null +++ b/sysdeps/powerpc/mul_1.s @@ -0,0 +1,47 @@ + # Multiply a limb vector by a limb, for PowerPC. + # Copyright (C) 1993, 1994, 1995, 1997 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 + # 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. + + # 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. + + .align 2 + .globl __mpn_mul_1 + .type __mpn_mul_1,@function + +__mpn_mul_1: + mtctr %r5 + + lwz %r0,0(%r4) + mullw %r7,%r0,%r6 + mulhwu %r10,%r0,%r6 + addi %r3,%r3,-4 # adjust res_ptr + addic %r5,%r5,0 # clear cy with dummy insn + bdz Lend + +Loop: lwzu %r0,4(%r4) + stwu %r7,4(%r3) + mullw %r8,%r0,%r6 + adde %r7,%r8,%r10 + mulhwu %r10,%r0,%r6 + bdnz Loop + +Lend: stw %r7,4(%r3) + addze %r3,%r10 + blr diff --git a/sysdeps/powerpc/rshift.s b/sysdeps/powerpc/rshift.s new file mode 100644 index 0000000000..20f09ad86a --- /dev/null +++ b/sysdeps/powerpc/rshift.s @@ -0,0 +1,59 @@ +# PowerPC-32 __mpn_rshift -- + +# Copyright (C) 1995 Free Software Foundation, Inc. + +# This file is part of the GNU MP Library. + +# The GNU MP 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 MP 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 MP 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. + + +# INPUT PARAMETERS +# res_ptr r3 +# s1_ptr r4 +# size r5 +# cnt r6 + + .align 3 + .globl __mpn_rshift + .type __mpn_rshift,@function +__mpn_rshift: + mtctr 5 # copy size into CTR + addi 7,3,-4 # move adjusted res_ptr to free return reg + subfic 8,6,32 + lwz 11,0(4) # load first s1 limb + slw 3,11,8 # compute function return value + bdz Lend1 + +Loop: lwzu 10,4(4) + srw 9,11,6 + slw 12,10,8 + or 9,9,12 + stwu 9,4(7) + bdz Lend2 + lwzu 11,4(4) + srw 9,10,6 + slw 12,11,8 + or 9,9,12 + stwu 9,4(7) + bdnz Loop + +Lend1: srw 0,11,6 + stw 0,4(7) + blr + +Lend2: srw 0,10,6 + stw 0,4(7) + blr diff --git a/sysdeps/powerpc/strchr.s b/sysdeps/powerpc/strchr.s new file mode 100644 index 0000000000..c1df66f8dc --- /dev/null +++ b/sysdeps/powerpc/strchr.s @@ -0,0 +1,118 @@ + # Optimized strchr implementation for PowerPC. + # Copyright (C) 1997 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 + # 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. + + # See strlen.s for comments on how this works. + + .section ".text" + .align 2 + .globl strchr + .type strchr,@function +strchr: + # char * [r3] strchr (const char *s [r3] , int c [r4] ) + + # r0: a temporary + # r3: our return result. + # r4: byte we're looking for, spread over the whole word + # r5: the current word + # r6: the constant 0xfefefeff (-0x01010101) + # r7: the constant 0x7f7f7f7f + # r8: pointer to the current word. + # r9: a temporary + # r10: the number of bits we should ignore in the first word + # r11: a mask with the bits to ignore set to 0 + # r12: a temporary + + rlwimi %r4,%r4,8,16,23 + li %r11,-1 + rlwimi %r4,%r4,16,0,15 + lis %r6,0xfeff + lis %r7,0x7f7f + clrrwi %r8,%r3,2 + addi %r7,%r7,0x7f7f + addi %r6,%r6,0xfffffeff + rlwinm %r10,%r3,3,27,28 + # Test the first (partial?) word. + lwz %r5,0(%r8) + srw %r11,%r11,%r10 + orc %r5,%r5,%r11 + add %r0,%r6,%r5 + nor %r9,%r7,%r5 + and. %r0,%r0,%r9 + xor %r12,%r4,%r5 + orc %r12,%r12,%r11 + b loopentry + + # The loop. + +loop: lwzu %r5,4(%r8) + and. %r0,%r0,%r9 + # Test for 0 + add %r0,%r6,%r5 + nor %r9,%r7,%r5 + bne foundit + and. %r0,%r0,%r9 + # Start test for the bytes we're looking for + xor %r12,%r4,%r5 +loopentry: + add %r0,%r6,%r12 + nor %r9,%r7,%r12 + beq loop + # There is a zero byte in the word, but may also be a matching byte (either + # before or after the zero byte). In fact, we may be looking for a + # zero byte, in which case we return a match. We guess that this hasn't + # happened, though. +missed: + and. %r0,%r0,%r9 + li %r3,0 + beqlr + # It did happen. Decide which one was first... + # I'm not sure if this is actually faster than a sequence of + # rotates, compares, and branches (we use it anyway because it's shorter). + and %r6,%r7,%r5 + or %r11,%r7,%r5 + and %r0,%r7,%r12 + or %r10,%r7,%r12 + add %r6,%r6,%r7 + add %r0,%r0,%r7 + nor %r5,%r11,%r6 + nor %r9,%r10,%r0 + cmplw %r5,%r9 + bgtlr + cntlzw %r4,%r9 + srwi %r4,%r4,3 + add %r3,%r8,%r4 + blr + +foundit: + and %r0,%r7,%r12 + or %r10,%r7,%r12 + add %r0,%r0,%r7 + nor %r9,%r10,%r0 + cntlzw %r4,%r9 + subi %r8,%r8,4 + srwi %r4,%r4,3 + add %r3,%r8,%r4 + blr + +0: + .size strchr,0b-strchr + + .globl index + .weak index + .set index,strchr diff --git a/sysdeps/powerpc/strcmp.s b/sysdeps/powerpc/strcmp.s new file mode 100644 index 0000000000..f901b82ab1 --- /dev/null +++ b/sysdeps/powerpc/strcmp.s @@ -0,0 +1,273 @@ + # Optimized strcmp implementation for PowerPC. + # Copyright (C) 1997 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 + # 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. + + # See strlen.s for comments on how the end-of-string testing works. + + .section ".text" + .align 3 + .globl strcmp + .type strcmp,@function +strcmp: + # int [r3] strcmp (const char *p1 [r3], const char *p2 [r4]) + + # General register assignments: + # r0: temporary + # r3: pointer to previous word in s1 + # r4: pointer to previous word in s2 + # r5: current first word in s1 + # r6: current first word in s2 (after re-alignment) + # r7: 0xfefefeff + # r8: 0x7f7f7f7f + # r9: ~(word in s1 | 0x7f7f7f7f) + + # Register assignments in the prologue: + # r10: low 2 bits of p2-p1 + # r11: mask to orc with r5/r6 + + subf. %r10,%r4,%r3 + beq- equal + andi. %r10,%r10,3 + cmpi %cr1,%r10,2 + beq- %cr1,align2 + lis %r7,0xfeff + lis %r8,0x7f7f + addi %r8,%r8,0x7f7f + addi %r7,%r7,0xfffffeff + bgt- %cr1,align3 +strcmp3: + rlwinm %r0,%r3,3,27,28 + li %r11,-1 + srw %r11,%r11,%r0 + clrrwi %r3,%r3,2 + clrrwi %r4,%r4,2 + lwz %r5,0(%r3) + lwz %r6,0(%r4) + bne- align1 + + # The loop, case when both strings are aligned the same. + # on entry, cr1.eq must be 1. + # r10: second word in s1 + # r11: second word in s2 OR mask to orc with first two words. +align0: + andi. %r0,%r3,4 + orc %r5,%r5,%r11 + orc %r6,%r6,%r11 + beq+ a0start + add %r0,%r7,%r5 + nor %r9,%r8,%r5 + and. %r0,%r0,%r9 + cmplw %cr1,%r5,%r6 + subi %r3,%r3,4 + bne- endstringeq + subi %r4,%r4,4 + bne- %cr1,difference + +loopalign0: + lwzu %r5,8(%r3) + bne- %cr1,difference2 + lwzu %r6,8(%r4) +a0start: + add %r0,%r7,%r5 + nor %r9,%r8,%r5 + and. %r0,%r0,%r9 + cmplw %cr1,%r5,%r6 + lwz %r10,4(%r3) + bne- endstringeq + add %r0,%r7,%r10 + bne- %cr1,difference + nor %r9,%r8,%r10 + lwz %r11,4(%r4) + and. %r0,%r0,%r9 + cmplw %cr1,%r10,%r11 + beq+ loopalign0 + + mr %r5,%r10 + mr %r6,%r11 + + # fall through to... + +endstringeq: + # (like 'endstring', but an equality code is in cr1) + beq %cr1,equal +endstring: + # OK. We've hit the end of the string. We need to be careful that + # we don't compare two strings as different because of gunk beyond + # the end of the strings. We do it like this... + and %r0,%r8,%r5 + add %r0,%r0,%r8 + xor. %r10,%r5,%r6 + andc %r9,%r9,%r0 + cntlzw %r10,%r10 + cntlzw %r9,%r9 + addi %r9,%r9,7 + cmpw %cr1,%r9,%r10 + blt %cr1,equal + sub %r3,%r5,%r6 + bgelr+ + mr %r3,%r6 + blr +equal: li %r3,0 + blr + + # The loop, case when s2 is aligned 1 char behind s1. + # r10: current word in s2 (before re-alignment) + +align1: + cmpwi %cr1,%r0,0 + orc %r5,%r5,%r11 + bne %cr1,align1_123 + # When s1 is aligned to a word boundary, the startup processing is special. + slwi. %r6,%r6,24 + bne+ a1entry_0 + nor %r9,%r8,%r5 + b endstring + +align1_123: + # Otherwise (s1 not aligned to a word boundary): + mr %r10,%r6 + add %r0,%r7,%r5 + nor %r9,%r8,%r5 + and. %r0,%r0,%r9 + srwi %r6,%r6,8 + orc %r6,%r6,%r11 + cmplw %cr1,%r5,%r6 + bne- endstringeq + bne- %cr1,difference + +loopalign1: + slwi. %r6,%r10,24 + bne- %cr1,a1difference + lwzu %r5,4(%r3) + beq- endstring1 +a1entry_0: + lwzu %r10,4(%r4) +a1entry_123: + add %r0,%r7,%r5 + nor %r9,%r8,%r5 + and. %r0,%r0,%r9 + rlwimi %r6,%r10,24,8,31 + cmplw %cr1,%r5,%r6 + beq+ loopalign1 + b endstringeq + +endstring1: + srwi %r3,%r5,24 + blr + +a1difference: + lbz %r6,-1(%r4) + slwi %r6,%r6,24 + rlwimi %r6,%r10,24,8,31 + + # fall through to... + +difference: + # The idea here is that we could just return '%r5 - %r6', except + # that the result might overflow. Overflow can only happen when %r5 + # and %r6 have different signs (thus the xor), in which case we want to + # return negative iff %r6 has its high bit set so %r5 < %r6. + # A branch-free implementation of this is + # xor %r0,%r5,%r6 + # rlwinm %r0,%r0,1,31,31 + # rlwnm %r5,%r5,%r0,1,31 + # rlwnm %r6,%r6,%r0,1,31 + # sub %r3,%r5,%r6 + # blr + # but this is usually more expensive. + xor. %r0,%r5,%r6 + sub %r3,%r5,%r6 + bgelr+ + mr %r3,%r6 + blr + +difference2: + # As for 'difference', but use registers r10 and r11 instead of r5 and r6. + xor. %r0,%r10,%r11 + sub %r3,%r10,%r11 + bgelr+ + mr %r3,%r11 + blr + + # For the case when s2 is aligned 3 chars behind s1, we switch + # s1 and s2... + # r10: used by 'align2' (see below) + # r11: used by 'align2' (see below) + # r12: saved link register + # cr0.eq: must be left as 1. + +align3: mflr %r12 + mr %r0,%r3 + mr %r3,%r4 + mr %r4,%r0 + bl strcmp3 + mtlr %r12 + neg %r3,%r3 + blr + + # The loop, case when s2 and s1's alignments differ by 2 + # This is the ugly case... + # FIXME: on a 601, the loop takes 7 cycles instead of the 6 you'd expect, + # because there are too many branches. This loop should probably be + # coded like the align1 case. + +a2even: lhz %r5,0(%r3) + lhz %r6,0(%r4) + b a2entry + +align2: + andi. %r0,%r3,1 + beq+ a2even + subi %r3,%r3,1 + subi %r4,%r4,1 + lbz %r5,1(%r3) + lbz %r6,1(%r4) + cmpwi %cr0,%r5,0 + cmpw %cr1,%r5,%r6 + beq- align2end2 + lhzu %r5,2(%r3) + beq+ %cr1,a2entry1 + lbz %r5,-1(%r3) + sub %r3,%r5,%r6 + blr + +loopalign2: + cmpw %cr1,%r5,%r6 + beq- align2end2 + lhzu %r5,2(%r3) + bne- %cr1,align2different +a2entry1: + lhzu %r6,2(%r4) +a2entry: + cmpwi %cr5,%r5,0x00ff + andi. %r0,%r5,0x00ff + bgt+ %cr5,loopalign2 + +align2end: + andi. %r3,%r6,0xff00 + neg %r3,%r3 + blr + +align2different: + lhzu %r5,-2(%r3) +align2end2: + sub %r3,%r5,%r6 + blr + +0: + .size strcmp,0b-strcmp diff --git a/sysdeps/powerpc/sub_n.s b/sysdeps/powerpc/sub_n.s new file mode 100644 index 0000000000..8711bf9a40 --- /dev/null +++ b/sysdeps/powerpc/sub_n.s @@ -0,0 +1,69 @@ + # Subtract two limb vectors of equal, non-zero length for PowerPC. + # Copyright (C) 1997 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 + # 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. + + # mp_limb_t mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, + # mp_size_t size) + # Calculate s1-s2 and put result in res_ptr; return borrow, 0 or 1. + + # Note on optimisation: This code is optimal for the 601. Almost every other + # possible 2-unrolled inner loop will not be. Also, watch out for the + # alignment... + + .align 3 + .globl __mpn_sub_n + .type __mpn_sub_n,@function + nop +__mpn_sub_n: + # Set up for loop below. + mtcrf 0x01,%r6 + srwi. %r7,%r6,1 + mtctr %r7 + bt 31,2f + + # Set the carry (clear the borrow). + subfc %r0,%r0,%r0 + # Adjust pointers for loop. + addi %r3,%r3,-4 + addi %r4,%r4,-4 + addi %r5,%r5,-4 + b 0f + +2: lwz %r7,0(%r5) + lwz %r6,0(%r4) + subfc %r6,%r7,%r6 + stw %r6,0(%r3) + beq 1f + + # Align start of loop to an odd word boundary to guarantee that the + # last two words can be fetched in one access (for 601). This turns + # out to be important. +0: + lwz %r9,4(%r4) + lwz %r8,4(%r5) + lwzu %r6,8(%r4) + lwzu %r7,8(%r5) + subfe %r8,%r8,%r9 + stw %r8,4(%r3) + subfe %r6,%r7,%r6 + stwu %r6,8(%r3) + bdnz 0b + # return the borrow +1: subfe %r3,%r3,%r3 + neg %r3,%r3 + blr diff --git a/sysdeps/powerpc/submul_1.s b/sysdeps/powerpc/submul_1.s new file mode 100644 index 0000000000..999430d744 --- /dev/null +++ b/sysdeps/powerpc/submul_1.s @@ -0,0 +1,52 @@ + # Multiply a limb vector by a single limb, for PowerPC. + # Copyright (C) 1993, 1994, 1995, 1997 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 + # 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. + + # 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. + + .align 2 + .globl __mpn_submul_1 + .type __mpn_submul_1,@function +__mpn_submul_1: + mtctr %r5 + + lwz %r0,0(%r4) + mullw %r7,%r0,%r6 + mulhwu %r10,%r0,%r6 + lwz %r9,0(%r3) + subf %r8,%r7,%r9 + addc %r7,%r7,%r8 # invert cy (r7 is junk) + addi %r3,%r3,-4 # adjust res_ptr + bdz Lend + +Loop: lwzu %r0,4(%r4) + stwu %r8,4(%r3) + mullw %r8,%r0,%r6 + adde %r7,%r8,%r10 + mulhwu %r10,%r0,%r6 + lwz %r9,4(%r3) + addze %r10,%r10 + subf %r8,%r7,%r9 + addc %r7,%r7,%r8 # invert cy (r7 is junk) + bdnz Loop + +Lend: stw %r8,4(%r3) + addze %r3,%r10 + blr diff --git a/sysdeps/sparc/Dist b/sysdeps/sparc/Dist new file mode 100644 index 0000000000..7832507772 --- /dev/null +++ b/sysdeps/sparc/Dist @@ -0,0 +1 @@ +sys/trap.h diff --git a/sysdeps/sparc/sparc32/Dist b/sysdeps/sparc/sparc32/Dist index 6c3b23baa5..8bd3729740 100644 --- a/sysdeps/sparc/sparc32/Dist +++ b/sysdeps/sparc/sparc32/Dist @@ -1,4 +1,3 @@ dotmul.S umul.S divrem.m4 sdiv.S udiv.S rem.S urem.S alloca.S -sys/trap.h diff --git a/sysdeps/sparc/sparc32/sparcv8/Dist b/sysdeps/sparc/sparc32/sparcv8/Dist new file mode 100644 index 0000000000..6318172684 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv8/Dist @@ -0,0 +1,6 @@ +urem.S +umul.S +udiv.S +sdiv.S +rem.S +dotmul.S diff --git a/sysdeps/stub/des_impl.c b/sysdeps/stub/des_impl.c new file mode 100644 index 0000000000..b6a4a8eb13 --- /dev/null +++ b/sysdeps/stub/des_impl.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1997 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 + 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. */ + +/* We must not distribute the DES implementation as part of the glibc. + So we have to provide a dummy version here. */ +int +_des_crypt (char *buf, unsigned len, struct desparams *desp) +{ + return 0; +} + +stub_warning (_des_crypt) diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist index 6be6876fe7..0f106cf8fa 100644 --- a/sysdeps/unix/sysv/linux/mips/Dist +++ b/sysdeps/unix/sysv/linux/mips/Dist @@ -6,6 +6,7 @@ kernel_termios.h entry.h regdef.h fpregdef.h +sgidefs.h sys/acct.h sys/asm.h sys/cachectl.h diff --git a/sysdeps/unix/sysv/linux/sparc/Dist b/sysdeps/unix/sysv/linux/sparc/Dist new file mode 100644 index 0000000000..7832507772 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/Dist @@ -0,0 +1 @@ +sys/trap.h diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist index 9729f0709b..ed8fc080c1 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist @@ -5,4 +5,3 @@ pipe.S fork.S kernel_stat.h init-first.h -sys/trap.h |