[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
Tue Nov 13 15:29:32 CST 2018


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

--- Comment #22 from Martin Storsjö <martin at martin.st> ---
(In reply to Zebediah Figura from comment #16)
> Essentially, to treat it as a caller-saved register (even though it's not
> being used as a scratch register).

After poking around a bit in the AArch64 target in llvm, this doesn't seem all
that easy, necessarily, but I might of course be wrong.

To achieve what's wanted here (having x18 correct when calling callback
functions from anywhere within wine code), the compiler would need to back up
x18 before every single function call (which might be to a glibc function which
could clobber x18), and restore it immediately afterwards on return. That's not
how normal caller saved registers are used though; the register allocator
(primarily) moves anything that needs to be stored across function calls into a
callee saved register instead and uses it from there; it doesn't move it back
into the caller save register unless it needs to.

So it's of course not impossible, but so far I didn't find any existing
mechanism where I could just add x18 to the list and have it all work out
automatically.

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