diff options
author | tmm <tmm@FreeBSD.org> | 2002-02-27 17:16:18 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2002-02-27 17:16:18 +0000 |
commit | 3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a (patch) | |
tree | 46353f300fd15b6b132ccde617d8726a2e38d224 /sys/libkern/ia64 | |
parent | e9d577adb2ffdd3b7300415775c1212a087ce0dc (diff) | |
download | FreeBSD-src-3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a.zip FreeBSD-src-3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a.tar.gz |
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
Diffstat (limited to 'sys/libkern/ia64')
-rw-r--r-- | sys/libkern/ia64/bswap16.S (renamed from sys/libkern/ia64/htons.S) | 11 | ||||
-rw-r--r-- | sys/libkern/ia64/bswap32.S (renamed from sys/libkern/ia64/htonl.S) | 11 | ||||
-rw-r--r-- | sys/libkern/ia64/byte_swap_2.S | 5 | ||||
-rw-r--r-- | sys/libkern/ia64/byte_swap_4.S | 5 | ||||
-rw-r--r-- | sys/libkern/ia64/ntohl.S | 34 | ||||
-rw-r--r-- | sys/libkern/ia64/ntohs.S | 34 |
6 files changed, 16 insertions, 84 deletions
diff --git a/sys/libkern/ia64/htons.S b/sys/libkern/ia64/bswap16.S index 16a83d6..746e906 100644 --- a/sys/libkern/ia64/htons.S +++ b/sys/libkern/ia64/bswap16.S @@ -1,6 +1,3 @@ -/* $FreeBSD$ */ -/* $NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd Exp $ */ - /* * Copyright (c) 1996 Carnegie-Mellon University. * All rights reserved. @@ -26,9 +23,13 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * from: NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd + * from: src/sys/libkern/ia64/htons.S,v 1.2 2002/02/18 20:35:21 + * + * $FreeBSD$ */ -#define ALIAS htons -#define NAME __htons +#define NAME __bswap16 #include <libkern/ia64/byte_swap_2.S> diff --git a/sys/libkern/ia64/htonl.S b/sys/libkern/ia64/bswap32.S index f0c89f4..d2a22b2 100644 --- a/sys/libkern/ia64/htonl.S +++ b/sys/libkern/ia64/bswap32.S @@ -1,6 +1,3 @@ -/* $FreeBSD$ */ -/* $NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd Exp $ */ - /* * Copyright (c) 1996 Carnegie-Mellon University. * All rights reserved. @@ -26,9 +23,13 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * from: NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd + * from: src/sys/libkern/ia64/htonl.S,v 1.2 2002/02/18 20:35:21 + * + * $FreeBSD$ */ -#define ALIAS htonl -#define NAME __htonl +#define NAME __bswap32 #include <libkern/ia64/byte_swap_4.S> diff --git a/sys/libkern/ia64/byte_swap_2.S b/sys/libkern/ia64/byte_swap_2.S index 19d0eef..b9ea7d2 100644 --- a/sys/libkern/ia64/byte_swap_2.S +++ b/sys/libkern/ia64/byte_swap_2.S @@ -30,8 +30,8 @@ #include <machine/asm.h> -#if !defined(ALIAS) || !defined(NAME) -#error ALIAS or NAME not defined +#ifndef NAME +#error NAME not defined #endif /* @@ -39,7 +39,6 @@ * * Argument is an unsigned 2-byte integer (u_int16_t). */ -WEAK_ALIAS(ALIAS, NAME) ENTRY(NAME, 1) mux1 r16=in0,@rev ;; diff --git a/sys/libkern/ia64/byte_swap_4.S b/sys/libkern/ia64/byte_swap_4.S index 71019ba..facce77 100644 --- a/sys/libkern/ia64/byte_swap_4.S +++ b/sys/libkern/ia64/byte_swap_4.S @@ -30,8 +30,8 @@ #include <machine/asm.h> -#if !defined(ALIAS) || !defined(NAME) -#error ALIAS or NAME not defined +#ifndef NAME +#error NAME not defined #endif /* @@ -39,7 +39,6 @@ * * Argument is an unsigned 4-byte integer (u_int32_t). */ -WEAK_ALIAS(ALIAS, NAME) ENTRY(NAME, 1) mux1 r16=in0,@rev ;; diff --git a/sys/libkern/ia64/ntohl.S b/sys/libkern/ia64/ntohl.S deleted file mode 100644 index 2f2e7ba..0000000 --- a/sys/libkern/ia64/ntohl.S +++ /dev/null @@ -1,34 +0,0 @@ -/* $FreeBSD$ */ -/* $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 ALIAS ntohl -#define NAME __ntohl - -#include <libkern/ia64/byte_swap_4.S> diff --git a/sys/libkern/ia64/ntohs.S b/sys/libkern/ia64/ntohs.S deleted file mode 100644 index 051f103..0000000 --- a/sys/libkern/ia64/ntohs.S +++ /dev/null @@ -1,34 +0,0 @@ -/* $FreeBSD$ */ -/* $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 ALIAS ntohs -#define NAME __ntohs - -#include <libkern/ia64/byte_swap_2.S> |