diff --git a/content/blog/writing-portable-arm64-assembly.md b/content/blog/writing-portable-arm64-assembly.md index 6a02804..6815161 100644 --- a/content/blog/writing-portable-arm64-assembly.md +++ b/content/blog/writing-portable-arm64-assembly.md @@ -47,6 +47,14 @@ data, for example `STT_FUNC` and `STT_OBJECT`. There is no equivalence in Mach-O, and thus the `.type` directive that you would use when writing assembly for ELF targets is not supported. +### A brief note on Platform ABIs + +You will also need to be aware of minor differences between the Darwin +ABI and other platform ABIs. A notable example is that the `x18` +register is reserved by the Darwin ABI and is explicitly zeroed on +context switches in some cases. This register is also reserved on +Android, but not on GNU/Linux or Alpine. + ## Apple-specific vector mnemonics The other main thing to watch out for is Apple's custom mnemonics for @@ -82,7 +90,7 @@ The first macro allows you to deal with the underscore requirement of the Darwin ABI: ```c -#ifdef __MACH__ +#ifdef __APPLE__ # define PROC_NAME(__proc) _ ## __proc #else # define PROC_NAME(__proc) __proc