[PATCH v2 2/9] ARM: assembler: introduce bl_r and bl_m macros
Arnd Bergmann
arnd at arndb.de
Tue Oct 5 05:10:19 PDT 2021
On Tue, Oct 5, 2021 at 9:15 AM Ard Biesheuvel <ardb at kernel.org> 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 at kernel.org>
Reviewed-by: Arnd Bergmann <arnd at 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
More information about the linux-arm-kernel
mailing list