From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment
Date: Sat, 14 Sep 2013 09:18:02 +0200 [thread overview]
Message-ID: <52340DAA.1070807@weilnetz.de> (raw)
In-Reply-To: <CAFEAcA-5Op_G+f39_+0rzanB1sDQB8OtwjNQbYX6E83+Aq9Y8A@mail.gmail.com>
Am 12.09.2013 22:35, schrieb Peter Maydell:
> On 12 September 2013 20:45, Stefan Weil <sw@weilnetz.de> wrote:
>> +else
>> +
>> + # Cross compilation, so we cannot launch a program. Require configure argument.
>> + error_exit "Unknown function argument alignment" \
>> + "The TCG interpreter must know the alignment of function arguments." \
>> + "Configure cannot determine the alignment because this is a cross build," \
>> + "so please add --enable-call-align-args or --disable-call-align-args."
>> +
>> +fi
> No new configure tests which can't cope with cross compilation,
> please.
I generally agree (and still hope that the endianness patch will be
committed soon). For the calling convention test I don't see an
alternative, see my remarks below.
>
>> +#if defined(CONFIG_CALL_ALIGN_ARGS)
>> +# define TCG_TARGET_CALL_ALIGN_ARGS 1
>> +#endif
> You're not a native assembly backend, you can't rely on this
> to be sufficient. Use libffi or call the target function with
> the exact correct prototype.
>
> -- PMM
I had a look on libffi now and don't see how it could solve my problem.
As far as I could see, libffi must be ported to new architectures, so
its use would restrict the portability of TCI.
Calling the helper function with the correct prototype seems to be the
solution with the best portability and would also make TCI a little bit
faster.
There is a drawback of that solution: it needs modifications in the TCG
opcode generation which would no longer be identical to all other TCG
targets (or I'd have to search the given address of the helper function
in a lookup table which would cost too much time).
Therefore I'd like to implement that solution as a configure time option:
either TCI calls helpers with the correct prototype, or it uses the macros
TCG_TARGET_CALL_ALIGN_ARGS and TCG_TARGET_EXTEND_ARGS.
This means that we still need some way to determine the call alignment
and whether 32 bit arguments are extended to 64 bit values on 64 bit hosts
for the solution with unmodified TCG opcode generator. Any test for this
requires native compilation. Of course I can add the known values for
the common architectures, so these architectures would not require the
test. Then only cross compilation for exotic architectures would require
an explicit configure option which defines argument alignment and
extension.
Regards
Stefan
next prev parent reply other threads:[~2013-09-14 7:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 19:45 [Qemu-devel] [PATCH] tci: Detect function argument alignment Stefan Weil
2013-09-12 20:29 ` Richard Henderson
2013-09-12 20:40 ` Stefan Weil
2013-09-12 21:04 ` Richard Henderson
2013-09-12 20:35 ` Peter Maydell
2013-09-14 7:18 ` Stefan Weil [this message]
2013-09-14 9:51 ` Peter Maydell
2013-09-14 20:34 ` Richard Henderson
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=52340DAA.1070807@weilnetz.de \
--to=sw@weilnetz.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).