mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 2/5] ARM: import setjmp implementation from U-Boot
Date: Tue, 21 Jan 2020 08:46:59 +0100	[thread overview]
Message-ID: <20200121074659.edpo5mehazotx6ls@pengutronix.de> (raw)
In-Reply-To: <20200120085647.19784-2-r.czerwinski@pengutronix.de>

On Mon, Jan 20, 2020 at 09:56:45AM +0100, Rouven Czerwinski wrote:
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  arch/arm/include/asm/setjmp.h | 29 ++++++++++++++++++++++++++++
>  arch/arm/lib32/setjmp.S       | 36 +++++++++++++++++++++++++++++++++++
>  2 files changed, 65 insertions(+)
>  create mode 100644 arch/arm/include/asm/setjmp.h
>  create mode 100644 arch/arm/lib32/setjmp.S
> 
> diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
> new file mode 100644
> index 0000000000..62bac613d6
> --- /dev/null
> +++ b/arch/arm/include/asm/setjmp.h
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
> + * (C) Copyright 2016 Alexander Graf <agraf@suse.de>
> + */
> +
> +#ifndef _SETJMP_H_
> +#define _SETJMP_H_	1
> +
> +#include <asm/types.h>
> +
> +/*
> + * This really should be opaque, but the EFI implementation wrongly
> + * assumes that a 'struct jmp_buf_data' is defined.
> + */
> +struct jmp_buf_data {
> +#if defined(__aarch64__)
> +	u64  regs[13];
> +#else
> +	u32  regs[10];  /* r4-r9, sl, fp, sp, lr */
> +#endif
> +};
> +
> +typedef struct jmp_buf_data jmp_buf[1];
> +
> +int setjmp(jmp_buf jmp);
> +void longjmp(jmp_buf jmp, int ret);
> +
> +#endif /* _SETJMP_H_ */
> diff --git a/arch/arm/lib32/setjmp.S b/arch/arm/lib32/setjmp.S

While you are at it please add arch/arm/lib64/setjmp.S as well. You can
copy it directly from U-Boot.

This patch should also add setjmp.o to the Makefiles. In patch 3/5
you add:

pbl-$(CONFIG_PBL_OPTEE)        += setjmp.o

How does a potential second user select setjmp? You can instead either
add a CONFIG_SETJMP symbol which you select from CONFIG_PBL_OPTEE or
just do a obj-pbl-y += setjmp.o. In this case it's fine to not add a new
symbol for it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-01-21  7:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20  8:56 [PATCH v2 1/5] optee: move optee_verify_header() to common Rouven Czerwinski
2020-01-20  8:56 ` [PATCH v2 2/5] ARM: import setjmp implementation from U-Boot Rouven Czerwinski
2020-01-21  7:46   ` Sascha Hauer [this message]
2020-01-20  8:56 ` [PATCH v2 3/5] ARM: add optee early loading function Rouven Czerwinski
2020-01-20  8:56 ` [PATCH v2 4/5] ARM: mach-imx: test PL310 write access Rouven Czerwinski
2020-01-21  7:37   ` Sascha Hauer
2020-01-20  8:56 ` [PATCH v2 5/5] user: add documentation for OP-TEE loading Rouven Czerwinski

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=20200121074659.edpo5mehazotx6ls@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=r.czerwinski@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox