Here is ARM's explanation in the AAPCS64 (ARM 64-bit Architecture Procedure Call Standard):
> Software developers creating platform-independent code are advised to avoid using r18 if at all possible. Most compilers provide a mechanism to prevent specific registers from being used for general allocation; portable hand-coded assembler should avoid it entirely. It should not be assumed that treating the register as callee-saved will be sufficient to satisfy the requirements of the platform. Virtualization code must, of course, treat the register as they would any other resource provided to the virtual machine.
> On Darwin, x18 is used [...] on hardware where Meltdown mitigations are needed. [...] On M1, it's currently usable by applications
I’m confused. x18 is an ARM register, but I thought Meltdown only affected x86 chips. Were iOS devices vulnerable to Meltdown too? Or did you mean not x18 specifically but some equivalent OS-reserved x86 register?
> Software developers creating platform-independent code are advised to avoid using r18 if at all possible. Most compilers provide a mechanism to prevent specific registers from being used for general allocation; portable hand-coded assembler should avoid it entirely. It should not be assumed that treating the register as callee-saved will be sufficient to satisfy the requirements of the platform. Virtualization code must, of course, treat the register as they would any other resource provided to the virtual machine.
From: https://github.com/ARM-software/abi-aa/blob/2bcab1e3b22d5517...