From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tq6ik-0003e6-AA for qemu-devel@nongnu.org; Tue, 01 Jan 2013 13:37:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tq6ij-0000hX-6q for qemu-devel@nongnu.org; Tue, 01 Jan 2013 13:37:50 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:61801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tq6ii-0000hS-TV for qemu-devel@nongnu.org; Tue, 01 Jan 2013 13:37:49 -0500 Message-ID: <1357065466.3025.14.camel@Quad> From: Laurent Vivier Date: Tue, 01 Jan 2013 19:37:46 +0100 In-Reply-To: <1357061254.3025.9.camel@Quad> References: <1356982680-12436-1-git-send-email-laurent@vivier.eu> <1356982680-12436-3-git-send-email-laurent@vivier.eu> <1356992395.3199.25.camel@Quad> <1357061254.3025.9.camel@Quad> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Riku Voipio , qemu-devel@nongnu.org Le mardi 01 janvier 2013 =C3=A0 18:27 +0100, Laurent Vivier a =C3=A9crit : > Le mardi 01 janvier 2013 =C3=A0 15:03 +0000, Peter Maydell a =C3=A9crit : > > On 31 December 2012 22:19, Laurent Vivier wrote: > > > works... sometime. In fact, work if target endianess is network endia= ness. > > > > > > Correct me if I'm wrong. > > > > > > target host > > > little endian / big endian > > > > > > memory 00 00 00 03 > >=20 > > 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". >=20 > 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 =3D sizeof(abi_ulong); =20 switch(num) { case SOCKOP_socket: { abi_ulong domain, type, protocol; =20 if (get_user_ual(domain, vptr) || get_user_ual(type, vptr + n) || get_user_ual(protocol, vptr + 2 * n)) return -TARGET_EFAULT; =20 ret =3D 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 --=20 "Just play. Have fun. Enjoy the game." - Michael Jordan