Handling of the x18 register in Wine on AArch64

Martin Storsjö martin at martin.st
Wed May 22 13:57:28 CDT 2019


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)?

> 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? (Currently most of wine internals have unix calling 
conventions, and only the publicly visible entry points have ms_abi, 
right?)

// Martin


More information about the wine-devel mailing list