diff mbox series

[5/9] riscv: simplify stack pointer setup in head.S

Message ID 20190411115623.5749-6-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/9] riscv: use asm-generic/extable.h | expand

Commit Message

Christoph Hellwig April 11, 2019, 11:56 a.m. UTC
We don't need THREAD_SIZE in asm-offsets.c as we can just calculate
the value of init_thread_union + THREAD_SIZE using cpp, just like
we do a few lines above.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/kernel/asm-offsets.c | 3 ---
 arch/riscv/kernel/head.S        | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)

Comments

Atish Patra April 11, 2019, 8:54 p.m. UTC | #1
On 4/11/19 4:57 AM, Christoph Hellwig wrote:
> We don't need THREAD_SIZE in asm-offsets.c as we can just calculate
> the value of init_thread_union + THREAD_SIZE using cpp, just like
> we do a few lines above.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   arch/riscv/kernel/asm-offsets.c | 3 ---
>   arch/riscv/kernel/head.S        | 5 +----
>   2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c
> index dac98348c6a3..578bb5efc085 100644
> --- a/arch/riscv/kernel/asm-offsets.c
> +++ b/arch/riscv/kernel/asm-offsets.c
> @@ -312,9 +312,6 @@ void asm_offsets(void)
>   		- offsetof(struct task_struct, thread.fstate.f[0])
>   	);
>   
> -	/* The assembler needs access to THREAD_SIZE as well. */
> -	DEFINE(ASM_THREAD_SIZE, THREAD_SIZE);
> -
>   	/*
>   	 * We allocate a pt_regs on the stack when entering the kernel.  This
>   	 * ensures the alignment is sane.
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index fe884cd69abd..9344d9ceda24 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -68,10 +68,7 @@ clear_bss_done:
>   	/* Restore C environment */
>   	la tp, init_task
>   	sw zero, TASK_TI_CPU(tp)
> -
> -	la sp, init_thread_union
> -	li a0, ASM_THREAD_SIZE
> -	add sp, sp, a0
> +	la sp, init_thread_union + THREAD_SIZE
>   
>   	/* Start the kernel */
>   	mv a0, s0
> 
Reviewed-by: Atish Patra <atish.patra@wdc.com>

Regards,
Atish
diff mbox series

Patch

diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c
index dac98348c6a3..578bb5efc085 100644
--- a/arch/riscv/kernel/asm-offsets.c
+++ b/arch/riscv/kernel/asm-offsets.c
@@ -312,9 +312,6 @@  void asm_offsets(void)
 		- offsetof(struct task_struct, thread.fstate.f[0])
 	);
 
-	/* The assembler needs access to THREAD_SIZE as well. */
-	DEFINE(ASM_THREAD_SIZE, THREAD_SIZE);
-
 	/*
 	 * We allocate a pt_regs on the stack when entering the kernel.  This
 	 * ensures the alignment is sane.
diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index fe884cd69abd..9344d9ceda24 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -68,10 +68,7 @@  clear_bss_done:
 	/* Restore C environment */
 	la tp, init_task
 	sw zero, TASK_TI_CPU(tp)
-
-	la sp, init_thread_union
-	li a0, ASM_THREAD_SIZE
-	add sp, sp, a0
+	la sp, init_thread_union + THREAD_SIZE
 
 	/* Start the kernel */
 	mv a0, s0