[PATCH v2 1/2] riscv: simplify longjmp
Leo Liang
ycliang at andestech.com
Tue Mar 23 12:54:14 CET 2021
Hi Heinrich,
On Mon, Mar 22, 2021 at 12:02:48PM +0100, Heinrich Schuchardt wrote:
> The value returned by setjmp must be nonzero. If zero is passed as
> parameter it must be replaced by 1.
>
> This patch reduces the code size a bit.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Sean Anderson <seanga2 at gmail.com>
I think Sean is refering to the "Reviewed-by" tag is missing.
Otherwise than that, LGTM.
> ---
> v2:
> fix typo in title
> ---
> arch/riscv/lib/setjmp.S | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S
> index 72bc9241f6..99d6195827 100644
> --- a/arch/riscv/lib/setjmp.S
> +++ b/arch/riscv/lib/setjmp.S
> @@ -54,12 +54,8 @@ ENTRY(longjmp)
> LOAD_IDX(sp, 13)
>
> /* Move the return value in place, but return 1 if passed 0. */
> - beq a1, zero, longjmp_1
> - mv a0, a1
> - ret
> -
> - longjmp_1:
> - li a0, 1
> + seqz a0, a1
> + add a0, a0, a1
> ret
> ENDPROC(longjmp)
> .popsection
> --
> 2.30.2
>
Reviewed-by: Leo Yu-Chi Liang <ycliang at andestech.com>
Best regards,
Leo
More information about the U-Boot
mailing list