[PATCH 2/3] RFC: ARM: head: Save lr in r11 while setting up page tables

Nicolas Pitre nico at fluxnic.net
Fri Sep 4 10:53:38 EDT 2020


On Fri, 4 Sep 2020, Linus Walleij wrote:

> We might need to use lr as we want to be able to call
> the debug print functions, so save lr to r11 and restore
> lr from r11 in __create_page_tables.
> 
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  arch/arm/kernel/head.S | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index 2bfdf33aa74c..8b089c4c0d17 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -171,10 +171,11 @@ ENDPROC(stext)
>   * r8 = phys_offset, r9 = cpuid, r10 = procinfo
>   *
>   * Returns:
> - *  r0, r3, r5-r7 corrupted
> + *  r0, r3, r5-r7, r11 corrupted
>   *  r4 = physical page table address
>   */
>  __create_page_tables:
> +	mov	r11, lr				@ we need to be able to call prints
>  	pgtbl	r4, r8				@ page table address
>  
>  	/*
> @@ -350,6 +351,7 @@ __create_page_tables:
>  #ifdef CONFIG_ARM_LPAE
>  	sub	r4, r4, #0x1000		@ point to the PGD table
>  #endif
> +	mov	lr, r11
>  	ret	lr

Here you could simply do "ret r11".




>  ENDPROC(__create_page_tables)
>  	.ltorg
> -- 
> 2.26.2
> 
> 



More information about the linux-arm-kernel mailing list