diff options
author | cognet <cognet@FreeBSD.org> | 2006-11-06 22:07:47 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2006-11-06 22:07:47 +0000 |
commit | 367bc6b8e0ccf1af12ccdfff7d83ef3ec5f6be9a (patch) | |
tree | efac90a6f6eae6d12be3852a204d1a350f143b34 | |
parent | 98af8dbef90060a278006bffc0b023a2dffc1dd5 (diff) | |
download | FreeBSD-src-367bc6b8e0ccf1af12ccdfff7d83ef3ec5f6be9a.zip FreeBSD-src-367bc6b8e0ccf1af12ccdfff7d83ef3ec5f6be9a.tar.gz |
Instead of re-implementing hton[ls] and friends for each arch, add a new MI
file, net/ntoh.c, which just implement them using the inline functions from
<sys/endian.h>.
Suggested by: bde
33 files changed, 37 insertions, 1230 deletions
diff --git a/lib/libc/amd64/net/Makefile.inc b/lib/libc/amd64/net/Makefile.inc deleted file mode 100644 index 96e559b..0000000 --- a/lib/libc/amd64/net/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD$ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S deleted file mode 100644 index 8d802d6..0000000 --- a/lib/libc/amd64/net/htonl.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htonl.s 5.3 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htonl(hostorder) */ - - .weak CNAME(htonl) - .set CNAME(htonl),CNAME(__htonl) -ENTRY(__htonl) - movl %edi,%eax - bswap %eax - ret diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S deleted file mode 100644 index 6940ef0..0000000 --- a/lib/libc/amd64/net/htons.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htons.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htons(hostorder) */ - - .weak CNAME(htons) - .set CNAME(htons),CNAME(__htons) -ENTRY(__htons) - movl %edi,%eax - xchgb %al,%ah - ret diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S deleted file mode 100644 index e5e2150..0000000 --- a/lib/libc/amd64/net/ntohl.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohl.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohl(netorder) */ - - .weak CNAME(ntohl) - .set CNAME(ntohl),CNAME(__ntohl) -ENTRY(__ntohl) - movl %edi,%eax - bswap %eax - ret diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S deleted file mode 100644 index 02e4441..0000000 --- a/lib/libc/amd64/net/ntohs.S +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohs.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohs(netorder) */ - -#include <machine/asm.h> - - .weak CNAME(ntohs) - .set CNAME(ntohs),CNAME(__ntohs) -ENTRY(__ntohs) - movl %edi,%eax - xchgb %al,%ah - ret diff --git a/lib/libc/arm/net/htonl.S b/lib/libc/arm/net/htonl.S deleted file mode 100644 index 33bc588..0000000 --- a/lib/libc/arm/net/htonl.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.2 2003/04/05 23:08:51 bjh21 Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Neil A. Carson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -_ENTRY(_C_LABEL(htonl)) -_PROF_PROLOGUE -#ifndef __ARMEB__ - eor r1, r0, r0, ror #16 - bic r1, r1, #0x00FF0000 - mov r0, r0, ror #8 - eor r0, r0, r1, lsr #8 -#endif - mov pc, lr diff --git a/lib/libc/arm/net/ntohl.S b/lib/libc/arm/net/ntohl.S deleted file mode 100644 index eef7a5a..0000000 --- a/lib/libc/arm/net/ntohl.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.2 2003/04/05 23:08:51 bjh21 Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Neil A. Carson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -_ENTRY(_C_LABEL(ntohl)) -_PROF_PROLOGUE -#ifndef __ARMEB__ - eor r1, r0, r0, ror #16 - bic r1, r1, #0x00FF0000 - mov r0, r0, ror #8 - eor r0, r0, r1, lsr #8 -#endif - mov pc, lr diff --git a/lib/libc/arm/net/ntohs.S b/lib/libc/arm/net/ntohs.S deleted file mode 100644 index 61dad4a..0000000 --- a/lib/libc/arm/net/ntohs.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -_ENTRY(_C_LABEL(ntohs)) -_PROF_PROLOGUE -#ifndef __ARMEB__ - and r1, r0, #0xff - mov r0, r0, lsr #8 - orr r0, r0, r1, lsl #8 -#endif - mov pc, lr diff --git a/lib/libc/i386/net/Makefile.inc b/lib/libc/i386/net/Makefile.inc deleted file mode 100644 index 96e559b..0000000 --- a/lib/libc/i386/net/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD$ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/i386/net/htonl.S b/lib/libc/i386/net/htonl.S deleted file mode 100644 index 37f5c60..0000000 --- a/lib/libc/i386/net/htonl.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htonl.s 5.3 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htonl(hostorder) */ - - .weak CNAME(htonl) - .set CNAME(htonl),CNAME(__htonl) -ENTRY(__htonl) - movl 4(%esp),%eax - bswap %eax - ret diff --git a/lib/libc/i386/net/htons.S b/lib/libc/i386/net/htons.S deleted file mode 100644 index d5d63fc..0000000 --- a/lib/libc/i386/net/htons.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htons.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htons(hostorder) */ - - .weak CNAME(htons) - .set CNAME(htons),CNAME(__htons) -ENTRY(__htons) - movzwl 4(%esp),%eax - xchgb %al,%ah - ret diff --git a/lib/libc/i386/net/ntohl.S b/lib/libc/i386/net/ntohl.S deleted file mode 100644 index 497f300..0000000 --- a/lib/libc/i386/net/ntohl.S +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohl.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohl(netorder) */ - - .weak CNAME(ntohl) - .set CNAME(ntohl),CNAME(__ntohl) -ENTRY(__ntohl) - movl 4(%esp),%eax - bswap %eax - ret diff --git a/lib/libc/i386/net/ntohs.S b/lib/libc/i386/net/ntohs.S deleted file mode 100644 index eb0668c..0000000 --- a/lib/libc/i386/net/ntohs.S +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohs.s 5.2 (Berkeley) 12/17/90" -#endif /* LIBC_SCCS and not lint */ -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohs(netorder) */ - -#include <machine/asm.h> - - .weak CNAME(ntohs) - .set CNAME(ntohs),CNAME(__ntohs) -ENTRY(__ntohs) - movzwl 4(%esp),%eax - xchgb %al,%ah - ret diff --git a/lib/libc/ia64/net/Makefile.inc b/lib/libc/ia64/net/Makefile.inc deleted file mode 100644 index b717813..0000000 --- a/lib/libc/ia64/net/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/ia64/net/byte_swap_2.S b/lib/libc/ia64/net/byte_swap_2.S deleted file mode 100644 index 34498b7..0000000 --- a/lib/libc/ia64/net/byte_swap_2.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#if !defined(ALIAS) || !defined(NAME) -#error ALIAS or NAME not defined -#endif - -/* - * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) - * - * Argument is an unsigned 2-byte integer (u_int16_t). - */ -WEAK_ALIAS(ALIAS, NAME) -ENTRY(NAME, 1) - mux1 r16=in0,@rev - ;; - extr.u r8=r16,48,16 - br.ret.sptk.few rp -END(NAME) diff --git a/lib/libc/ia64/net/byte_swap_4.S b/lib/libc/ia64/net/byte_swap_4.S deleted file mode 100644 index c5daa81..0000000 --- a/lib/libc/ia64/net/byte_swap_4.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#if !defined(ALIAS) || !defined(NAME) -#error ALIAS or NAME not defined -#endif - -/* - * Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.) - * - * Argument is an unsigned 4-byte integer (u_int32_t). - */ -WEAK_ALIAS(ALIAS, NAME) -ENTRY(NAME, 1) - mux1 r16=in0,@rev - ;; - extr.u r8=r16,32,32 - br.ret.sptk.few rp -END(NAME) diff --git a/lib/libc/ia64/net/htonl.S b/lib/libc/ia64/net/htonl.S deleted file mode 100644 index 05c906c..0000000 --- a/lib/libc/ia64/net/htonl.S +++ /dev/null @@ -1,36 +0,0 @@ -/* $NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#define ALIAS htonl -#define NAME __htonl - -#include "byte_swap_4.S" diff --git a/lib/libc/ia64/net/htons.S b/lib/libc/ia64/net/htons.S deleted file mode 100644 index 4bd3a8b..0000000 --- a/lib/libc/ia64/net/htons.S +++ /dev/null @@ -1,36 +0,0 @@ -/* $NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#define ALIAS htons -#define NAME __htons - -#include "byte_swap_2.S" diff --git a/lib/libc/ia64/net/ntohl.S b/lib/libc/ia64/net/ntohl.S deleted file mode 100644 index a08a162..0000000 --- a/lib/libc/ia64/net/ntohl.S +++ /dev/null @@ -1,36 +0,0 @@ -/* $NetBSD: ntohl.S,v 1.1 1996/04/17 22:36:57 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#define ALIAS ntohl -#define NAME __ntohl - -#include "byte_swap_4.S" diff --git a/lib/libc/ia64/net/ntohs.S b/lib/libc/ia64/net/ntohs.S deleted file mode 100644 index 79e6e0c..0000000 --- a/lib/libc/ia64/net/ntohs.S +++ /dev/null @@ -1,36 +0,0 @@ -/* $NetBSD: ntohs.S,v 1.1 1996/04/17 22:37:02 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#define ALIAS ntohs -#define NAME __ntohs - -#include "byte_swap_2.S" diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index eadbb08..0df7433 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -2,16 +2,16 @@ # $FreeBSD$ # machine-independent net sources -.PATH: ${.CURDIR}/${MACHINE_ARCH}/net ${.CURDIR}/net +.PATH: ${.CURDIR}/net -SRCS+= addr2ascii.c ascii2addr.c base64.c ether_addr.c eui64.c \ +SRCS+= addr2ascii.c ascii2addr.c base64.c ether_addr.c eui64.c \ gai_strerror.c getaddrinfo.c \ gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \ getifaddrs.c getifmaddrs.c getnameinfo.c \ getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \ getproto.c getprotoent.c getprotoname.c getservent.c \ if_indextoname.c if_nameindex.c if_nametoindex.c \ - ip6opt.c linkaddr.c map_v4v6.c name6.c \ + ip6opt.c linkaddr.c map_v4v6.c name6.c ntoh.c \ nsdispatch.c nslexer.c nsparser.c nss_compat.c \ rcmd.c rcmdsh.c recv.c rthdr.c send.c sockatmark.c vars.c @@ -42,11 +42,6 @@ nslexer.c: nslexer.l nsparser.h ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \ sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET} -# machine-dependent net sources -.if exists(${.CURDIR}/${MACHINE_ARCH}/net/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/net/Makefile.inc" -.endif - MAN+= addr2ascii.3 byteorder.3 ethers.3 eui64.3 \ getaddrinfo.3 gai_strerror.3 gethostbyname.3 \ getifaddrs.3 getifmaddrs.3 getipnodebyname.3 \ diff --git a/lib/libc/arm/net/htons.S b/lib/libc/net/ntoh.c index c211792..738d8c7 100644 --- a/lib/libc/arm/net/htons.S +++ b/lib/libc/net/ntoh.c @@ -1,12 +1,7 @@ -/* $NetBSD: byte_swap_2.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */ - /*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. + * Copyright (c) 2006 Olivier Houchard * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,13 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -36,14 +24,35 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -_ENTRY(_C_LABEL(htons)) -_PROF_PROLOGUE -#ifndef __ARMEB__ - and r1, r0, #0xff - mov r0, r0, lsr #8 - orr r0, r0, r1, lsl #8 -#endif - mov pc, lr +#include <sys/endian.h> + +uint32_t +htonl(uint32_t hl) +{ + + return (__htonl(hl)); +} + +uint16_t +htons(uint16_t hs) +{ + + return (__htons(hs)); +} + +uint32_t +ntohl(uint32_t nl) +{ + + return (__ntohl(nl)); +} + +uint16_t +ntohs(uint16_t ns) +{ + + return (__ntohs(ns)); +} diff --git a/lib/libc/powerpc/net/Makefile.inc b/lib/libc/powerpc/net/Makefile.inc deleted file mode 100644 index 96e559b..0000000 --- a/lib/libc/powerpc/net/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD$ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/powerpc/net/htonl.S b/lib/libc/powerpc/net/htonl.S deleted file mode 100644 index b5a6d12..0000000 --- a/lib/libc/powerpc/net/htonl.S +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2002 David O'Brien - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htonl(hostorder) */ - - .weak CNAME(htonl) - .set CNAME(htonl),CNAME(__htonl) -ENTRY(__htonl) - blr diff --git a/lib/libc/powerpc/net/htons.S b/lib/libc/powerpc/net/htons.S deleted file mode 100644 index 6aba09c..0000000 --- a/lib/libc/powerpc/net/htons.S +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2002 David O'Brien - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* netorder = htons(hostorder) */ - - .weak CNAME(htons) - .set CNAME(htons),CNAME(__htons) -ENTRY(__htons) - blr diff --git a/lib/libc/powerpc/net/ntohl.S b/lib/libc/powerpc/net/ntohl.S deleted file mode 100644 index f85d59e..0000000 --- a/lib/libc/powerpc/net/ntohl.S +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2002 David O'Brien - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohl(netorder) */ - - .weak CNAME(ntohl) - .set CNAME(ntohl),CNAME(__ntohl) -ENTRY(__ntohl) - blr diff --git a/lib/libc/powerpc/net/ntohs.S b/lib/libc/powerpc/net/ntohs.S deleted file mode 100644 index 21d41da..0000000 --- a/lib/libc/powerpc/net/ntohs.S +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2002 David O'Brien - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohs(netorder) */ - -#include <machine/asm.h> - - .weak CNAME(ntohs) - .set CNAME(ntohs),CNAME(__ntohs) -ENTRY(__ntohs) - blr diff --git a/lib/libc/sparc64/net/Makefile.inc b/lib/libc/sparc64/net/Makefile.inc deleted file mode 100644 index b717813..0000000 --- a/lib/libc/sparc64/net/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/sparc64/net/htonl.S b/lib/libc/sparc64/net/htonl.S deleted file mode 100644 index 2ba02c4..0000000 --- a/lib/libc/sparc64/net/htonl.S +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htonl.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93" -#if 0 - RCSID("$NetBSD: htonl.S,v 1.1 1998/09/11 04:56:30 eeh Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ -__FBSDID("$FreeBSD$"); - -/* netorder = htonl(hostorder) */ - .weak CNAME(htonl) - .set CNAME(htonl),CNAME(__htonl) -ENTRY(__htonl) - retl - srl %o0, 0, %o0 /* zero extend */ -END(__htonl) diff --git a/lib/libc/sparc64/net/htons.S b/lib/libc/sparc64/net/htons.S deleted file mode 100644 index 16035e0..0000000 --- a/lib/libc/sparc64/net/htons.S +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htons.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93" -#if 0 - RCSID("$NetBSD: htons.S,v 1.1 1998/09/11 04:56:30 eeh Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ -__FBSDID("$FreeBSD$"); - -/* netorder = htons(hostorder) */ - .weak CNAME(htons) - .set CNAME(htons),CNAME(__htons) -ENTRY(__htons) - sethi %hi(0xffff0000), %o1 - signx %o1, %o1 - retl - andn %o0, %o1, %o0 -END(__htons) diff --git a/lib/libc/sparc64/net/ntohl.S b/lib/libc/sparc64/net/ntohl.S deleted file mode 100644 index 4333f23..0000000 --- a/lib/libc/sparc64/net/ntohl.S +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohl.s,v 1.1 92/06/25 12:47:06 torek Exp - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohl.s 8.1 (Berkeley) 6/4/93" -#if 0 - RCSID("$NetBSD: ntohl.S,v 1.1 1998/09/11 04:56:31 eeh Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohl(netorder) */ - .weak CNAME(ntohl) - .set CNAME(ntohl),CNAME(__ntohl) -ENTRY(__ntohl) - retl - srl %o0, 0, %o0 /* zero extend */ -END(__ntohl) diff --git a/lib/libc/sparc64/net/ntohs.S b/lib/libc/sparc64/net/ntohs.S deleted file mode 100644 index 03a09b5..0000000 --- a/lib/libc/sparc64/net/ntohs.S +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohs.s,v 1.1 92/06/25 12:47:07 torek Exp - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)ntohs.s 8.1 (Berkeley) 6/4/93" -#if 0 - RCSID("$NetBSD: ntohs.S,v 1.1 1998/09/11 04:56:31 eeh Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ -__FBSDID("$FreeBSD$"); - -/* hostorder = ntohs(netorder) */ - .weak CNAME(ntohs) - .set CNAME(ntohs),CNAME(__ntohs) -ENTRY(__ntohs) - sethi %hi(0xffff0000), %o1 - signx %o1, %o1 - retl - andn %o0, %o1, %o0 -END(__ntohs) diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index c6cee39..a06cf51 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -37,13 +37,9 @@ SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ # private (pruned) versions of libc string functions SRCS+= strcasecmp.c -# byte order functions from libc -.if ${MACHINE_ARCH} != "amd64" -.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net -.else -.PATH: ${.CURDIR}/../libc/i386/net -.endif -SRCS+= htons.S ntohs.S htonl.S ntohl.S +.PATH: ${.CURDIR}/../libc/net + +SRCS+= ntoh.c # string functions from libc .PATH: ${.CURDIR}/../libc/string |