[llvm-dev] Handling of the x18 register in Wine on AArch64
Alexandre Julliard via llvm-dev
llvm-dev at lists.llvm.org
Wed May 22 13:31:29 PDT 2019
Martin Storsjö <martin at martin.st> writes:
> On Mon, 20 May 2019, Alexandre Julliard wrote:
>
>> Martin Storsjö <martin at martin.st> writes:
>>
>>> 5) Enclose every callback call in Wine with a wrapper/thunk that sets
>>> up the register correctly. This would be a perfect solution, but is
>>> practically unfeasible. As far as I know, this is the approach that
>>> was used for Win16 back in the day, calling WOWCallback16Ex every time
>>> Wine code should call back into Win16 code. Given the size of Wine
>>> today and the number of different places where callbacks are made
>>> (where the function pointers are called without any extra wrapping),
>>> this is unfeasible (and I have a very hard time seeing such a patch
>>> accepted into Wine).
>>
>> I don't think it's feasible to do this at the Windows/Wine boundary, but
>> with the PE cross-compilation support, we could conceivably build most
>> of Wine as PE and add wrappers at the PE/Unix boundary.
>
> Hmm, that could work... Am I following things correctly that this is,
> in general, a direction that Wine is heading in (compiling more of
> Wine with a PE cross compiler, as the tests already have moved over)?
Yes, that's the goal.
>> The wrappers could then be generated, or we could use a variant of your
>> option 4) that would have the compiler save/restore x18 when calling a
>> non-ms_abi function from an ms_abi one.
>
> Hmm, only saving/restoring, when calling a non-ms_abi function from an
> ms_abi one could be a good optimization of that approach.
>
> (Currently it does have a rather significant overhead; that patch
> grows lib64/wine from 450 to 455 MB.) That would require that every
> place where a callback is called is all within ms_abi functions
> though. Is that the case currently?
That's not the case currently, but it's what a PE build would address,
since everything would automatically be ms_abi except a few designated
places where we explicitly call down to Unix libraries.
--
Alexandre Julliard
julliard at winehq.org
More information about the llvm-dev
mailing list