On 30/03/2010 04:21, Jason King wrote:
I don't know of any... they're awkward to use in most cases; coding
some higher level routines may help.

IIRC, this is *precisely* how ddi_get16 and friends work when they are used
with a handle that indicates little-endian device order.  Of course, this is
only useful in the kernel...

Even in the kernel, zfs at the very least could benefit (since it does
endian conversion as needed), though there might be other areas as
well.

For ZFS see $SRC/common/fs/zfs/dmu.c  the following routines in particular:

byteswap_uint64_array()
byteswap_uint32_array()
byteswap_uint16_array()
byteswap_uint8_array().

Note that in the implementation of those to swap the elements the corresponding BSWAP_XX() macro is used.

Those macros are defined in <sys/byteswap.h>

For x86 they use hton[s,l,ll]() which are implemented in asm.
For everything else (ie SPARC) they use & < | to do with swapping.

If there is a way to use VIS (or any other SPARC instructions for that mater) to make byteswapping faster then please implement them as sparc versions of hton[s,l,ll]() and fixup <sys/byteswap.h>. Doing it that way means that ZFS, Crypto, Networking and a whole lot of other code gets to take advantage of it.

--
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to