On 05/01/2024 19:05, Aditya Deshpande wrote:
+#define __ASM_RO_UPTR_CONSTR "C" #define __ASM_RW_UPTR_CONSTR "+C" #else #define __ASM_SWITCH_TO_C64 #define __ASM_SWITCH_TO_A64 +#define __ASM_RO_UPTR_CONSTR "r" #define __ASM_RW_UPTR_CONSTR "+r" #endif #define __ASM_UACCESS_BEFORE __ASM_SWITCH_TO_C64 #define __ASM_UACCESS_AFTER __ASM_SWITCH_TO_A64 +#define __ASM_KACCESS_BEFORE +#define __ASM_KACCESS_AFTER +#define __ASM_RO_KPTR_CONSTR "r" +#define __ASM_RW_KPTR_CONSTR "+r"
Would it be better to move the assembly constraint macros to a more generic header? We'll need macros like these anytime we handle assembly for purecap vs aarch64; for example we defined similar macros for the vDSO fallback syscalls. Having them in a distinct header would cut down on duplication.
If the long-term plan was to keep using "C" then yes I'd agree. However Clang now supports "r" for capabilities too [1], and the latest release has this improvement, so we can soon move to removing these macros altogether. We'll still need the A64/C64 ones, but those shouldn't be needed beyond uaccess.
Kevin
[1] https://git.morello-project.org/morello/llvm-project/-/merge_requests/258