Re: [PATCH v2 2/9] ARM: assembler: introduce bl_r and bl_m macros
From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-10-05 12:17:17
On Tue, 5 Oct 2021 at 14:10, Arnd Bergmann [off-list ref] wrote:
On Tue, Oct 5, 2021 at 9:15 AM Ard Biesheuvel [off-list ref] wrote:quoted
Add some macros that abstract the difference between the ways indirect calls are performed on older and newer ARM architecture revisions. The main difference is to prefer blx instructions over explicit LR assignments when possible, as these tend to confuse the prediction logic in out-of-order cores when speculating across a function return. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>Reviewed-by: Arnd Bergmann <arnd@arndb.de>quoted
+ .macro bl_r, dst:req, c + .if __LINUX_ARM_ARCH__ < 6 + mov\c lr, pc + mov\c pc, \dst + .else + blx\c \dst + .endif + .endmI suppose we could use blx on ARMv5 as well, but it wouldn't make a difference there, right?
No, it wouldn't. And the only reason for using '6' here is so that we use blx in code that may run on both v6 and v7. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel