summaryrefslogtreecommitdiffstats
path: root/sys/libkern/ia64/bswap32.S
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-02-27 17:16:18 +0000
committertmm <tmm@FreeBSD.org>2002-02-27 17:16:18 +0000
commit3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a (patch)
tree46353f300fd15b6b132ccde617d8726a2e38d224 /sys/libkern/ia64/bswap32.S
parente9d577adb2ffdd3b7300415775c1212a087ce0dc (diff)
downloadFreeBSD-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/bswap32.S')
-rw-r--r--sys/libkern/ia64/bswap32.S35
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/libkern/ia64/bswap32.S b/sys/libkern/ia64/bswap32.S
new file mode 100644
index 0000000..d2a22b2
--- /dev/null
+++ b/sys/libkern/ia64/bswap32.S
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *
+ * 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 NAME __bswap32
+
+#include <libkern/ia64/byte_swap_4.S>
OpenPOWER on IntegriCloud