Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2002 01:52:07 +0100
From:      Thomas Moestl <tmoestl@gmx.net>
To:        freebsd-arch@FreeBSD.org
Subject:   adding more endian conversion and bus space functions
Message-ID:  <20020111005207.GA7246@crow.dom2ip.de>

next in thread | raw e-mail | index | archive | help
Hi,

I'd like to propose some additions to the kernel endian conversion and
bus space functions to aid the sparc64 port, taken from NetBSD:

1. htobe16(), htobe32(), htobe64(), htole16(), htole32(), htole64()
   be16toh(), be32toh(), be64toh(), le16toh(), le32toh() and le64toh(),
   to convert from the host byte order to big or little endian order
   and vice versa.
2. bswap16(), bswap32() and bswap64() to swap the endianess. The above
   functions could be implemented using these.
3. stream variants of the bus space access functions; these become
   needed in the case where a bus system uses another endianess than
   the process, as is the case with PCI on sparc64. The normal bus
   space functions will perform byte-swapping as appropriate to convert
   the data to the host byte order (supported by hardware on sparc64).
   However if 16- or 32-bit accesses are used for stream data,
   i.e. data that should not be byte-swapped, these functions need be
   used instead.
   These will simply be defined to their non-stream counterparts on
   architectures where bus and processor byte order do not differ,
   i.e. all other currently supported architectures. 

I would also like to make most of the machine/endian.h files MI, as
sys/endian.h. The only thing that the MD files would still contain are
the definintion of BYTE_ORDER and inline implementations of some
functions. sys/endian.h would implemented the interfaces listed in 1.
as well as htonl and friends for both BYTE_ORDERs.

Comments? Suggestions?

Thanks,
	- thomas

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020111005207.GA7246>