lkml.org 
[lkml]   [1999]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux/IA-64 byte order
   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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [from the cache]
©2003-2011 Jasper Spaans