3 ms·
> I'd be surprised if a ton of applications in the wild aren't violating Apple's register x18 requirement macOS outright zeroed x18 on each context switch for
by my123 5y ago
> I'd be surprised if a ton of applications in the wild aren't violating Apple's register x18 requirement
macOS outright zeroed x18 on each context switch for a bit, and it's zeroed on each context switch as part of the Meltdown mitigation for older SoCs in iOS.
On Windows, x18 is used as the thread environment block pointer.
On Android, x18 is not accessible to third party apps as part of the ABI. It is reserved for the shadow call stack.
(tldr: on most OSes x18 is explicitly reserved by the platform)
- dzaima 5y agosee my edit - the ARMv8 ABI even specifies x18 to be possibly platform-defined. So those aren't unreasonable, and I'm probably overestimating how many things misuse it. But apparently that list includes GNU MP[0], and it's easy to view this problem as stemming from there not being a concrete ABI. (though, restricting the use of x18 on platforms that don't need it reserved could be pretty wasteful) [0]: https://gmplib.org/repo/gmp/rev/5f32dbc41afc https://gmplib.org/repo/gmp/rev/5f32dbc41afc