Re: Linux/IA-64 byte order

David Miller (davem@twiddle.net)
Mon, 8 Mar 1999 22:49:01 -0800


Date: Mon, 8 Mar 1999 22:41:01 -0800 (PST)
From: Linus Torvalds <torvalds@transmeta.com>

Think about "memcpy()" and structures (imagine a structure that mixes
16-bit, 32-bit and 64-bit data).

I did think about it pinhead.

64-bit LE user:

struct foo {
char a;
short b;
int c;
long d;
};
foo.a = 0xab;
foo.b = 0xbcab;
foo.c = 0xcdcdabab;
foo.d = 0xdedededeabababab;
ioctl(fd, XXX, &foo);

64-bit BE kernel:

copy_from_user(kfooptr, ufooptr, sizeof(struct foo));
if(kfooptr->a != 0xab ||
kfooptr->b != 0xbcab ||
kfooptr->c != 0xcdcdabab ||
kfooptr->d != 0xdedededeabababab)
panic();

It works, I've tried it, have you?

And guess what it even works for sysv ipc shared memory between big
endian and little endian processes.

Later,
David S. Miller
davem@redhat.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/