Le mardi 01 janvier 2013 à 18:27 +0100, Laurent Vivier a écrit : > Le mardi 01 janvier 2013 à 15:03 +0000, Peter Maydell a écrit : > > On 31 December 2012 22:19, Laurent Vivier <laur...@vivier.eu> wrote: > > > works... sometime. In fact, work if target endianess is network endianess. > > > > > > Correct me if I'm wrong. > > > > > > target host > > > little endian / big endian > > > > > > memory 00 00 00 03 > > > > Syscall arguments aren't generally passed in memory, they're > > in registers (and if they were pased in memory for some architecture > > then that arch would do a load-and-swap-from-memory in main.c). > > So the value you see in do_socket() is always "the integer passed > > as a syscall parameter, as a host-order integer". > > Yes, I missed that.
But, in fact, for socketcall(), they are read from memory : static abi_long do_socketcall(int num, abi_ulong vptr) { abi_long ret; const int n = sizeof(abi_ulong); switch(num) { case SOCKOP_socket: { abi_ulong domain, type, protocol; if (get_user_ual(domain, vptr) || get_user_ual(type, vptr + n) || get_user_ual(protocol, vptr + 2 * n)) return -TARGET_EFAULT; ret = do_socket(domain, type, protocol); } break; So, I don't know if "tswap16()" is always correct. It works for m68k-to-x86_64, but I don't understand how it can works for i386-to-i386. Your opinion ? Regards, Laurent -- "Just play. Have fun. Enjoy the game." - Michael Jordan