Re: [PATCH v2 2/9] ARM: assembler: introduce bl_r and bl_m macros
From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-10-05 12:12:44
On Tue, Oct 5, 2021 at 9:15 AM Ard Biesheuvel [off-list ref] wrote:
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>
+ .macro bl_r, dst:req, c + .if __LINUX_ARM_ARCH__ < 6 + mov\c lr, pc + mov\c pc, \dst + .else + blx\c \dst + .endif + .endm
I suppose we could use blx on ARMv5 as well, but it wouldn't make a difference
there, right?
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel