[Bug 38780] AArch64 platforms: register X18 (TEB) must remain reserved for Wine to run 64-bit ARM Windows applications ( Distro aarch64 toolchains need '-ffixed-x18' default, loader/libc/userland )

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Nov 12 15:34:32 CST 2018


https://bugs.winehq.org/show_bug.cgi?id=38780

--- Comment #17 from Martin Storsjö <martin at martin.st> ---
(In reply to Zebediah Figura from comment #16)
> (In reply to Martin Storsjö from comment #15)
> > I guess it could be doable to back it up in the prologue and restore it the
> > epilogue in functions on non-windows that are marked with the ms_abi
> > attribute. For restoring/setting it up around WINAPI callbacks, where would
> > the compiler get the value to set into x18?
> 
> From the spilled location?

When the windows code calls a wine function (compiled for linux, with ms_abi
attribute on the entry point), this prologue can indeed treat it as a
callee-save register and back it up.

This function then goes on to call other host environment functions (glibc etc)
which clobber x18, and a number of other wine-internal functions, which don't
have the ms_abi attribute set, which don't back up and restore x18 (which could
be garbage at this point anyway). Deep in this call stack, some function calls
a WINAPI callback. How does that nested context find what the real x18 value
was on entry into the wine code, several stack frames deeper?

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list