[PATCH] ARM: asm: Rewrite get_thread_info using BIC
Dmitry Osipenko
digetx at gmail.com
Tue Jul 21 09:37:09 EDT 2020
27.05.2020 15:22, Linus Walleij пишет:
> By using two BIC instructions we can replace the ARM/thumb
> split instructions with something that works on either
> and also save one instruction.
>
> Based on code from proc-macros.S and an idea from Ard
> Biesheuvel.
>
> We need to include <linux/const.h> to expand the
> THREAD_SIZE definition properly in the preprocessor.
>
> Suggested-by: Russell King <linux at armlinux.org.uk>
> Suggested-by: Ard Biesheuvel <ardb at kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> arch/arm/include/asm/assembler.h | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
> index 99929122dad7..f218e8cf7f88 100644
> --- a/arch/arm/include/asm/assembler.h
> +++ b/arch/arm/include/asm/assembler.h
> @@ -17,6 +17,7 @@
> #error "Only include this from assembly code"
> #endif
>
> +#include <linux/const.h>
> #include <asm/ptrace.h>
> #include <asm/domain.h>
> #include <asm/opcodes-virt.h>
> @@ -203,10 +204,8 @@
> * Get current thread_info.
> */
> .macro get_thread_info, rd
> - ARM( mov \rd, sp, lsr #THREAD_SIZE_ORDER + PAGE_SHIFT )
> - THUMB( mov \rd, sp )
> - THUMB( lsr \rd, \rd, #THREAD_SIZE_ORDER + PAGE_SHIFT )
> - mov \rd, \rd, lsl #THREAD_SIZE_ORDER + PAGE_SHIFT
> + bic \rd, sp, #(THREAD_SIZE - 1) & ~63
> + bic \rd, \rd, #63
> .endm
>
> /*
>
Hello, Linus!
This patch was merged into a recent linux-next, unfortunately it breaks
CONFIG_THUMB2_KERNEL=y compilation:
arch/arm/kernel/entry-common.S: Assembler messages:
arch/arm/kernel/entry-common.S:159: Error: r13 not allowed here -- `bic
tsk,sp,#(((1<<12)<<1)-1)&~63'
arch/arm/kernel/entry-common.S:246: Error: r13 not allowed here -- `bic
tsk,sp,#(((1<<12)<<1)-1)&~63'
make[2]: *** [scripts/Makefile.build:361:
arch/arm/kernel/entry-common.o] Error 1
More information about the linux-arm-kernel
mailing list