diff mbox series

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

Message ID 20200904081949.5594-3-linus.walleij@linaro.org
State New, archived
Headers show
Series RFC: ARM section mapping debug prints | expand

Commit Message

Linus Walleij Sept. 4, 2020, 8:19 a.m. UTC
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@linaro.org>
---
 arch/arm/kernel/head.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Nicolas Pitre Sept. 4, 2020, 2:53 p.m. UTC | #1
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@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
> 
>
diff mbox series

Patch

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
 ENDPROC(__create_page_tables)
 	.ltorg