Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures merge the bnswap() assembly versions with nto* and hton* using symbols aliasing. Use symbol renaming for the bswap function in this case to avoid namespace pollution. Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian machines, common code for inline macros go in machine/byte_swap.h Sync libkern with libc. Adjust #include in kernel sources for machine/bswap.h.
This commit is contained in:
parent
97cc62d6c3
commit
dc306354b0
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.79 1999/01/15 12:48:41 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.80 1999/01/15 13:31:15 bouyer Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 2/3/94
|
||||
#
|
||||
# All library objects contain sccsid strings by default; they may be
|
||||
|
@ -59,7 +59,7 @@ NLS= C.msg Pig.msg de.msg es.msg fi.msg fr.msg nl.msg no.msg sv.msg
|
|||
|
||||
LIBKERN= ${.CURDIR}/../../sys/lib/libkern
|
||||
|
||||
KSRCS= bcopy.c bcmp.c bzero.c ffs.c \
|
||||
KSRCS= bcopy.c bcmp.c bswap16.c bswap32.c bswap64.c bzero.c ffs.c \
|
||||
strcat.c strchr.c strcmp.c strcpy.c strlen.c \
|
||||
strncmp.c strncpy.c strrchr.c \
|
||||
htonl.c htons.c ntohl.c ntohs.c md5c.c \
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
# $NetBSD: Makefile.inc,v 1.9 1998/08/04 01:26:20 perry Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.10 1999/01/15 13:31:15 bouyer Exp $
|
||||
|
||||
KMINCLUDES=
|
||||
KMSRCS= divrem.m4 \
|
||||
bcopy.S bzero.S ffs.S \
|
||||
memcpy.S memmove.S \
|
||||
htonl.S htons.S ntohl.S ntohs.S \
|
||||
byte_swap_2.S byte_swap_4.S
|
||||
memcpy.S memmove.S
|
||||
#KMSRCS= bcmp.S strcat.S strcmp.S strcpy.S strlen.S
|
||||
|
||||
# `source' files built from m4 source
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.4 1998/09/29 03:01:37 thorpej Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.5 1999/01/15 13:31:15 bouyer Exp $
|
||||
|
||||
SRCS+= fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
|
@ -6,3 +6,7 @@ SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
|||
SRCS+= _setjmp.S
|
||||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
SRCS+= byte_swap_2.S byte_swap_4.S bswap64.c
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $ */
|
||||
/* $NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:15 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -29,19 +29,17 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#ifndef NAME
|
||||
#define NAME byte_swap_2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.)
|
||||
*
|
||||
* Argument is an unsigned 2-byte integer (u_int16_t).
|
||||
*/
|
||||
LEAF(NAME, 1) /* a0 contains 0x0123 */
|
||||
LEAF(__bswap16, 1) /* a0 contains 0x0123 */
|
||||
XLEAF(htons, 1)
|
||||
XLEAF(ntohs, 1)
|
||||
extbl a0, 0, t0 /* t0 = 0x 23 */
|
||||
extbl a0, 1, t1 /* t1 = 0x 01 */
|
||||
sll t0, 8, t0 /* t1 = 0x23 */
|
||||
or t0, t1, v0 /* v0 = 0x2301 */
|
||||
RET
|
||||
END(NAME)
|
||||
END(__bswap16)
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $ */
|
||||
/* $NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:15 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -29,16 +29,14 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#ifndef NAME
|
||||
#define NAME byte_swap_4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.)
|
||||
*
|
||||
* Argument is an unsigned 4-byte integer (u_int32_t).
|
||||
*/
|
||||
LEAF(NAME, 1) /* a0 contains 0x01234567 */
|
||||
LEAF(__bswap32, 1) /* a0 contains 0x01234567 */
|
||||
XLEAF(htonl, 1)
|
||||
XLEAF(ntohl, 1)
|
||||
extbl a0, 0, t0 /* t0 = 0x 67 */
|
||||
extbl a0, 1, t1 /* t1 = 0x 45 */
|
||||
extbl a0, 2, t2 /* t2 = 0x 23 */
|
||||
|
@ -50,4 +48,4 @@ LEAF(NAME, 1) /* a0 contains 0x01234567 */
|
|||
or t1, t2, t1 /* t1 = 0x 4523 */
|
||||
or t1, v0, v0 /* v0 = 0x67452301 */
|
||||
RET
|
||||
END(NAME)
|
||||
END(__bswap32)
|
|
@ -1,3 +1,8 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1996/04/17 22:36:42 cgd Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1999/01/15 13:31:16 bouyer Exp $
|
||||
|
||||
SRCS+= htonl.S htons.S ntohl.S ntohs.S
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
SRCS+=
|
||||
|
||||
LSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
DPSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
|
|
|
@ -1,32 +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.
|
||||
*/
|
||||
|
||||
#define NAME htonl
|
||||
|
||||
#include "byte_swap_4.S"
|
|
@ -1,32 +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.
|
||||
*/
|
||||
|
||||
#define NAME htons
|
||||
|
||||
#include "byte_swap_2.S"
|
|
@ -1,32 +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.
|
||||
*/
|
||||
|
||||
#define NAME ntohl
|
||||
|
||||
#include "byte_swap_4.S"
|
|
@ -1,32 +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.
|
||||
*/
|
||||
|
||||
#define NAME ntohs
|
||||
|
||||
#include "byte_swap_2.S"
|
|
@ -1,7 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.5 1997/10/22 23:21:46 lukem Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.6 1999/01/15 13:31:16 bouyer Exp $
|
||||
|
||||
KMINCLUDES=
|
||||
KMSRCS=
|
||||
CPPFLAGS+=-DSOFTFLOAT
|
||||
|
||||
.include <fplib/Makefile.inc>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.5 1998/09/29 20:23:25 thorpej Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.6 1999/01/15 13:31:16 bouyer Exp $
|
||||
|
||||
SRCS+= alloca.S divsi3.S \
|
||||
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
|
||||
fabs.c flt_rounds.c fpgetround.c fpsetround.c \
|
||||
fpgetmask.S fpsetmask.S fpgetsticky.S fpsetsticky.S \
|
||||
infinity.c isinf.c frexp.c ldexp.c modf.c
|
||||
|
@ -8,3 +8,6 @@ SRCS+= alloca.S divsi3.S \
|
|||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htons.S,v 1.1 1997/10/12 21:24:05 mark Exp $ */
|
||||
/* $NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:16 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,11 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(htons)
|
||||
_BEGIN_ENTRY;
|
||||
_ENTRY(_C_FUNC(__bswap16));
|
||||
_ENTRY(_C_FUNC(ntohs));
|
||||
_ENTRY(_C_FUNC(htons));
|
||||
_END_ENTRY
|
||||
mov r1, r0, lsl #8
|
||||
mov r0, r0, lsr #8
|
||||
bic r0, r0, #0xFF00
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htonl.S,v 1.1 1997/10/12 21:24:04 mark Exp $ */
|
||||
/* $NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:17 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,11 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(htonl)
|
||||
_BEGIN_ENTRY;
|
||||
_ENTRY(_C_FUNC(__bswap32));
|
||||
_ENTRY(_C_FUNC(ntohl));
|
||||
_ENTRY(_C_FUNC(htonl));
|
||||
_END_ENTRY
|
||||
eor r1, r0, r0, ror #16
|
||||
bic r1, r1, #0x00FF0000
|
||||
mov r0, r0, ror #8
|
|
@ -1,3 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1997/10/06 00:03:13 mark Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1999/01/15 13:31:17 bouyer Exp $
|
||||
|
||||
SRCS+= htonl.S htons.S ntohl.S ntohs.S
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
SRCS+=
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/* $NetBSD: htonl.S,v 1.2 1997/10/09 07:30:36 jtc 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>
|
||||
|
||||
ENTRY(htonl)
|
||||
eor r1, r0, r0, ror #16
|
||||
bic r1, r1, #0x00FF0000
|
||||
mov r0, r0, ror #8
|
||||
eor r0, r0, r1, lsr #8
|
||||
mov pc, lr
|
|
@ -1,46 +0,0 @@
|
|||
/* $NetBSD: htons.S,v 1.2 1997/10/09 07:30:37 jtc 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>
|
||||
|
||||
ENTRY(htons)
|
||||
mov r1, r0, lsl #8
|
||||
mov r0, r0, lsr #8
|
||||
bic r0, r0, #0xFF00
|
||||
orr r0, r0, r1
|
||||
mov pc, lr
|
|
@ -1,7 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.11 1998/08/04 01:35:57 perry Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.12 1999/01/15 13:31:17 bouyer Exp $
|
||||
|
||||
KMINCLUDES= arch/i386/SYS.h
|
||||
KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S rindex.S \
|
||||
memchr.S memcmp.S memcpy.S memmove.S memset.S \
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S \
|
||||
htonl.S htons.S ntohl.S ntohs.S
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile.inc,v 1.6 1998/09/26 23:46:01 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.7 1999/01/15 13:31:17 bouyer Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
SRCS+= alloca.S fabs.S modf.S \
|
||||
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S modf.S \
|
||||
flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S \
|
||||
fpsetmask.S fpsetround.S fpsetsticky.S
|
||||
|
||||
|
@ -10,16 +10,18 @@ SRCS+= _setjmp.S
|
|||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
|
||||
# objects built from C sources
|
||||
SRCS+= frexp.c infinity.c isinf.c ldexp.c
|
||||
SRCS+= bswap64.c frexp.c infinity.c isinf.c ldexp.c
|
||||
|
||||
# "internal" objects (don't provide part of the user-visible API)
|
||||
SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S
|
||||
|
||||
LSRCS+= Lint__setjmp.c Lint_alloca.c Lint_fabs.c Lint_modf.c \
|
||||
LSRCS+= Lint__setjmp.c Lint_alloca.c Lint_bswap16.c Lint_bswap32.c \
|
||||
Lint_fabs.c Lint_modf.c \
|
||||
Lint___setjmp14.c Lint___sigsetjmp14.c Lint_flt_rounds.c \
|
||||
Lint_fpgetmask.c Lint_fpgetround.c Lint_fpgetsticky.c \
|
||||
Lint_fpsetmask.c Lint_fpsetround.c Lint_fpsetsticky.c
|
||||
DPSRCS+= Lint__setjmp.c Lint_alloca.c Lint_fabs.c Lint_modf.c \
|
||||
DPSRCS+= Lint__setjmp.c Lint_alloca.c Lint_bswap16.c Lint_bswap32.c \
|
||||
Lint_fabs.c Lint_modf.c \
|
||||
Lint___setjmp14.c Lint___sigsetjmp14.c Lint_flt_rounds.c \
|
||||
Lint_fpgetmask.c Lint_fpgetround.c Lint_fpgetsticky.c \
|
||||
Lint_fpsetmask.c Lint_fpsetround.c Lint_fpsetsticky.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htons.S,v 1.5 1997/07/16 14:37:22 christos Exp $ */
|
||||
/* $NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:17 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -40,11 +40,12 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: htons.S,v 1.5 1997/07/16 14:37:22 christos Exp $")
|
||||
RCSID("$NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:17 bouyer Exp $")
|
||||
#endif
|
||||
|
||||
/* netorder = htons(hostorder) */
|
||||
ENTRY(htons)
|
||||
ENTRY(__bswap16)
|
||||
ALTENTRY(ntohs)
|
||||
ALTENTRY(htons)
|
||||
movzwl 4(%esp),%eax
|
||||
rorw $8,%ax
|
||||
ret
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htonl.S,v 1.5 1997/07/16 14:37:21 christos Exp $ */
|
||||
/* $NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:17 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -40,11 +40,12 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: htonl.S,v 1.5 1997/07/16 14:37:21 christos Exp $")
|
||||
RCSID("$NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:17 bouyer Exp $")
|
||||
#endif
|
||||
|
||||
/* netorder = htonl(hostorder) */
|
||||
ENTRY(htonl)
|
||||
ENTRY(__bswap32)
|
||||
ALTENTRY(ntohl)
|
||||
ALTENTRY(htonl)
|
||||
movl 4(%esp),%eax
|
||||
rorw $8,%ax
|
||||
roll $16,%eax
|
|
@ -1,7 +1,8 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1997/11/05 23:43:00 cgd Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1999/01/15 13:31:18 bouyer Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
SRCS+= htonl.S htons.S ntohl.S ntohs.S
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
SRCS+=
|
||||
|
||||
LSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
DPSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# $NetBSD: Makefile.inc,v 1.6 1998/08/04 01:29:48 perry Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.7 1999/01/15 13:31:18 bouyer Exp $
|
||||
|
||||
KMINCLUDES= arch/m68k/DEFS.h arch/m68k/SYS.h
|
||||
KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S rindex.S \
|
||||
memcpy.S memmove.S memset.S \
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S strncmp.S strncpy.S \
|
||||
htonl.S htons.S ntohl.S ntohs.S \
|
||||
ashldi3.S ashrdi3.S lshrdi3.S
|
||||
ashldi3.S ashrdi3.S lshrdi3.S \
|
||||
bswap16.S bswap32.S bswap64.S
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.8 1998/10/05 02:34:18 thorpej Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.9 1999/01/15 13:31:18 bouyer Exp $
|
||||
|
||||
SRCS+= alloca.S fabs.S frexp.c infinity.c isinf.c modf.S
|
||||
SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \
|
||||
|
@ -8,6 +8,7 @@ SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \
|
|||
floatsidf.S lshlsi3.S lshrsi3.S modsi3.S muldf3.S mulsf3.S mulsi3.S \
|
||||
negdf2.S negsf2.S subdf3.S subsf3.S truncdfsf2.S udivsi3.S \
|
||||
umodsi3.S umulsi3.S
|
||||
SRCS+= bswap16.S bswap32.S bswap64.S
|
||||
|
||||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
|
@ -20,3 +21,6 @@ SRCS+= ldexp.c
|
|||
.else
|
||||
SRCS+= ldexp.S
|
||||
.endif
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* $NetBSD: bswap16.S,v 1.1 1999/01/15 13:31:18 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Scott Reynolds. 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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>
|
||||
|
||||
ENTRY(bswap16)
|
||||
movl sp@(4),d0
|
||||
rolw #8,d0
|
||||
rts
|
|
@ -0,0 +1,36 @@
|
|||
/* $NetBSD: bswap32.S,v 1.1 1999/01/15 13:31:18 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Scott Reynolds. 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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>
|
||||
|
||||
ENTRY(bswap32)
|
||||
movl sp@(4),d0
|
||||
rolw #8,d0
|
||||
swap d0
|
||||
rolw #8,d0
|
||||
rts
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: bswap64.S,v 1.1 1999/01/15 13:31:18 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Scott Reynolds. 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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>
|
||||
|
||||
ENTRY(bswap64)
|
||||
movl sp@(4),d1
|
||||
movl sp@(8),d0
|
||||
rolw #8,d1
|
||||
swap d1
|
||||
rolw #8,d1
|
||||
rolw #8,d0
|
||||
swap d0
|
||||
rolw #8,d0
|
||||
rts
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.6 1998/09/27 22:59:39 jonathan Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.7 1999/01/15 13:31:19 bouyer Exp $
|
||||
|
||||
SRCS+= fabs.S frexp.c infinity.c isinf.S ldexp.S modf.S
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
|
@ -7,6 +7,10 @@ SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
|||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
SRCS+= byte_swap_2.S byte_swap_2.4 bswap64.c
|
||||
|
||||
# mips abi builtin extensions (used by GCC for lexical-closure trampoline)
|
||||
SRCS+= cacheflush.c
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htons.S,v 1.5 1996/09/17 01:32:29 jonathan Exp $ */
|
||||
/* $NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -40,31 +40,29 @@
|
|||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
ASMSTR("from: @(#)htons.s 8.1 (Berkeley) 6/4/93")
|
||||
ASMSTR("$NetBSD: htons.S,v 1.5 1996/09/17 01:32:29 jonathan Exp $")
|
||||
ASMSTR("$NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $")
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef ABICALLS
|
||||
.abicalls
|
||||
#endif
|
||||
|
||||
/*
|
||||
* netorder = htons(hostorder)
|
||||
* hostorder = ntohs(netorder)
|
||||
*/
|
||||
NLEAF(htons)
|
||||
ALEAF(ntohs)
|
||||
NLEAF(__bswap16)
|
||||
#ifdef MIPSEL
|
||||
ALEAF(htons)
|
||||
ALEAF(ntohs)
|
||||
#endif
|
||||
srl v0, a0, 8
|
||||
and v0, v0, 0xff
|
||||
sll v1, a0, 8
|
||||
and v1, v1, 0xff00
|
||||
or v0, v0, v1
|
||||
#else
|
||||
j ra
|
||||
END(__bswap16)
|
||||
#ifdef MIPSEB
|
||||
NLEAF(htons)
|
||||
ALEAF(ntohs)
|
||||
move v0, a0
|
||||
#else
|
||||
ERROR
|
||||
#endif
|
||||
#endif
|
||||
j ra
|
||||
END(htons)
|
||||
#endif
|
|
@ -0,0 +1,71 @@
|
|||
/* $NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <mips/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
ASMSTR("from: @(#)htonl.s 8.1 (Berkeley) 6/4/93")
|
||||
ASMSTR("$NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $")
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#ifdef ABICALLS
|
||||
.abicalls
|
||||
#endif
|
||||
|
||||
ALEAF(__bswap32) # a0 = 0x11223344, return 0x44332211
|
||||
#ifdef MIPSEL
|
||||
NLEAF(htonl) # a0 = 0x11223344, return 0x44332211
|
||||
ALEAF(ntohl)
|
||||
#endif
|
||||
srl v1, a0, 24 # v1 = 0x00000011
|
||||
sll v0, a0, 24 # v0 = 0x44000000
|
||||
or v0, v0, v1
|
||||
and v1, a0, 0xff00
|
||||
sll v1, v1, 8 # v1 = 0x00330000
|
||||
or v0, v0, v1
|
||||
srl v1, a0, 8
|
||||
and v1, v1, 0xff00 # v1 = 0x00002200
|
||||
or v0, v0, v1
|
||||
j ra
|
||||
END(__bswap32)
|
||||
#ifdef MIPSEB
|
||||
NLEAF(htonl) # a0 = 0x11223344, return 0x44332211
|
||||
ALEAF(ntohl)
|
||||
move v0, a0
|
||||
j ra
|
||||
END(htonl)
|
||||
#endif
|
|
@ -1,3 +1,8 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 1995/02/25 14:59:01 cgd Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.2 1999/01/15 13:31:19 bouyer Exp $
|
||||
|
||||
SRCS+= htonl.S htons.S
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
SRCS+=
|
||||
|
||||
LSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
DPSRCS+= Lint_htonl.c Lint_htons.c Lint_ntohl.c Lint_ntohs.c
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# $NetBSD: Makefile.inc,v 1.12 1998/08/04 03:35:32 perry Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.13 1999/01/15 13:31:19 bouyer Exp $
|
||||
|
||||
KMINCLUDES= arch/ns32k/SYS.h
|
||||
KMSRCS= bcmp.S bcopy.S bzero.S ffs.S \
|
||||
memchr.S memcmp.S memcpy.S memmove.S memset.S \
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S strncmp.S strncpy.S \
|
||||
htonl.S htons.S ntohl.S ntohs.S
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S strncmp.S strncpy.S
|
||||
|
||||
SRCS+= ${ASSRCS}
|
||||
LSRCS+= ${ASSRCS:S/S$/c/g:C/^./Lint_&/g}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htons.S,v 1.6 1998/04/03 22:59:29 matthias Exp $ */
|
||||
/* $NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -36,10 +36,12 @@
|
|||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: htons.S,v 1.6 1998/04/03 22:59:29 matthias Exp $")
|
||||
RCSID("$NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $")
|
||||
#endif
|
||||
|
||||
KENTRY(htons, 4)
|
||||
KENTRY(__bswap16, 4)
|
||||
movzwd S_ARG0,r0
|
||||
rotw 8,r0
|
||||
ret ARGS
|
||||
ALTENTRY(ntohs, __bswap16)
|
||||
ALTENTRY(htons, __bswap16)
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htonl.S,v 1.4 1998/04/21 19:57:39 matthias Exp $ */
|
||||
/* $NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -36,12 +36,14 @@
|
|||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: htonl.S,v 1.4 1998/04/21 19:57:39 matthias Exp $")
|
||||
RCSID("$NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:19 bouyer Exp $")
|
||||
#endif
|
||||
|
||||
KENTRY(htonl, 4)
|
||||
KENTRY(__bswap32, 4)
|
||||
movd S_ARG0,r0
|
||||
rotw 8,r0
|
||||
rotd 16,r0
|
||||
rotw 8,r0
|
||||
ret ARGS
|
||||
ALTENTRY(ntohl, __bswap32)
|
||||
ALTENTRY(htonl, __bswap32)
|
|
@ -1,5 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1997/12/07 00:19:30 matthias Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1999/01/15 13:31:19 bouyer Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
ASSRCS+=htonl.S htons.S ntohl.S ntohs.S
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
ASSRCS+=
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/* $NetBSD: htons.S,v 1.3 1998/04/03 22:58:08 matthias Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1992 Carnegie Mellon University
|
||||
* Copyright (c) 1992 Helsinki University of Technology
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
|
||||
* OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
|
||||
* HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
* 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: htons.S,v 1.3 1998/04/03 22:58:08 matthias Exp $")
|
||||
#endif
|
||||
|
||||
KENTRY(htons, 4)
|
||||
movzwd S_ARG0,r0
|
||||
rotw 8,r0
|
||||
ret ARGS
|
|
@ -1,47 +0,0 @@
|
|||
/* $NetBSD: ntohl.S,v 1.3 1998/04/03 22:58:08 matthias Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1992 Carnegie Mellon University
|
||||
* Copyright (c) 1992 Helsinki University of Technology
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
|
||||
* OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
|
||||
* HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
* 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: ntohl.S,v 1.3 1998/04/03 22:58:08 matthias Exp $")
|
||||
#endif
|
||||
|
||||
KENTRY(ntohl, 4)
|
||||
movd S_ARG0,r0
|
||||
rotw 8,r0
|
||||
rotd 16,r0
|
||||
rotw 8,r0
|
||||
ret ARGS
|
|
@ -1,5 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.3 1998/11/26 07:50:56 sakamoto Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.4 1999/01/15 13:31:20 bouyer Exp $
|
||||
|
||||
SRCS+= _setjmp.S setjmp.S sigsetjmp.S __setjmp14.S __sigsetjmp14.S
|
||||
SRCS+= isinf.c isnan.c ldexp.c fabs.S flt_rounds.c infinity.c
|
||||
SRCS+= bswap16.c bswap32.c bswap64.c
|
||||
SRCS+= frexp.c modf.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.4 1998/09/29 05:55:48 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.5 1999/01/15 13:31:20 bouyer Exp $
|
||||
|
||||
SRCS+= fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
|
@ -9,3 +9,4 @@ SRCS+= _setjmp.S
|
|||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
|
||||
SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S
|
||||
SRCS+= bswap16.c bswap32.c bswap64.c
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1998/10/08 02:27:58 eeh Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1999/01/15 13:31:20 bouyer Exp $
|
||||
|
||||
SRCS+= fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
fpsetround.c fpsetsticky.c
|
||||
|
||||
SRCS+= bswap16.c bswap32.c bswap64.c
|
||||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# $NetBSD: Makefile.inc,v 1.3 1998/10/10 00:08:50 matt Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.4 1999/01/15 13:31:20 bouyer Exp $
|
||||
|
||||
SRCS+= __setjmp14.S __sigsetjmp14.S _setjmp.S fabs.S frexp.c infinity.c \
|
||||
isinf.c ldexp.S modf.S setjmp.S udiv.S urem.S alloca.S sigsetjmp.S
|
||||
SRCS+= _setjmp.S byte_swap_2.S byte_swap_4.S bswap64.S fabs.S frexp.c \
|
||||
infinity.c isinf.c ldexp.S modf.S setjmp.S udiv.S urem.S alloca.S \
|
||||
sigsetjmp.S
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* Written by Anders Magnusson. Public Domain */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
.asciz "$NetBSD: bswap64.S,v 1.1 1999/01/15 13:31:20 bouyer Exp $"
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(bswap64, 0)
|
||||
movq 4(ap),r3
|
||||
rotl $-8,r3,r1
|
||||
insv r1,$16,$8,r1
|
||||
rotl $8,r3,r2
|
||||
movb r2,r1
|
||||
rotl $-8,r4,r0
|
||||
insv r0,$16,$8,r0
|
||||
rotl $8,r4,r2
|
||||
movb r2,r0
|
||||
ret
|
|
@ -33,14 +33,14 @@
|
|||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/* .asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93" */
|
||||
.asciz "$NetBSD: htons.S,v 1.1 1995/04/17 12:23:51 ragge Exp $"
|
||||
.asciz "$NetBSD: byte_swap_2.S,v 1.1 1999/01/15 13:31:21 bouyer Exp $"
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* hostorder = htons(netorder) */
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(htons, 0)
|
||||
ALTENTRY(ntohs)
|
||||
ALTENTRY(htons)
|
||||
ENTRY(__bswap16, 0)
|
||||
rotl $8,4(ap),r0
|
||||
movb 5(ap),r0
|
||||
movzwl r0,r0
|
|
@ -33,14 +33,14 @@
|
|||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/* .asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93" */
|
||||
.asciz "$NetBSD: htonl.S,v 1.1 1995/04/17 12:23:50 ragge Exp $"
|
||||
.asciz "$NetBSD: byte_swap_4.S,v 1.1 1999/01/15 13:31:21 bouyer Exp $"
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* netorder = htonl(hostorder) */
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(htonl, 0)
|
||||
ALTENTRY(ntohs)
|
||||
ALTENTRY(htons)
|
||||
ENTRY(__bswap32, 0)
|
||||
rotl $-8,4(ap),r0
|
||||
insv r0,$16,$8,r0
|
||||
movb 7(ap),r0
|
|
@ -1,3 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 1995/04/17 12:23:49 ragge Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.2 1999/01/15 13:31:21 bouyer Exp $
|
||||
|
||||
SRCS+= htonl.S htons.S ntohl.S ntohs.S
|
||||
# ntoh* and htn* are in ../gen/byte_swap_*
|
||||
SRCS+=
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. 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. 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 8.1 (Berkeley) 6/4/93" */
|
||||
.asciz "$NetBSD: ntohl.S,v 1.1 1995/04/17 12:23:52 ragge Exp $"
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* hostorder = ntohl(netorder) */
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(ntohl, 0)
|
||||
rotl $-8,4(ap),r0
|
||||
insv r0,$16,$8,r0
|
||||
movb 7(ap),r0
|
||||
ret
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. 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. 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 8.1 (Berkeley) 6/4/93" */
|
||||
.asciz "$NetBSD: ntohs.S,v 1.1 1995/04/17 12:23:53 ragge Exp $"
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* hostorder = ntohs(netorder) */
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(ntohs, 0)
|
||||
rotl $8,4(ap),r0
|
||||
movb 5(ap),r0
|
||||
movzwl r0,r0
|
||||
ret
|
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: */
|
||||
/* Written by Manuel Bouyer. Public Domain */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*ARGSUSED*/
|
||||
u_int16_t
|
||||
bswap16(b16)
|
||||
u_int16_t b16;
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: */
|
||||
/* Written by Manuel Bouyer. Public Domain */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*ARGSUSED*/
|
||||
u_int32_t
|
||||
bswap32(b32)
|
||||
u_int32_t b32;
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: */
|
||||
/* Written by Manuel Bouyer. Public Domain */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*ARGSUSED*/
|
||||
u_int64_t
|
||||
bswap64(b64)
|
||||
u_int64_t b64;
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.94 1998/11/30 20:41:21 thorpej Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.95 1999/01/15 13:31:22 bouyer Exp $
|
||||
# from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
|
||||
|
||||
# gen sources
|
||||
|
@ -31,12 +31,12 @@ SRCS+= _err.c _errx.c _sys_errlist.c _sys_nerr.c _sys_siglist.c \
|
|||
|
||||
# machine-dependent gen sources
|
||||
# m-d Makefile.inc must include sources for:
|
||||
# _setjmp() fabs() frexp() infinity isinf() ldexp() modf()
|
||||
# setjmp() sigsetjmp()
|
||||
# _setjmp() bswap16() bswap32() bswap64() fabs() frexp() infinity
|
||||
# isinf() ldexp() modf() setjmp() sigsetjmp()
|
||||
|
||||
.include "${.CURDIR}/arch/${MACHINE_ARCH}/gen/Makefile.inc"
|
||||
|
||||
MAN+= alarm.3 basename.3 clock.3 confstr.3 ctermid.3 ctype.3 \
|
||||
MAN+= alarm.3 basename.3 bswap.3 clock.3 confstr.3 ctermid.3 ctype.3 \
|
||||
daemon.3 devname.3 directory.3 dirname.3 err.3 exec.3 \
|
||||
fnmatch.3 frexp.3 ftok.3 fts.3 getbsize.3 getcap.3 \
|
||||
getcwd.3 getdomainname.3 getdiskbyname.3 getfsent.3 \
|
||||
|
@ -53,6 +53,9 @@ MAN+= alarm.3 basename.3 clock.3 confstr.3 ctermid.3 ctype.3 \
|
|||
timezone.3 toascii.3 tolower.3 toupper.3 ttyname.3 \
|
||||
ualarm.3 uname.3 unvis.3 usleep.3 utime.3 valloc.3 vis.3
|
||||
|
||||
MLINKS+=bswap.3 bswap16.3
|
||||
MLINKS+=bswap.3 bswap32.3
|
||||
MLINKS+=bswap.3 bswap64.3
|
||||
MLINKS+=directory.3 closedir.3 directory.3 dirfd.3 directory.3 opendir.3 \
|
||||
directory.3 readdir.3 directory.3 rewinddir.3 directory.3 seekdir.3 \
|
||||
directory.3 telldir.3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: bswap.3,v 1.2 1998/05/05 00:43:16 enami Exp $
|
||||
.\" $NetBSD: bswap.3,v 1.1 1999/01/15 13:31:22 bouyer Exp $
|
||||
.\"
|
||||
.\"
|
||||
.\" Copyright (c) 1998 Manuel Bouyer.
|
||||
|
@ -41,10 +41,10 @@
|
|||
.Nm bswap64
|
||||
.Nd byte-order swapping functions
|
||||
.Sh LIBRARY
|
||||
.Lb libutil
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <machine/endian.h>
|
||||
.Fd #include <machine/bswap.h>
|
||||
.Ft u_int16_t
|
||||
.Fn bswap16 "u_int16_t"
|
||||
.Ft u_int32_t
|
|
@ -0,0 +1,23 @@
|
|||
/* $NetBSD: bswap16.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Manuel Bouyer <bouyer@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: bswap16.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/bswap.h>
|
||||
|
||||
#undef bswap16
|
||||
|
||||
u_int16_t
|
||||
bswap16(x)
|
||||
u_int16_t x;
|
||||
{
|
||||
return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/* $NetBSD: bswap32.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Manuel Bouyer <bouyer@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: bswap32.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/bswap.h>
|
||||
|
||||
#undef bswap32
|
||||
|
||||
u_int32_t
|
||||
bswap32(x)
|
||||
u_int32_t x;
|
||||
{
|
||||
return ((x << 24) & 0xff000000 ) |
|
||||
((x << 8) & 0x00ff0000 ) |
|
||||
((x >> 8) & 0x0000ff00 ) |
|
||||
((x >> 24) & 0x000000ff );
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* $NetBSD: bswap64.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Manuel Bouyer <bouyer@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: bswap64.c,v 1.1 1999/01/15 13:31:22 bouyer Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/bswap.h>
|
||||
|
||||
#undef bswap64
|
||||
|
||||
u_int64_t
|
||||
bswap64(x)
|
||||
u_int64_t x;
|
||||
{
|
||||
u_int32_t *p = (u_int32_t*)&x;
|
||||
u_int32_t t;
|
||||
t = bswap32(p[0]);
|
||||
p[0] = bswap32(p[1]);
|
||||
p[1] = t;
|
||||
return x;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: shlib_version,v 1.61 1998/11/30 20:46:55 thorpej Exp $
|
||||
# $NetBSD: shlib_version,v 1.62 1999/01/15 13:31:15 bouyer Exp $
|
||||
#
|
||||
major=12
|
||||
minor=34
|
||||
minor=35
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.20 1998/10/14 21:13:05 kleink Exp $
|
||||
# $NetBSD: Makefile,v 1.21 1999/01/15 13:31:22 bouyer Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||
|
||||
LIB= util
|
||||
CPPFLAGS+=-DLIBC_SCCS
|
||||
SRCS= fparseln.c getmaxpartitions.c getrawpartition.c login.c login_tty.c \
|
||||
logout.c logwtmp.c opendisk.c passwd.c pw_scan.c pidlock.c pty.c \
|
||||
ttyaction.c ttymsg.c bswap.c
|
||||
ttyaction.c ttymsg.c
|
||||
|
||||
MAN= fparseln.3 getmaxpartitions.3 getrawpartition.3 login.3 opendisk.3 \
|
||||
openpty.3 pidlock.3 pw_init.3 pw_lock.3 ttyaction.3 ttymsg.3 bswap.3
|
||||
openpty.3 pidlock.3 pw_init.3 pw_lock.3 ttyaction.3 ttymsg.3
|
||||
|
||||
.PATH: ${.CURDIR}/../libc/gen
|
||||
|
||||
|
@ -25,8 +25,5 @@ MLINKS+=pw_lock.3 pw_mkdb.3
|
|||
MLINKS+=pw_lock.3 pw_abort.3
|
||||
MLINKS+=pidlock.3 ttylock.3
|
||||
MLINKS+=pidlock.3 ttyunlock.3
|
||||
MLINKS+=bswap.3 bswap16.3
|
||||
MLINKS+=bswap.3 bswap32.3
|
||||
MLINKS+=bswap.3 bswap64.3
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/* $NetBSD: bswap.c,v 1.2 1998/12/09 14:35:02 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Manuel Bouyer <bouyer@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: bswap.c,v 1.2 1998/12/09 14:35:02 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef bswap64
|
||||
|
||||
#ifndef bswap16
|
||||
u_int16_t
|
||||
bswap16(x)
|
||||
u_int16_t x;
|
||||
{
|
||||
return (((u_int32_t)x << 8) & 0xff00) | (((u_int32_t)x >> 8) & 0x00ff);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef bswap32
|
||||
u_int32_t
|
||||
bswap32(x)
|
||||
u_int32_t x;
|
||||
{
|
||||
return ((x << 24) & 0xff000000 ) |
|
||||
((x << 8) & 0x00ff0000 ) |
|
||||
((x >> 8) & 0x0000ff00 ) |
|
||||
((x >> 24) & 0x000000ff );
|
||||
}
|
||||
#endif
|
||||
|
||||
u_int64_t
|
||||
bswap64(x)
|
||||
u_int64_t x;
|
||||
{
|
||||
u_int32_t *p = (u_int32_t*)(void *)&x;
|
||||
u_int32_t t;
|
||||
t = bswap32(p[0]);
|
||||
p[0] = bswap32(p[1]);
|
||||
p[1] = t;
|
||||
return x;
|
||||
}
|
|
@ -1,4 +1,2 @@
|
|||
# $NetBSD: shlib_version,v 1.16 1998/06/27 05:08:57 thorpej Exp $
|
||||
#
|
||||
major=4
|
||||
minor=4
|
||||
major=5
|
||||
minor=0
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# $NetBSD: Makefile,v 1.1 1998/06/12 23:22:32 cgd Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1999/01/15 13:31:22 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/alpha/include
|
||||
INCSDIR= /usr/include/alpha
|
||||
|
||||
INCS= alpha_cpu.h ansi.h aout_machdep.h asm.h autoconf.h bus.h cdefs.h \
|
||||
cfbreg.h conf.h cpu.h cpuconf.h db_machdep.h disklabel.h \
|
||||
INCS= alpha_cpu.h ansi.h aout_machdep.h asm.h autoconf.h bswap.h bus.h \
|
||||
cdefs.h cfbreg.h conf.h cpu.h cpuconf.h db_machdep.h disklabel.h \
|
||||
ecoff_machdep.h elf_machdep.h endian.h fbio.h float.h frame.h ieee.h \
|
||||
ieeefp.h intr.h intrcnt.h kbio.h kcore.h limits.h pal.h param.h pcb.h \
|
||||
pmap.h proc.h profile.h prom.h psl.h pte.h ptrace.h reg.h rpb.h \
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:22 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _ALPHA_BSWAP_H_
|
||||
#define _ALPHA_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef _KERNEL
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
#else
|
||||
u_int16_t bswap16 __P((u_int16_t)) __RENAME(__bswap16);
|
||||
u_int32_t bswap32 __P((u_int32_t)) __RENAME(__bswap32);
|
||||
#endif
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _ALPHA_BSWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.6 1998/07/31 15:07:41 mycroft Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.7 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 1993
|
||||
|
@ -65,9 +65,6 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/07/12 17:53:29 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:23 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/amiga/include
|
||||
INCSDIR= /usr/include/amiga
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h bus.h cdefs.h conf.h cpu.h cpufunc.h \
|
||||
db_machdep.h disklabel.h elf_machdep.h endian.h fbio.h float.h \
|
||||
frame.h ieeefp.h intr.h kcore.h limits.h mtpr.h param.h pcb.h pmap.h \
|
||||
proc.h profile.h psl.h pte.h ptrace.h reg.h setjmp.h signal.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h bswap.h bus.h cdefs.h conf.h cpu.h \
|
||||
cpufunc.h db_machdep.h disklabel.h elf_machdep.h endian.h fbio.h \
|
||||
float.h frame.h ieeefp.h intr.h kcore.h limits.h mtpr.h param.h pcb.h \
|
||||
pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h setjmp.h signal.h \
|
||||
stdarg.h trap.h types.h varargs.h vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,12 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/09/05 03:32:57 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:23 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/arm32/include
|
||||
INCSDIR= /usr/include/arm32
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h beep.h bootconfig.h bus.h cdefs.h conf.h \
|
||||
cpu.h cpufunc.h cpus.h db_machdep.h disklabel.h disklabel_acorn.h \
|
||||
disklabel_mbr.h endian.h float.h fp.h frame.h ieee.h ieeefp.h iic.h \
|
||||
intr.h io.h ipkdb.h irqhandler.h joystick.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h beep.h bootconfig.h bswap.h bus.h cdefs.h
|
||||
conf.h cpu.h cpufunc.h cpus.h db_machdep.h disklabel.h \
|
||||
disklabel_acorn.h disklabel_mbr.h endian.h float.h fp.h frame.h \
|
||||
ieee.h ieeefp.h iic.h intr.h io.h ipkdb.h irqhandler.h joystick.h \
|
||||
katelib.h kbd.h limits.h mouse.h \
|
||||
param.h pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h \
|
||||
rtc.h setjmp.h signal.h stdarg.h sysarch.h trap.h types.h undefined.h \
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef _KERNEL
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
#else
|
||||
u_int16_t bswap16 __P((u_int16_t)) __RENAME(__bswap16);
|
||||
u_int32_t bswap32 __P((u_int32_t)) __RENAME(__bswap32);
|
||||
#endif
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACHINE_BSWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.5 1997/10/14 09:20:11 mark Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.6 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991 Regents of the University of California.
|
||||
|
@ -66,9 +66,6 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.4 1998/11/24 15:16:48 leo Exp $
|
||||
# $NetBSD: Makefile,v 1.5 1999/01/15 13:31:23 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/atari/include
|
||||
INCSDIR= /usr/include/atari
|
||||
|
||||
INCS= ahdilabel.h ansi.h aout_machdep.h asm.h cdefs.h cpu.h \
|
||||
INCS= ahdilabel.h ansi.h aout_machdep.h asm.h bswap.h cdefs.h cpu.h \
|
||||
cpufunc.h db_machdep.h disklabel.h elf_machdep.h endian.h \
|
||||
float.h frame.h intr.h ieeefp.h kcore.h limits.h \
|
||||
msioctl.h param.h pcb.h pmap.h proc.h profile.h psl.h \
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,13 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/12/04 00:17:49 sakamoto Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:23 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/bebox/include
|
||||
INCSDIR= /usr/include/bebox
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h bat.h bootinfo.h bus.h cdefs.h conf.h \
|
||||
cpu.h cpufunc.h db_machdep.h disklabel.h display.h elf_machdep.h \
|
||||
endian.h float.h fpu.h frame.h ieee.h ieeefp.h intr.h ipkdb.h kcore.h \
|
||||
kgdb.h limits.h machine_type.h mouse.h param.h pcb.h pccons.h pio.h \
|
||||
pmap.h powerpc.h proc.h profile.h psl.h pte.h ptrace.h reg.h reloc.h \
|
||||
setjmp.h signal.h spkr.h stdarg.h trap.h types.h varargs.h vmparam.h
|
||||
INCS= ansi.h aout_machdep.h asm.h bat.h bootinfo.h bswap.h bus.h cdefs.h \
|
||||
conf.h cpu.h cpufunc.h db_machdep.h disklabel.h display.h \
|
||||
elf_machdep.h endian.h float.h fpu.h frame.h ieee.h ieeefp.h intr.h \
|
||||
ipkdb.h kcore.h kgdb.h limits.h machine_type.h mouse.h param.h pcb.h \
|
||||
pccons.h pio.h pmap.h powerpc.h proc.h profile.h psl.h pte.h \
|
||||
ptrace.h reg.h reloc.h setjmp.h signal.h spkr.h stdarg.h trap.h \
|
||||
types.h varargs.h vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:23 bouyer Exp $ */
|
||||
|
||||
#include <powerpc/bswap.h>
|
|
@ -1,9 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/07/12 17:53:30 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:24 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/hp300/include
|
||||
INCSDIR= /usr/include/hp300
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bus.h cdefs.h cpu.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bswap.h bus.h cdefs.h cpu.h \
|
||||
db_machdep.h disklabel.h elf_machdep.h endian.h float.h frame.h \
|
||||
hp300spu.h hpux_machdep.h ieeefp.h intr.h kcore.h limits.h param.h \
|
||||
pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h setjmp.h \
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,12 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/10/01 18:32:33 erh Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:24 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/i386/include
|
||||
INCSDIR= /usr/include/i386
|
||||
|
||||
INCS= ansi.h aout_machdep.h apmvar.h asm.h bioscall.h bootinfo.h bus.h \
|
||||
cdefs.h conf.h cpu.h cpufunc.h cputypes.h db_machdep.h disklabel.h \
|
||||
elf_machdep.h endian.h float.h frame.h freebsd_machdep.h gdt.h \
|
||||
ibcs2_machdep.h ieeefp.h intr.h joystick.h kcore.h limits.h \
|
||||
INCS= ansi.h aout_machdep.h apmvar.h asm.h bioscall.h bootinfo.h bswap.h \
|
||||
bus.h cdefs.h conf.h cpu.h cpufunc.h cputypes.h db_machdep.h \
|
||||
disklabel.h elf_machdep.h endian.h float.h frame.h freebsd_machdep.h \
|
||||
gdt.h ibcs2_machdep.h ieeefp.h intr.h joystick.h kcore.h limits.h \
|
||||
mouse.h npx.h param.h pcb.h pccons.h pio.h pmap.h \
|
||||
pmap.new.h proc.h profile.h psl.h pte.h ptrace.h reg.h segments.h \
|
||||
setjmp.h signal.h specialreg.h spkr.h stdarg.h svr4_machdep.h \
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _I386_BSWAP_H_
|
||||
#define _I386_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef _KERNEL
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
#else
|
||||
u_int16_t bswap16 __P((u_int16_t)) __RENAME(__bswap16);
|
||||
u_int32_t bswap32 __P((u_int32_t)) __RENAME(__bswap32);
|
||||
#endif
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#include <machine/byte_swap.h>
|
||||
#define bswap16(x) __byte_swap_word(x)
|
||||
#define bswap32(x) __byte_swap_long(x)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* _I386_BSWAP_H_ */
|
|
@ -0,0 +1,128 @@
|
|||
/* $NetBSD: byte_swap.h,v 1.1 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991 Regents of the University of California.
|
||||
* 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. 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.
|
||||
*
|
||||
* @(#)endian.h 7.8 (Berkeley) 4/3/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_BYTE_SWAP_H_
|
||||
#define _I386_BYTE_SWAP_H_
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM)
|
||||
#include "opt_cputype.h"
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM) && !defined(I386_CPU)
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register in_addr_t __x = (x); \
|
||||
__asm ("bswap %1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
#else
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register in_addr_t __x = (x); \
|
||||
__asm ("rorw $8, %w1\n\trorl $16, %1\n\trorw $8, %w1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
#endif /* _KERNEL && ... */
|
||||
|
||||
#define __byte_swap_word_variable(x) __extension__ \
|
||||
({ register in_port_t __x = (x); \
|
||||
__asm ("rorw $8, %w1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define __byte_swap_long_constant(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#define __byte_swap_word_constant(x) \
|
||||
((((x) & 0xff00) >> 8) | \
|
||||
(((x) & 0x00ff) << 8))
|
||||
#define __byte_swap_long(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_long_constant(x) : __byte_swap_long_variable(x))
|
||||
#define __byte_swap_word(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_word_constant(x) : __byte_swap_word_variable(x))
|
||||
|
||||
#else /* __OPTIMIZE__ */
|
||||
|
||||
#define __byte_swap_long(x) __byte_swap_long_variable(x)
|
||||
#define __byte_swap_word(x) __byte_swap_word_variable(x)
|
||||
|
||||
#endif /* __OPTIMIZE__ */
|
||||
|
||||
#endif /* !_I386_BYTE_SWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.24 1998/12/16 11:11:02 kleink Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.25 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -102,64 +102,12 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM)
|
||||
#include "opt_cputype.h"
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM) && !defined(I386_CPU)
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register in_addr_t __x = (x); \
|
||||
__asm ("bswap %1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
#else
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register in_addr_t __x = (x); \
|
||||
__asm ("rorw $8, %w1\n\trorl $16, %1\n\trorw $8, %w1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
#endif /* _KERNEL && ... */
|
||||
|
||||
#define __byte_swap_word_variable(x) __extension__ \
|
||||
({ register in_port_t __x = (x); \
|
||||
__asm ("rorw $8, %w1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define __byte_swap_long_constant(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#define __byte_swap_word_constant(x) \
|
||||
((((x) & 0xff00) >> 8) | \
|
||||
(((x) & 0x00ff) << 8))
|
||||
#define __byte_swap_long(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_long_constant(x) : __byte_swap_long_variable(x))
|
||||
#define __byte_swap_word(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_word_constant(x) : __byte_swap_word_variable(x))
|
||||
|
||||
#else /* __OPTIMIZE__ */
|
||||
|
||||
#define __byte_swap_long(x) __byte_swap_long_variable(x)
|
||||
#define __byte_swap_word(x) __byte_swap_word_variable(x)
|
||||
|
||||
#endif /* __OPTIMIZE__ */
|
||||
#include <machine/byte_swap.h>
|
||||
|
||||
#define ntohl(x) ((in_addr_t)__byte_swap_long((in_addr_t)(x)))
|
||||
#define ntohs(x) ((in_port_t)__byte_swap_word((in_port_t)(x)))
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/07/12 17:53:30 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:24 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/m68k/include
|
||||
INCSDIR= /usr/include/m68k
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h asm_single.h cacheops.h cacheops_20.h \
|
||||
cacheops_30.h cacheops_40.h cacheops_60.h cdefs.h cpu.h db_machdep.h \
|
||||
elf_machdep.h endian.h float.h frame.h ieee.h ieeefp.h kcore.h \
|
||||
limits.h m68k.h param.h pcb.h profile.h psl.h ptrace.h reg.h setjmp.h \
|
||||
signal.h stdarg.h sysctl.h trap.h types.h varargs.h
|
||||
INCS= ansi.h aout_machdep.h asm.h asm_single.h bswap.h cacheops.h \
|
||||
cacheops_20.h cacheops_30.h cacheops_40.h cacheops_60.h cdefs.h \
|
||||
cpu.h db_machdep.h elf_machdep.h endian.h float.h frame.h ieee.h \
|
||||
ieeefp.h kcore.h limits.h m68k.h param.h pcb.h profile.h psl.h \
|
||||
ptrace.h reg.h setjmp.h signal.h stdarg.h sysctl.h trap.h types.h \
|
||||
varargs.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _M68K_BSWAP_H_
|
||||
#define _M68K_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _M68K_BSWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.12 1998/07/31 15:07:41 mycroft Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.13 1999/01/15 13:31:24 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991 Regents of the University of California.
|
||||
|
@ -65,9 +65,6 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/07/12 17:53:30 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:25 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/mac68k/include
|
||||
INCSDIR= /usr/include/mac68k
|
||||
|
||||
INCS= adbsys.h ansi.h aout_machdep.h asm.h autoconf.h bus.h cdefs.h cpu.h \
|
||||
db_machdep.h disklabel.h elf_machdep.h endian.h float.h frame.h \
|
||||
INCS= adbsys.h ansi.h aout_machdep.h asm.h autoconf.h bswap.h bus.h cdefs.h \
|
||||
cpu.h db_machdep.h disklabel.h elf_machdep.h endian.h float.h frame.h \
|
||||
grfioctl.h ieeefp.h intr.h iteioctl.h kcore.h keyboard.h limits.h \
|
||||
param.h pcb.h pio.h pmap.h proc.h profile.h psc.h psl.h pte.h ptrace.h \
|
||||
reg.h scsi_5380.h setjmp.h signal.h stdarg.h trap.h types.h varargs.h \
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:25 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,14 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/12/03 11:05:18 tsubai Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:25 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/macppc/include
|
||||
INCSDIR= /usr/include/macppc
|
||||
|
||||
INCS= adbsys.h ansi.h aout_machdep.h asm.h autoconf.h bat.h bus.h cdefs.h \
|
||||
cpu.h db_machdep.h disklabel.h elf_machdep.h endian.h float.h fpu.h \
|
||||
frame.h grfioctl.h ieee.h ieeefp.h intr.h ipkdb.h iteioctl.h kcore.h \
|
||||
keyboard.h limits.h machine_type.h param.h pcb.h pio.h pmap.h \
|
||||
powerpc.h proc.h profile.h psl.h pte.h ptrace.h reg.h reloc.h \
|
||||
setjmp.h signal.h stdarg.h trap.h types.h varargs.h \
|
||||
INCS= adbsys.h ansi.h aout_machdep.h asm.h autoconf.h bat.h bswap.h bus.h \
|
||||
cdefs.h cpu.h db_machdep.h disklabel.h elf_machdep.h endian.h \
|
||||
float.h fpu.h frame.h grfioctl.h ieee.h ieeefp.h intr.h ipkdb.h \
|
||||
iteioctl.h kcore.h keyboard.h limits.h machine_type.h param.h pcb.h \
|
||||
pio.h pmap.h powerpc.h proc.h profile.h psl.h pte.h ptrace.h reg.h \
|
||||
reloc.h setjmp.h signal.h stdarg.h trap.h types.h varargs.h \
|
||||
vmparam.h z8530var.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:25 bouyer Exp $ */
|
||||
|
||||
#include <powerpc/bswap.h>
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.2 1999/01/14 18:45:46 castor Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:25 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/mips/include
|
||||
INCSDIR= /usr/include/mips
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h bsd-aout.h cachectl.h cdefs.h conf.h \
|
||||
cpu.h cpuarch.h db_machdep.h ecoff_machdep.h elf.h elf_machdep.h \
|
||||
endian.h float.h ieeefp.h intr.h kcore.h kdbparam.h limits.h locore.h \
|
||||
mips1_pte.h mips3_pte.h mips_opcode.h mips_param.h pcb.h pmap.h \
|
||||
proc.h profile.h psl.h pte.h ptrace.h reg.h regnum.h reloc.h \
|
||||
setjmp.h signal.h stdarg.h sysarch.h trap.h types.h varargs.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h bswap.h bsd-aout.h cachectl.h cdefs.h \
|
||||
conf.h cpu.h cpuarch.h db_machdep.h ecoff_machdep.h elf.h \
|
||||
elf_machdep.h endian.h float.h ieeefp.h intr.h kcore.h kdbparam.h \
|
||||
limits.h locore.h mips1_pte.h mips3_pte.h mips_opcode.h mips_param.h \
|
||||
pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h regnum.h \
|
||||
reloc.h setjmp.h signal.h stdarg.h sysarch.h trap.h types.h varargs.h \
|
||||
vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:25 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _MIPS_BSWAP_H_
|
||||
#define _MIPS_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef _KERNEL
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
#else
|
||||
u_int16_t bswap16 __P((u_int16_t)) __RENAME(__bswap16);
|
||||
u_int32_t bswap32 __P((u_int32_t)) __RENAME(__bswap32);
|
||||
#endif
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MIPS_BSWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.14 1998/07/31 15:07:41 mycroft Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.15 1999/01/15 13:31:25 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 1993
|
||||
|
@ -93,9 +93,6 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/07/12 17:53:30 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:25 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/mvme68k/include
|
||||
INCSDIR= /usr/include/mvme68k
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h cdefs.h cpu.h db_machdep.h \
|
||||
disklabel.h elf_machdep.h endian.h float.h frame.h ieeefp.h kcore.h \
|
||||
limits.h param.h pcb.h pmap.h proc.h profile.h prom.h psl.h pte.h \
|
||||
ptrace.h reg.h setjmp.h signal.h stdarg.h trap.h types.h varargs.h \
|
||||
vmparam.h z8530var.h
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bswap.h cdefs.h cpu.h \
|
||||
db_machdep.h disklabel.h elf_machdep.h endian.h float.h frame.h \
|
||||
ieeefp.h kcore.h limits.h param.h pcb.h pmap.h proc.h profile.h \
|
||||
prom.h psl.h pte.h ptrace.h reg.h setjmp.h signal.h stdarg.h trap.h \
|
||||
types.h varargs.h vmparam.h z8530var.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:25 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,15 +1,15 @@
|
|||
# $NetBSD: Makefile,v 1.2 1999/01/15 10:57:36 castor Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:25 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/newsmips/include
|
||||
INCSDIR= /usr/include/newsmips
|
||||
|
||||
INCS= adrsmap.h ansi.h aout_machdep.h autoconf.h bsd-aout.h cdefs.h conf.h \
|
||||
cpu.h db_machdep.h disklabel.h ecoff_machdep.h elf.h elf_machdep.h \
|
||||
endian.h float.h framebuf.h ieeefp.h intr.h kcore.h kdbparam.h \
|
||||
keyboard.h limits.h locore.h machConst.h mips_opcode.h mouse.h \
|
||||
param.h pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h \
|
||||
regdef.h regnum.h reloc.h setjmp.h signal.h stdarg.h trap.h types.h \
|
||||
va-mips.h varargs.h vmparam.h z8530var.h
|
||||
INCS= adrsmap.h ansi.h aout_machdep.h autoconf.h bswap.h bsd-aout.h cdefs.h
|
||||
conf.h cpu.h db_machdep.h disklabel.h ecoff_machdep.h elf.h \
|
||||
elf_machdep.h endian.h float.h framebuf.h ieeefp.h intr.h kcore.h \
|
||||
kdbparam.h keyboard.h limits.h locore.h machConst.h mips_opcode.h \
|
||||
mouse.h param.h pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h \
|
||||
reg.h regdef.h regnum.h reloc.h setjmp.h signal.h stdarg.h trap.h \
|
||||
types.h va-mips.h varargs.h vmparam.h z8530var.h
|
||||
|
||||
DEPINCS= pubassym.h
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/* from $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
#include <mips/bswap.h>
|
|
@ -1,12 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.1 1998/07/12 18:06:15 veego Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1999/01/15 13:31:26 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/next68k/include
|
||||
INCSDIR= /usr/include/next68k
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bus.h bus_dma.h bus_space.h \
|
||||
cdefs.h cpu.h db_machdep.h disklabel.h elf_machdep.h endian.h \
|
||||
float.h frame.h ieeefp.h intr.h kcore.h limits.h param.h pcb.h \
|
||||
pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h setjmp.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bswap.h bus.h bus_dma.h \
|
||||
bus_space.h cdefs.h cpu.h db_machdep.h disklabel.h elf_machdep.h \
|
||||
endian.h float.h frame.h ieeefp.h intr.h kcore.h limits.h param.h \
|
||||
pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h setjmp.h \
|
||||
signal.h stdarg.h trap.h types.h varargs.h vmparam.h z8530var.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
#ifndef _MACHINE_BSWAP_H_
|
||||
#define _MACHINE_BSWAP_H_
|
||||
|
||||
#include <m68k/bswap.h>
|
||||
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.2 1998/12/04 00:17:49 sakamoto Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/01/15 13:31:26 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/ofppc/include
|
||||
INCSDIR= /usr/include/ofppc
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h bat.h cdefs.h cpu.h db_machdep.h \
|
||||
INCS= ansi.h aout_machdep.h asm.h bat.h bswap.h cdefs.h cpu.h db_machdep.h \
|
||||
disklabel.h elf_machdep.h endian.h float.h fpu.h frame.h ieee.h \
|
||||
ieeefp.h ipkdb.h irq.h kcore.h limits.h machine_type.h param.h pcb.h \
|
||||
pmap.h powerpc.h proc.h profile.h psl.h pte.h ptrace.h reg.h reloc.h \
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
#include <powerpc/bswap.h>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
/* Written by Manuel Bouyer. Public domain */
|
||||
|
||||
#ifndef _PC532_BSWAP_H_
|
||||
#define _PC532_BSWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef _KERNEL
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
#else
|
||||
u_int16_t bswap16 __P((u_int16_t)) __RENAME(__bswap16);
|
||||
u_int32_t bswap32 __P((u_int32_t)) __RENAME(__bswap32);
|
||||
#endif
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#include <machine/byte_swap.h>
|
||||
#define bswap16(x) __byte_swap_word(x)
|
||||
#define bswap32(x) __byte_swap_long(x)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* _PC532_BSWAP_H_ */
|
|
@ -1,12 +1,9 @@
|
|||
/* $NetBSD: ntohs.S,v 1.5 1997/07/16 14:37:23 christos Exp $ */
|
||||
/* $NetBSD: byte_swap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
/*
|
||||
* Copyright (c) 1987, 1991 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:
|
||||
|
@ -35,16 +32,49 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)ntohs.s 5.2 (Berkeley) 12/17/90
|
||||
* @(#)endian.h 7.8 (Berkeley) 4/3/91
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: ntohs.S,v 1.5 1997/07/16 14:37:23 christos Exp $")
|
||||
#endif
|
||||
#ifndef _PC532_BYTE_SWAP_H_
|
||||
#define _PC532_BYTE_SWAP_H_
|
||||
|
||||
/* hostorder = ntohs(netorder) */
|
||||
ENTRY(ntohs)
|
||||
movzwl 4(%esp),%eax
|
||||
rorw $8,%ax
|
||||
ret
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register u_int32_t __x = (x); \
|
||||
__asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
#define __byte_swap_word_variable(x) __extension__ \
|
||||
({ register u_int16_t __x = (x); \
|
||||
__asm ("rotw 8,%1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define __byte_swap_long_constant(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#define __byte_swap_word_constant(x) \
|
||||
((((x) & 0xff00) >> 8) | \
|
||||
(((x) & 0x00ff) << 8))
|
||||
#define __byte_swap_long(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_long_constant(x) : __byte_swap_long_variable(x))
|
||||
#define __byte_swap_word(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_word_constant(x) : __byte_swap_word_variable(x))
|
||||
|
||||
#else /* __OPTIMIZE__ */
|
||||
|
||||
#define __byte_swap_long(x) __byte_swap_long_variable(x)
|
||||
#define __byte_swap_word(x) __byte_swap_word_variable(x)
|
||||
|
||||
#endif /* __OPTIMIZE__ */
|
||||
|
||||
#endif /* _PC532_BYTE_SWAP_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.12 1998/12/16 11:11:02 kleink Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.13 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991 Regents of the University of California.
|
||||
|
@ -65,52 +65,12 @@ in_addr_t htonl __P((in_addr_t));
|
|||
in_port_t htons __P((in_port_t));
|
||||
in_addr_t ntohl __P((in_addr_t));
|
||||
in_port_t ntohs __P((in_port_t));
|
||||
u_int16_t bswap16 __P((u_int16_t));
|
||||
u_int32_t bswap32 __P((u_int32_t));
|
||||
u_int64_t bswap64 __P((u_int64_t));
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define __byte_swap_long_variable(x) __extension__ \
|
||||
({ register u_int32_t __x = (x); \
|
||||
__asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
#define __byte_swap_word_variable(x) __extension__ \
|
||||
({ register u_int16_t __x = (x); \
|
||||
__asm ("rotw 8,%1" \
|
||||
: "=r" (__x) \
|
||||
: "0" (__x)); \
|
||||
__x; })
|
||||
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define __byte_swap_long_constant(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#define __byte_swap_word_constant(x) \
|
||||
((((x) & 0xff00) >> 8) | \
|
||||
(((x) & 0x00ff) << 8))
|
||||
#define __byte_swap_long(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_long_constant(x) : __byte_swap_long_variable(x))
|
||||
#define __byte_swap_word(x) \
|
||||
(__builtin_constant_p((x)) ? \
|
||||
__byte_swap_word_constant(x) : __byte_swap_word_variable(x))
|
||||
|
||||
#else /* __OPTIMIZE__ */
|
||||
|
||||
#define __byte_swap_long(x) __byte_swap_long_variable(x)
|
||||
#define __byte_swap_word(x) __byte_swap_word_variable(x)
|
||||
|
||||
#endif /* __OPTIMIZE__ */
|
||||
#include <machine/byte_swap.h>
|
||||
|
||||
#define ntohl(x) __byte_swap_long(x)
|
||||
#define ntohs(x) __byte_swap_word(x)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# $NetBSD: Makefile,v 1.1 1998/06/12 23:22:43 cgd Exp $
|
||||
# $NetBSD: Makefile,v 1.2 1999/01/15 13:31:26 bouyer Exp $
|
||||
|
||||
KDIR= /sys/arch/pica/include
|
||||
INCSDIR= /usr/include/pica
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bsd-aout.h bus.h cdefs.h cpu.h \
|
||||
disklabel.h display.h ecoff_machdep.h elf.h elf_machdep.h endian.h \
|
||||
float.h ieeefp.h kbdreg.h kcore.h kdbparam.h limits.h machAsmDefs.h \
|
||||
machConst.h mips_opcode.h mouse.h param.h pcb.h pccons.h pio.h pmap.h \
|
||||
proc.h profile.h psl.h pte.h ptrace.h reg.h regdef.h regnum.h reloc.h \
|
||||
setjmp.h signal.h stdarg.h trap.h types.h varargs.h vmparam.h
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bswap.h bsd-aout.h bus.h \
|
||||
cdefs.h cpu.h disklabel.h display.h ecoff_machdep.h elf.h \
|
||||
elf_machdep.h endian.h float.h ieeefp.h kbdreg.h kcore.h kdbparam.h \
|
||||
limits.h machAsmDefs.h machConst.h mips_opcode.h mouse.h param.h \
|
||||
pcb.h pccons.h pio.h pmap.h proc.h profile.h psl.h pte.h ptrace.h \
|
||||
reg.h regdef.h regnum.h reloc.h setjmp.h signal.h stdarg.h trap.h \
|
||||
types.h varargs.h vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/* from $NetBSD: bswap.h,v 1.1 1999/01/15 13:31:26 bouyer Exp $ */
|
||||
|
||||
#include <mips/bswap.h>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue