fix(cpufeat): improve xpaci wrapper
Older toolchains seem to have trouble parsing a directive on the same
line as an instruction, so they choke on the separating semicolon:
/tmp/ccBwXW8I.s:93: Error: unknown architecture `armv8.3-a;'
Put the .arch directive on a line of its own, so that the assembler can
digest it.
Drop the comment on the way: xpaci is a FEAT_PAUTH instruction not
encoded in the hint space, so *every* toolchain needs to be allowed
ARMv8.3 level instructions, not just older ones.
Also we do not need to force x0 as the register, the compiler will pick
it automatically, so drop the register variable.
Change-Id: I0d4d74bcdac04aa86c565ad0455f62adf81febb5
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
diff --git a/include/arch/aarch64/arch_helpers.h b/include/arch/aarch64/arch_helpers.h
index 9419583..01b7335 100644
--- a/include/arch/aarch64/arch_helpers.h
+++ b/include/arch/aarch64/arch_helpers.h
@@ -240,12 +240,11 @@
******************************************************************************/
static inline u_register_t xpaci(u_register_t arg)
{
- register u_register_t x0 asm("x0") = arg;
+ __asm__ (".arch armv8.3-a\n"
+ "xpaci %0\n"
+ : "+r" (arg));
- /* `xpaci x0` for compatibility with older compiler and/or older -march */
- __asm__ (".arch armv8.3-a; xpaci %0\n" : "+r" (x0));
-
- return x0;
+ return arg;
}
void flush_dcache_range(uintptr_t addr, size_t size);