On Thu, 7 Mar 2002, Ralf Baechle wrote:
> The MIPS ABI only covers big endian systems - every "real" MIPS UNIX
> system is big endian. Everything else is a GNU extension. There is
> hardly any reason to choose a particular byteorder as usually endianess
> swapping takes so little CPU time that it isn't even meassurable but so
> I'm told there are exceptions.
To me, byte swapping on MIPS actually seems rather expensive. The code
for htonl (linux/byteorder/swab.h) ends up something like this:
This may not be an issue if it is only needed a few times per packet, but
my system must byte-swap (LE to BE) about 500KB (or 4mb) per second.
Actually, I save a bit of work by combining the byte swapping with the
memory move, just after copy_from_user, and looks something like:
unsigned char a, b, c, d, *mptr;
a = mptr;
b = mptr;
c = mptr;
d = mptr;
mptr = d;
mptr = c;
mptr = b;
mptr = a;
This method works, but it is still 8 instructions per word. Yuck! Does
anyone know of a _decent_ way to handle this on MIPS?
All the best,