From: Laurent Vivier <Laurent@vivier.eu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
Date: Tue, 01 Jan 2013 19:37:46 +0100 [thread overview]
Message-ID: <1357065466.3025.14.camel@Quad> (raw)
In-Reply-To: <1357061254.3025.9.camel@Quad>
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 <Laurent@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
next prev parent reply other threads:[~2013-01-01 18:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-31 19:37 [Qemu-devel] [PATCH 0/2] linux-user: dhclient support Laurent Vivier
2012-12-31 19:37 ` [Qemu-devel] [PATCH 1/2] linux-user: Add setsockopt(SO_ATTACH_FILTER) Laurent Vivier
2012-12-31 20:56 ` Peter Maydell
2012-12-31 19:38 ` [Qemu-devel] [PATCH 2/2] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() Laurent Vivier
2012-12-31 21:32 ` Peter Maydell
2012-12-31 22:19 ` Laurent Vivier
2013-01-01 15:03 ` Peter Maydell
2013-01-01 17:27 ` Laurent Vivier
2013-01-01 18:37 ` Laurent Vivier [this message]
2013-01-01 19:45 ` Peter Maydell
2013-01-01 22:12 ` Laurent Vivier
2013-01-01 22:50 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357065466.3025.14.camel@Quad \
--to=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).