qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment
Date: Sat, 14 Sep 2013 09:18:02 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

Am 12.09.2013 22:35, schrieb Peter Maydell:
> On 12 September 2013 20:45, Stefan Weil <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]