All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] riscv: simply longjmp
Date: Mon, 22 Mar 2021 00:56:56 -0400	[thread overview]
Message-ID: <535a1454-ff69-aa97-9e1c-3e0a4926d68a@gmail.com> (raw)
In-Reply-To: <20210321101947.54746-2-xypron.glpk@gmx.de>

On 3/21/21 6:19 AM, 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@gmx.de>
> ---
>   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: Sean Anderson <seanga2@gmail.com>

  reply	other threads:[~2021-03-22  4:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 10:19 [PATCH 0/2] riscv: simply longjmp() Heinrich Schuchardt
2021-03-21 10:19 ` [PATCH 1/2] riscv: simply longjmp Heinrich Schuchardt
2021-03-22  4:56   ` Sean Anderson [this message]
2021-03-22 10:03     ` Heinrich Schuchardt
2021-03-21 10:19 ` [PATCH 2/2] test: unit test for longjmp Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535a1454-ff69-aa97-9e1c-3e0a4926d68a@gmail.com \
    --to=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.