From 3eb3bd34b198e4f3d3e2620da2bfc61d3c25bdc7 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 23 Apr 2023 13:01:20 -0700 Subject: [PATCH] incorporate feedback on ARM64 assembly article --- content/blog/writing-portable-arm64-assembly.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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