From 3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a Mon Sep 17 00:00:00 2001 From: tmm Date: Wed, 27 Feb 2002 17:16:18 +0000 Subject: Add the following functions/macros to support byte order conversions and device drivers for bus system with other endinesses than the CPU (using interfaces compatible to NetBSD): - bwap16() and bswap32(). These have optimized implementations on some architectures; for those that don't, there exist generic implementations. - macros to convert from a certain byte order to host byte order and vice versa, using a naming scheme like le16toh(), htole16(). These are implemented using the bswap functions. - stream bus space access functions, which do not perform a byte order conversion (while the normal access functions would if the bus endianess differs from the CPU endianess). htons(), htonl(), ntohs() and ntohl() are implemented using the new functions above for kernel usage. None of the above interfaces is currently exported to user land. Make use of the new functions in a few places where local implementations of the same functionality existed. Reviewed by: mike, bde Tested on alpha by: mike --- lib/libstand/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/libstand/Makefile') diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index 184f690..3349522 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -33,6 +33,10 @@ SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ # private (pruned) versions of libc string functions SRCS+= strcasecmp.c +# byte order functions from libc +.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net +SRCS+= htons.S ntohs.S htonl.S ntohl.S + # string functions from libc .PATH: ${.CURDIR}/../libc/string .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ @@ -50,9 +54,6 @@ SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ strspn.c strstr.c strtok.c swab.c -.PATH: ${.CURDIR}/../libc/alpha/net -SRCS+= htons.S ntohs.S htonl.S ntohl.S - SRCS+= __divqu.S __divq.S __divlu.S __divl.S SRCS+= __remqu.S __remq.S __remlu.S __reml.S @@ -100,9 +101,6 @@ SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ strspn.c strstr.c strtok.c swab.c -.PATH: ${.CURDIR}/../libc/ia64/net -SRCS+= htons.S ntohs.S htonl.S ntohl.S - .PATH: ${.CURDIR}/../libc/ia64/gen SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S -- cgit v1.1