All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] common: clean up usage of structure jmp_buf_data
@ 2025-03-02 14:21 Heinrich Schuchardt
  2025-03-02 14:21 ` [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h Heinrich Schuchardt
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot,
	Heinrich Schuchardt

When implementing setjmp() we did not clearly separate the architecture
specific part from the non-specific part. The lead to code directly
accessing the architecture specific struct jmp_buf_data instead of using
jmp_buf.

With this series include setjmp.h is carved out from the architecture
specific implementations asm/setjmp.h.

All direct usages of asm/setjmp.h and struct jmp_buf_data are corrected.

Thanks to Zi for starting this clean-up.

Heinrich Schuchardt (4):
  sandbox: remove linux/types.h dependency in setjmp.h
  arm: include asm-generic/int-ll64.h in setjmp.h
  common: clean up setjmp.h
  arm: use type jmp_buf instead of struct jmp_buf_data

Yao Zi (1):
  efi_loader: Clean up usage of structure jmp_buf_data

 arch/arm/cpu/armv7/exception_level.c |  8 +++---
 arch/arm/cpu/armv8/exception_level.c |  8 +++---
 arch/arm/include/asm/setjmp.h        | 17 ++++--------
 arch/arm/mach-rockchip/bootrom.c     |  2 +-
 arch/riscv/include/asm/setjmp.h      | 15 +++--------
 arch/sandbox/cpu/cpu.c               |  2 +-
 arch/sandbox/include/asm/setjmp.h    | 18 +++----------
 arch/x86/include/asm/setjmp.h        | 11 +++-----
 include/efi_loader.h                 |  4 +--
 include/interrupt.h                  |  2 +-
 include/setjmp.h                     | 40 ++++++++++++++++++++++++++++
 lib/efi_loader/efi_boottime.c        |  9 +++----
 test/lib/longjmp.c                   |  2 +-
 13 files changed, 73 insertions(+), 65 deletions(-)
 create mode 100644 include/setjmp.h

-- 
2.48.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
@ 2025-03-02 14:21 ` Heinrich Schuchardt
  2025-03-04 13:48   ` Jerome Forissier
  2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot,
	Heinrich Schuchardt

ulong is defined in linux/types.h use unsigned long instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/sandbox/include/asm/setjmp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h
index 001c7ea322d..47dc8938cd6 100644
--- a/arch/sandbox/include/asm/setjmp.h
+++ b/arch/sandbox/include/asm/setjmp.h
@@ -19,7 +19,7 @@ struct jmp_buf_data {
 	 * We don't need to worry about 16-byte alignment, since this does not
 	 * run on Windows.
 	 */
-	ulong data[128];
+	unsigned long data[128];
 };
 
 typedef struct jmp_buf_data jmp_buf[1];
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
  2025-03-02 14:21 ` [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h Heinrich Schuchardt
@ 2025-03-02 14:21 ` Heinrich Schuchardt
  2025-03-02 16:01   ` Yao Zi
                     ` (2 more replies)
  2025-03-02 14:21 ` [PATCH 3/5] common: clean up setjmp.h Heinrich Schuchardt
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot,
	Heinrich Schuchardt

Don't assume that u32 and u64 are already defined.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/arm/include/asm/setjmp.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
index 662bec86321..9a7f5af9f8f 100644
--- a/arch/arm/include/asm/setjmp.h
+++ b/arch/arm/include/asm/setjmp.h
@@ -7,6 +7,8 @@
 #ifndef _SETJMP_H_
 #define _SETJMP_H_	1
 
+#include <asm-generic/int-ll64.h>
+
 /*
  * This really should be opaque, but the EFI implementation wrongly
  * assumes that a 'struct jmp_buf_data' is defined.
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/5] common: clean up setjmp.h
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
  2025-03-02 14:21 ` [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h Heinrich Schuchardt
  2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
@ 2025-03-02 14:21 ` Heinrich Schuchardt
  2025-03-04 13:49   ` Jerome Forissier
  2025-03-02 14:21 ` [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data Heinrich Schuchardt
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot,
	Heinrich Schuchardt

Separate setjmp.h into an architecture independent part and an architecture
specific part. This simplifies moving from using struct jmp_buf_data
directly to using type jmp_buf in our code which is the C compliant way.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/arm/cpu/armv7/exception_level.c |  2 +-
 arch/arm/cpu/armv8/exception_level.c |  2 +-
 arch/arm/include/asm/setjmp.h        | 15 +++--------
 arch/arm/mach-rockchip/bootrom.c     |  2 +-
 arch/riscv/include/asm/setjmp.h      | 15 +++--------
 arch/sandbox/cpu/cpu.c               |  2 +-
 arch/sandbox/include/asm/setjmp.h    | 16 +++--------
 arch/x86/include/asm/setjmp.h        | 11 +++-----
 include/interrupt.h                  |  2 +-
 include/setjmp.h                     | 40 ++++++++++++++++++++++++++++
 lib/efi_loader/efi_boottime.c        |  2 +-
 test/lib/longjmp.c                   |  2 +-
 12 files changed, 59 insertions(+), 52 deletions(-)
 create mode 100644 include/setjmp.h

diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
index 7baade61b07..c63b0e13666 100644
--- a/arch/arm/cpu/armv7/exception_level.c
+++ b/arch/arm/cpu/armv7/exception_level.c
@@ -11,9 +11,9 @@
 #include <bootm.h>
 #include <cpu_func.h>
 #include <log.h>
+#include <setjmp.h>
 #include <asm/armv7.h>
 #include <asm/secure.h>
-#include <asm/setjmp.h>
 
 /**
  * entry_non_secure() - entry point when switching to non-secure mode
diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
index 85c78f55789..58e816007f0 100644
--- a/arch/arm/cpu/armv8/exception_level.c
+++ b/arch/arm/cpu/armv8/exception_level.c
@@ -11,8 +11,8 @@
 #include <bootm.h>
 #include <cpu_func.h>
 #include <log.h>
+#include <setjmp.h>
 #include <asm/cache.h>
-#include <asm/setjmp.h>
 
 /**
  * entry_non_secure() - entry point when switching to non-secure mode
diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
index 9a7f5af9f8f..a9eccf7f632 100644
--- a/arch/arm/include/asm/setjmp.h
+++ b/arch/arm/include/asm/setjmp.h
@@ -4,15 +4,11 @@
  * (C) Copyright 2016 Alexander Graf <agraf@suse.de>
  */
 
-#ifndef _SETJMP_H_
-#define _SETJMP_H_	1
+#ifndef _ASM_SETJMP_H_
+#define _ASM_SETJMP_H_	1
 
 #include <asm-generic/int-ll64.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];
@@ -21,9 +17,4 @@ struct jmp_buf_data {
 #endif
 };
 
-typedef struct jmp_buf_data jmp_buf[1];
-
-int setjmp(jmp_buf jmp);
-void longjmp(jmp_buf jmp, int ret);
-
-#endif /* _SETJMP_H_ */
+#endif /* _ASM_SETJMP_H_ */
diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
index 82a0b3efef9..1db38546d55 100644
--- a/arch/arm/mach-rockchip/bootrom.c
+++ b/arch/arm/mach-rockchip/bootrom.c
@@ -4,11 +4,11 @@
  */
 
 #include <hang.h>
+#include <setjmp.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/boot_mode.h>
 #include <asm/cache.h>
 #include <asm/io.h>
-#include <asm/setjmp.h>
 #include <asm/system.h>
 
 /*
diff --git a/arch/riscv/include/asm/setjmp.h b/arch/riscv/include/asm/setjmp.h
index 72383d43303..08687e0f92b 100644
--- a/arch/riscv/include/asm/setjmp.h
+++ b/arch/riscv/include/asm/setjmp.h
@@ -3,13 +3,9 @@
  * (C) Copyright 2018 Alexander Graf <agraf@suse.de>
  */
 
-#ifndef _SETJMP_H_
-#define _SETJMP_H_	1
+#ifndef _ASM_SETJMP_H_
+#define _ASM_SETJMP_H_	1
 
-/*
- * This really should be opaque, but the EFI implementation wrongly
- * assumes that a 'struct jmp_buf_data' is defined.
- */
 struct jmp_buf_data {
 	/* x2, x8, x9, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, sp */
 	unsigned long s_regs[12];	/* s0 - s11 */
@@ -17,9 +13,4 @@ struct jmp_buf_data {
 	unsigned long sp;
 };
 
-typedef struct jmp_buf_data jmp_buf[1];
-
-int setjmp(jmp_buf jmp);
-void longjmp(jmp_buf jmp, int ret);
-
-#endif /* _SETJMP_H_ */
+#endif /* _ASM_SETJMP_H_ */
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 6407193c5f1..6db8739e66b 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -10,10 +10,10 @@
 #include <errno.h>
 #include <log.h>
 #include <os.h>
+#include <setjmp.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/malloc.h>
-#include <asm/setjmp.h>
 #include <asm/state.h>
 #include <dm/ofnode.h>
 #include <linux/delay.h>
diff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h
index 47dc8938cd6..3413c747783 100644
--- a/arch/sandbox/include/asm/setjmp.h
+++ b/arch/sandbox/include/asm/setjmp.h
@@ -4,8 +4,8 @@
  * Written by Simon Glass <sjg@chromium.org>
  */
 
-#ifndef _SETJMP_H_
-#define _SETJMP_H_
+#ifndef _ASM_SETJMP_H_
+#define _ASM_SETJMP_H_
 
 struct jmp_buf_data {
 	/*
@@ -22,14 +22,4 @@ struct jmp_buf_data {
 	unsigned long data[128];
 };
 
-typedef struct jmp_buf_data jmp_buf[1];
-
-/*
- * We have to directly link with the system versions of
- * setjmp/longjmp, because setjmp must not return as otherwise
- * the stack may become invalid.
- */
-int setjmp(jmp_buf jmp);
-__noreturn void longjmp(jmp_buf jmp, int ret);
-
-#endif /* _SETJMP_H_ */
+#endif /* _ASM_SETJMP_H_ */
diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h
index 15915d0dc6b..13772574e15 100644
--- a/arch/x86/include/asm/setjmp.h
+++ b/arch/x86/include/asm/setjmp.h
@@ -5,8 +5,8 @@
  * From Linux arch/um/sys-i386/setjmp.S
  */
 
-#ifndef __setjmp_h
-#define __setjmp_h
+#ifndef _ASM_SETJMP_H_
+#define _ASM_SETJMP_H_	1
 
 #ifdef CONFIG_X86_64
 
@@ -34,9 +34,4 @@ struct jmp_buf_data {
 
 #endif
 
-typedef struct jmp_buf_data jmp_buf[1];
-
-int setjmp(jmp_buf env);
-void longjmp(jmp_buf env, int val);
-
-#endif
+#endif /* _ASM_SETJMP_H_ */
diff --git a/include/interrupt.h b/include/interrupt.h
index 46ef2e196d4..6ea28b54a56 100644
--- a/include/interrupt.h
+++ b/include/interrupt.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
-#include <asm/setjmp.h>
+#include <setjmp.h>
 
 /**
  * struct resume_data - data for resume after interrupt
diff --git a/include/setjmp.h b/include/setjmp.h
new file mode 100644
index 00000000000..37d3a8af85d
--- /dev/null
+++ b/include/setjmp.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _SETJMP_H_
+#define _SETJMP_H_ 1
+
+#ifdef CONFIG_HAVE_SETJMP
+#include <asm/setjmp.h>
+#else
+struct jmp_buf_data {
+};
+#endif
+
+/**
+ * typedef jmp_buf - information needed to restore a calling environment
+ */
+typedef struct jmp_buf_data jmp_buf[1];
+
+/**
+ * setjmp() - prepare for a long jump
+ *
+ * Registers, the stack pointer, and the return address are saved in the
+ * jump bufffer. The function returns zero afterwards. When longjmp() is
+ * executed the function returns a second time with a non-zero value.
+ *
+ * @env:	jump buffer used to store register values
+ * Return:	0 after setting up jump buffer, non-zero after longjmp()
+ */
+int setjmp(jmp_buf env);
+
+/**
+ * longjmp() - long jump
+ *
+ * Jump back to the address and the register state saved by setjmp().
+ *
+ * @env:	jump buffer
+ * @val:	value to be returned by setjmp(), 0 is replaced by 1
+ */
+void longjmp(jmp_buf env, int val);
+
+#endif /* _SETJMP_H_ */
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 5164cb15986..bdf9e7e8066 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -21,7 +21,7 @@
 #include <usb.h>
 #include <watchdog.h>
 #include <asm/global_data.h>
-#include <asm/setjmp.h>
+#include <setjmp.h>
 #include <linux/libfdt_env.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/test/lib/longjmp.c b/test/lib/longjmp.c
index 79d889bdd5f..74c3465b8c2 100644
--- a/test/lib/longjmp.c
+++ b/test/lib/longjmp.c
@@ -5,10 +5,10 @@
  * Copyright (c) 2021, Heinrich Schuchardt <xypron.glpk@gmx.de>
  */
 
+#include <setjmp.h>
 #include <test/lib.h>
 #include <test/test.h>
 #include <test/ut.h>
-#include <asm/setjmp.h>
 
 struct test_jmp_buf {
 	jmp_buf env;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
                   ` (2 preceding siblings ...)
  2025-03-02 14:21 ` [PATCH 3/5] common: clean up setjmp.h Heinrich Schuchardt
@ 2025-03-02 14:21 ` Heinrich Schuchardt
  2025-03-04 13:49   ` Jerome Forissier
  2025-03-04 13:51   ` Ilias Apalodimas
  2025-03-02 14:21 ` [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data Heinrich Schuchardt
  2025-03-04  9:10 ` [PATCH 0/5] common: clean up usage of structure jmp_buf_data Jerome Forissier
  5 siblings, 2 replies; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot

From: Yao Zi <ziyao@disroot.org>

Structure jmp_buf_data provides the underlying format of jmp_buf, which
we actually don't care about. Clean up existing code to use the standard
jmp_buf type. This introduces no functional change.

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 include/efi_loader.h          | 4 ++--
 lib/efi_loader/efi_boottime.c | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 1d75d97ebbc..22b724f311a 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -15,13 +15,13 @@
 #include <efi_api.h>
 #include <image.h>
 #include <pe.h>
+#include <setjmp.h>
 #include <linux/list.h>
 #include <linux/sizes.h>
 #include <linux/oid_registry.h>
 
 struct blk_desc;
 struct bootflow;
-struct jmp_buf_data;
 
 #if CONFIG_IS_ENABLED(EFI_LOADER)
 
@@ -485,7 +485,7 @@ struct efi_loaded_image_obj {
 	efi_status_t *exit_status;
 	efi_uintn_t *exit_data_size;
 	u16 **exit_data;
-	struct jmp_buf_data *exit_jmp;
+	jmp_buf *exit_jmp;
 	EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
 				     struct efi_system_table *st);
 	u16 image_type;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index bdf9e7e8066..853a1c8c097 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -21,7 +21,6 @@
 #include <usb.h>
 #include <watchdog.h>
 #include <asm/global_data.h>
-#include <setjmp.h>
 #include <linux/libfdt_env.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -3199,7 +3198,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 	void *info;
 	efi_handle_t parent_image = current_image;
 	efi_status_t exit_status;
-	struct jmp_buf_data exit_jmp;
+	jmp_buf exit_jmp;
 
 	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
@@ -3238,7 +3237,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 	}
 
 	/* call the image! */
-	if (setjmp(&exit_jmp)) {
+	if (setjmp(exit_jmp)) {
 		/*
 		 * We called the entry point of the child image with EFI_CALL
 		 * in the lines below. The child image called the Exit() boot
@@ -3444,7 +3443,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
 	struct efi_loaded_image *loaded_image_protocol;
 	struct efi_loaded_image_obj *image_obj =
 		(struct efi_loaded_image_obj *)image_handle;
-	struct jmp_buf_data *exit_jmp;
+	jmp_buf *exit_jmp;
 
 	EFI_ENTRY("%p, %ld, %zu, %p", image_handle, exit_status,
 		  exit_data_size, exit_data);
@@ -3511,7 +3510,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
 	 */
 	efi_restore_gd();
 
-	longjmp(exit_jmp, 1);
+	longjmp(*exit_jmp, 1);
 
 	panic("EFI application exited");
 out:
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
                   ` (3 preceding siblings ...)
  2025-03-02 14:21 ` [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data Heinrich Schuchardt
@ 2025-03-02 14:21 ` Heinrich Schuchardt
  2025-03-04 13:49   ` Jerome Forissier
  2025-03-04 13:51   ` Ilias Apalodimas
  2025-03-04  9:10 ` [PATCH 0/5] common: clean up usage of structure jmp_buf_data Jerome Forissier
  5 siblings, 2 replies; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 14:21 UTC (permalink / raw)
  To: Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot,
	Heinrich Schuchardt

Instead of using the implementation specific struct jmp_buf_data use the
standard compliant type jmp_buf when switching exception levels.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/arm/cpu/armv7/exception_level.c | 6 +++---
 arch/arm/cpu/armv8/exception_level.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
index c63b0e13666..a55c158ce51 100644
--- a/arch/arm/cpu/armv7/exception_level.c
+++ b/arch/arm/cpu/armv7/exception_level.c
@@ -24,7 +24,7 @@
  *
  * @non_secure_jmp:	jump buffer for restoring stack and registers
  */
-static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
+static void entry_non_secure(jmp_buf non_secure_jmp)
 {
 	dcache_enable();
 	debug("Reached non-secure mode\n");
@@ -42,10 +42,10 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
 void switch_to_non_secure_mode(void)
 {
 	static bool is_nonsec;
-	struct jmp_buf_data non_secure_jmp;
+	jmp_buf non_secure_jmp;
 
 	if (armv7_boot_nonsec() && !is_nonsec) {
-		if (setjmp(&non_secure_jmp))
+		if (setjmp(non_secure_jmp))
 			return;
 		dcache_disable();	/* flush cache before switch to HYP */
 		armv7_init_nonsec();
diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
index 58e816007f0..746737861e7 100644
--- a/arch/arm/cpu/armv8/exception_level.c
+++ b/arch/arm/cpu/armv8/exception_level.c
@@ -23,7 +23,7 @@
  *
  * @non_secure_jmp:	jump buffer for restoring stack and registers
  */
-static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
+static void entry_non_secure(jmp_buf non_secure_jmp)
 {
 	dcache_enable();
 	debug("Reached non-secure mode\n");
@@ -42,11 +42,11 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
  */
 void switch_to_non_secure_mode(void)
 {
-	struct jmp_buf_data non_secure_jmp;
+	jmp_buf non_secure_jmp;
 
 	/* On AArch64 we need to make sure we call our payload in < EL3 */
 	if (current_el() == 3) {
-		if (setjmp(&non_secure_jmp))
+		if (setjmp(non_secure_jmp))
 			return;
 		dcache_disable();	/* flush cache before switch to EL2 */
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
@ 2025-03-02 16:01   ` Yao Zi
  2025-03-02 16:18     ` Heinrich Schuchardt
  2025-03-04 13:48   ` Jerome Forissier
  2025-03-11 12:44   ` Ilias Apalodimas
  2 siblings, 1 reply; 18+ messages in thread
From: Yao Zi @ 2025-03-02 16:01 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Jerome Forissier, Simon Glass, Philipp Tomsich, Kever Yang,
	Rick Chen, Leo, Bin Meng, Ilias Apalodimas, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, u-boot

On Sun, Mar 02, 2025 at 03:21:18PM +0100, Heinrich Schuchardt wrote:
> Don't assume that u32 and u64 are already defined.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/arm/include/asm/setjmp.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
> index 662bec86321..9a7f5af9f8f 100644
> --- a/arch/arm/include/asm/setjmp.h
> +++ b/arch/arm/include/asm/setjmp.h
> @@ -7,6 +7,8 @@
>  #ifndef _SETJMP_H_
>  #define _SETJMP_H_	1
>  
> +#include <asm-generic/int-ll64.h>
> +

>  /*
>   * This really should be opaque, but the EFI implementation wrongly
>   * assumes that a 'struct jmp_buf_data' is defined.

With PATCH 4 of the series, this comment isn't true anymore. Should we
fix it up at the same time?

> -- 
> 2.48.1
> 

Best regards,
Yao Zi

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 16:01   ` Yao Zi
@ 2025-03-02 16:18     ` Heinrich Schuchardt
  2025-03-02 16:20       ` Yao Zi
  0 siblings, 1 reply; 18+ messages in thread
From: Heinrich Schuchardt @ 2025-03-02 16:18 UTC (permalink / raw)
  To: Yao Zi
  Cc: Tom Rini, Jerome Forissier, Simon Glass, Philipp Tomsich,
	Kever Yang, Rick Chen, Leo, Bin Meng, Ilias Apalodimas,
	Matthias Brugger, Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, U-Boot Mailing List

Yao Zi <ziyao@disroot.org> schrieb am So., 2. März 2025, 17:02:

> On Sun, Mar 02, 2025 at 03:21:18PM +0100, Heinrich Schuchardt wrote:
> > Don't assume that u32 and u64 are already defined.
> >
> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > ---
> >  arch/arm/include/asm/setjmp.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/include/asm/setjmp.h
> b/arch/arm/include/asm/setjmp.h
> > index 662bec86321..9a7f5af9f8f 100644
> > --- a/arch/arm/include/asm/setjmp.h
> > +++ b/arch/arm/include/asm/setjmp.h
> > @@ -7,6 +7,8 @@
> >  #ifndef _SETJMP_H_
> >  #define _SETJMP_H_   1
> >
> > +#include <asm-generic/int-ll64.h>
> > +
>
> >  /*
> >   * This really should be opaque, but the EFI implementation wrongly
> >   * assumes that a 'struct jmp_buf_data' is defined.
>
> With PATCH 4 of the series, this comment isn't true anymore. Should we
> fix it up at the same time?
>

The comment is removed in patch 3.

https://lore.kernel.org/u-boot/20250302142121.150480-4-heinrich.schuchardt@canonical.com/T/#u

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 16:18     ` Heinrich Schuchardt
@ 2025-03-02 16:20       ` Yao Zi
  0 siblings, 0 replies; 18+ messages in thread
From: Yao Zi @ 2025-03-02 16:20 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Jerome Forissier, Simon Glass, Philipp Tomsich,
	Kever Yang, Rick Chen, Leo, Bin Meng, Ilias Apalodimas,
	Matthias Brugger, Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, U-Boot Mailing List

On Sun, Mar 02, 2025 at 05:18:21PM +0100, Heinrich Schuchardt wrote:
> Yao Zi <ziyao@disroot.org> schrieb am So., 2. März 2025, 17:02:
> 
> > On Sun, Mar 02, 2025 at 03:21:18PM +0100, Heinrich Schuchardt wrote:
> > > Don't assume that u32 and u64 are already defined.
> > >
> > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > > ---
> > >  arch/arm/include/asm/setjmp.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/arm/include/asm/setjmp.h
> > b/arch/arm/include/asm/setjmp.h
> > > index 662bec86321..9a7f5af9f8f 100644
> > > --- a/arch/arm/include/asm/setjmp.h
> > > +++ b/arch/arm/include/asm/setjmp.h
> > > @@ -7,6 +7,8 @@
> > >  #ifndef _SETJMP_H_
> > >  #define _SETJMP_H_   1
> > >
> > > +#include <asm-generic/int-ll64.h>
> > > +
> >
> > >  /*
> > >   * This really should be opaque, but the EFI implementation wrongly
> > >   * assumes that a 'struct jmp_buf_data' is defined.
> >
> > With PATCH 4 of the series, this comment isn't true anymore. Should we
> > fix it up at the same time?
> >
> 
> The comment is removed in patch 3.

Oops, I didn't notice that. Sorry for the noise.

> https://lore.kernel.org/u-boot/20250302142121.150480-4-heinrich.schuchardt@canonical.com/T/#u
> 
> Best regards
> 
> Heinrich

Thanks,
Yao Zi

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5] common: clean up usage of structure jmp_buf_data
  2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
                   ` (4 preceding siblings ...)
  2025-03-02 14:21 ` [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data Heinrich Schuchardt
@ 2025-03-04  9:10 ` Jerome Forissier
  5 siblings, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04  9:10 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot

Hi Heinrich,

On 3/2/25 15:21, Heinrich Schuchardt wrote:
> When implementing setjmp() we did not clearly separate the architecture
> specific part from the non-specific part. The lead to code directly
> accessing the architecture specific struct jmp_buf_data instead of using
> jmp_buf.
> 
> With this series include setjmp.h is carved out from the architecture
> specific implementations asm/setjmp.h.
> 
> All direct usages of asm/setjmp.h and struct jmp_buf_data are corrected.
> 
> Thanks to Zi for starting this clean-up.
> 
> Heinrich Schuchardt (4):
>   sandbox: remove linux/types.h dependency in setjmp.h
>   arm: include asm-generic/int-ll64.h in setjmp.h
>   common: clean up setjmp.h
>   arm: use type jmp_buf instead of struct jmp_buf_data
> 
> Yao Zi (1):
>   efi_loader: Clean up usage of structure jmp_buf_data
> 
>  arch/arm/cpu/armv7/exception_level.c |  8 +++---
>  arch/arm/cpu/armv8/exception_level.c |  8 +++---
>  arch/arm/include/asm/setjmp.h        | 17 ++++--------
>  arch/arm/mach-rockchip/bootrom.c     |  2 +-
>  arch/riscv/include/asm/setjmp.h      | 15 +++--------
>  arch/sandbox/cpu/cpu.c               |  2 +-
>  arch/sandbox/include/asm/setjmp.h    | 18 +++----------
>  arch/x86/include/asm/setjmp.h        | 11 +++-----
>  include/efi_loader.h                 |  4 +--
>  include/interrupt.h                  |  2 +-
>  include/setjmp.h                     | 40 ++++++++++++++++++++++++++++
>  lib/efi_loader/efi_boottime.c        |  9 +++----
>  test/lib/longjmp.c                   |  2 +-
>  13 files changed, 73 insertions(+), 65 deletions(-)
>  create mode 100644 include/setjmp.h
> 

For the whole series:

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

That's a nice cleanup. I will rebase my uthreads series [1] onto this
for v3.

[1] https://lists.denx.de/pipermail/u-boot/2025-February/581626.html

Thanks,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h
  2025-03-02 14:21 ` [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h Heinrich Schuchardt
@ 2025-03-04 13:48   ` Jerome Forissier
  0 siblings, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04 13:48 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot



On 3/2/25 15:21, Heinrich Schuchardt wrote:
> ulong is defined in linux/types.h use unsigned long instead.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/sandbox/include/asm/setjmp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h
> index 001c7ea322d..47dc8938cd6 100644
> --- a/arch/sandbox/include/asm/setjmp.h
> +++ b/arch/sandbox/include/asm/setjmp.h
> @@ -19,7 +19,7 @@ struct jmp_buf_data {
>  	 * We don't need to worry about 16-byte alignment, since this does not
>  	 * run on Windows.
>  	 */
> -	ulong data[128];
> +	unsigned long data[128];
>  };
>  
>  typedef struct jmp_buf_data jmp_buf[1];

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Regards,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
  2025-03-02 16:01   ` Yao Zi
@ 2025-03-04 13:48   ` Jerome Forissier
  2025-03-11 12:44   ` Ilias Apalodimas
  2 siblings, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04 13:48 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot



On 3/2/25 15:21, Heinrich Schuchardt wrote:
> Don't assume that u32 and u64 are already defined.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/arm/include/asm/setjmp.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
> index 662bec86321..9a7f5af9f8f 100644
> --- a/arch/arm/include/asm/setjmp.h
> +++ b/arch/arm/include/asm/setjmp.h
> @@ -7,6 +7,8 @@
>  #ifndef _SETJMP_H_
>  #define _SETJMP_H_	1
>  
> +#include <asm-generic/int-ll64.h>
> +
>  /*
>   * This really should be opaque, but the EFI implementation wrongly
>   * assumes that a 'struct jmp_buf_data' is defined.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Regards,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5] common: clean up setjmp.h
  2025-03-02 14:21 ` [PATCH 3/5] common: clean up setjmp.h Heinrich Schuchardt
@ 2025-03-04 13:49   ` Jerome Forissier
  0 siblings, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04 13:49 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot



On 3/2/25 15:21, Heinrich Schuchardt wrote:
> Separate setjmp.h into an architecture independent part and an architecture
> specific part. This simplifies moving from using struct jmp_buf_data
> directly to using type jmp_buf in our code which is the C compliant way.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/arm/cpu/armv7/exception_level.c |  2 +-
>  arch/arm/cpu/armv8/exception_level.c |  2 +-
>  arch/arm/include/asm/setjmp.h        | 15 +++--------
>  arch/arm/mach-rockchip/bootrom.c     |  2 +-
>  arch/riscv/include/asm/setjmp.h      | 15 +++--------
>  arch/sandbox/cpu/cpu.c               |  2 +-
>  arch/sandbox/include/asm/setjmp.h    | 16 +++--------
>  arch/x86/include/asm/setjmp.h        | 11 +++-----
>  include/interrupt.h                  |  2 +-
>  include/setjmp.h                     | 40 ++++++++++++++++++++++++++++
>  lib/efi_loader/efi_boottime.c        |  2 +-
>  test/lib/longjmp.c                   |  2 +-
>  12 files changed, 59 insertions(+), 52 deletions(-)
>  create mode 100644 include/setjmp.h
> 
> diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
> index 7baade61b07..c63b0e13666 100644
> --- a/arch/arm/cpu/armv7/exception_level.c
> +++ b/arch/arm/cpu/armv7/exception_level.c
> @@ -11,9 +11,9 @@
>  #include <bootm.h>
>  #include <cpu_func.h>
>  #include <log.h>
> +#include <setjmp.h>
>  #include <asm/armv7.h>
>  #include <asm/secure.h>
> -#include <asm/setjmp.h>
>  
>  /**
>   * entry_non_secure() - entry point when switching to non-secure mode
> diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
> index 85c78f55789..58e816007f0 100644
> --- a/arch/arm/cpu/armv8/exception_level.c
> +++ b/arch/arm/cpu/armv8/exception_level.c
> @@ -11,8 +11,8 @@
>  #include <bootm.h>
>  #include <cpu_func.h>
>  #include <log.h>
> +#include <setjmp.h>
>  #include <asm/cache.h>
> -#include <asm/setjmp.h>
>  
>  /**
>   * entry_non_secure() - entry point when switching to non-secure mode
> diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
> index 9a7f5af9f8f..a9eccf7f632 100644
> --- a/arch/arm/include/asm/setjmp.h
> +++ b/arch/arm/include/asm/setjmp.h
> @@ -4,15 +4,11 @@
>   * (C) Copyright 2016 Alexander Graf <agraf@suse.de>
>   */
>  
> -#ifndef _SETJMP_H_
> -#define _SETJMP_H_	1
> +#ifndef _ASM_SETJMP_H_
> +#define _ASM_SETJMP_H_	1
>  
>  #include <asm-generic/int-ll64.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];
> @@ -21,9 +17,4 @@ struct jmp_buf_data {
>  #endif
>  };
>  
> -typedef struct jmp_buf_data jmp_buf[1];
> -
> -int setjmp(jmp_buf jmp);
> -void longjmp(jmp_buf jmp, int ret);
> -
> -#endif /* _SETJMP_H_ */
> +#endif /* _ASM_SETJMP_H_ */
> diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
> index 82a0b3efef9..1db38546d55 100644
> --- a/arch/arm/mach-rockchip/bootrom.c
> +++ b/arch/arm/mach-rockchip/bootrom.c
> @@ -4,11 +4,11 @@
>   */
>  
>  #include <hang.h>
> +#include <setjmp.h>
>  #include <asm/arch-rockchip/bootrom.h>
>  #include <asm/arch-rockchip/boot_mode.h>
>  #include <asm/cache.h>
>  #include <asm/io.h>
> -#include <asm/setjmp.h>
>  #include <asm/system.h>
>  
>  /*
> diff --git a/arch/riscv/include/asm/setjmp.h b/arch/riscv/include/asm/setjmp.h
> index 72383d43303..08687e0f92b 100644
> --- a/arch/riscv/include/asm/setjmp.h
> +++ b/arch/riscv/include/asm/setjmp.h
> @@ -3,13 +3,9 @@
>   * (C) Copyright 2018 Alexander Graf <agraf@suse.de>
>   */
>  
> -#ifndef _SETJMP_H_
> -#define _SETJMP_H_	1
> +#ifndef _ASM_SETJMP_H_
> +#define _ASM_SETJMP_H_	1
>  
> -/*
> - * This really should be opaque, but the EFI implementation wrongly
> - * assumes that a 'struct jmp_buf_data' is defined.
> - */
>  struct jmp_buf_data {
>  	/* x2, x8, x9, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, sp */
>  	unsigned long s_regs[12];	/* s0 - s11 */
> @@ -17,9 +13,4 @@ struct jmp_buf_data {
>  	unsigned long sp;
>  };
>  
> -typedef struct jmp_buf_data jmp_buf[1];
> -
> -int setjmp(jmp_buf jmp);
> -void longjmp(jmp_buf jmp, int ret);
> -
> -#endif /* _SETJMP_H_ */
> +#endif /* _ASM_SETJMP_H_ */
> diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
> index 6407193c5f1..6db8739e66b 100644
> --- a/arch/sandbox/cpu/cpu.c
> +++ b/arch/sandbox/cpu/cpu.c
> @@ -10,10 +10,10 @@
>  #include <errno.h>
>  #include <log.h>
>  #include <os.h>
> +#include <setjmp.h>
>  #include <asm/global_data.h>
>  #include <asm/io.h>
>  #include <asm/malloc.h>
> -#include <asm/setjmp.h>
>  #include <asm/state.h>
>  #include <dm/ofnode.h>
>  #include <linux/delay.h>
> diff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h
> index 47dc8938cd6..3413c747783 100644
> --- a/arch/sandbox/include/asm/setjmp.h
> +++ b/arch/sandbox/include/asm/setjmp.h
> @@ -4,8 +4,8 @@
>   * Written by Simon Glass <sjg@chromium.org>
>   */
>  
> -#ifndef _SETJMP_H_
> -#define _SETJMP_H_
> +#ifndef _ASM_SETJMP_H_
> +#define _ASM_SETJMP_H_
>  
>  struct jmp_buf_data {
>  	/*
> @@ -22,14 +22,4 @@ struct jmp_buf_data {
>  	unsigned long data[128];
>  };
>  
> -typedef struct jmp_buf_data jmp_buf[1];
> -
> -/*
> - * We have to directly link with the system versions of
> - * setjmp/longjmp, because setjmp must not return as otherwise
> - * the stack may become invalid.
> - */
> -int setjmp(jmp_buf jmp);
> -__noreturn void longjmp(jmp_buf jmp, int ret);
> -
> -#endif /* _SETJMP_H_ */
> +#endif /* _ASM_SETJMP_H_ */
> diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h
> index 15915d0dc6b..13772574e15 100644
> --- a/arch/x86/include/asm/setjmp.h
> +++ b/arch/x86/include/asm/setjmp.h
> @@ -5,8 +5,8 @@
>   * From Linux arch/um/sys-i386/setjmp.S
>   */
>  
> -#ifndef __setjmp_h
> -#define __setjmp_h
> +#ifndef _ASM_SETJMP_H_
> +#define _ASM_SETJMP_H_	1
>  
>  #ifdef CONFIG_X86_64
>  
> @@ -34,9 +34,4 @@ struct jmp_buf_data {
>  
>  #endif
>  
> -typedef struct jmp_buf_data jmp_buf[1];
> -
> -int setjmp(jmp_buf env);
> -void longjmp(jmp_buf env, int val);
> -
> -#endif
> +#endif /* _ASM_SETJMP_H_ */
> diff --git a/include/interrupt.h b/include/interrupt.h
> index 46ef2e196d4..6ea28b54a56 100644
> --- a/include/interrupt.h
> +++ b/include/interrupt.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0-or-later */
>  
> -#include <asm/setjmp.h>
> +#include <setjmp.h>
>  
>  /**
>   * struct resume_data - data for resume after interrupt
> diff --git a/include/setjmp.h b/include/setjmp.h
> new file mode 100644
> index 00000000000..37d3a8af85d
> --- /dev/null
> +++ b/include/setjmp.h
> @@ -0,0 +1,40 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef _SETJMP_H_
> +#define _SETJMP_H_ 1
> +
> +#ifdef CONFIG_HAVE_SETJMP
> +#include <asm/setjmp.h>
> +#else
> +struct jmp_buf_data {
> +};
> +#endif
> +
> +/**
> + * typedef jmp_buf - information needed to restore a calling environment
> + */
> +typedef struct jmp_buf_data jmp_buf[1];
> +
> +/**
> + * setjmp() - prepare for a long jump
> + *
> + * Registers, the stack pointer, and the return address are saved in the
> + * jump bufffer. The function returns zero afterwards. When longjmp() is
> + * executed the function returns a second time with a non-zero value.
> + *
> + * @env:	jump buffer used to store register values
> + * Return:	0 after setting up jump buffer, non-zero after longjmp()
> + */
> +int setjmp(jmp_buf env);
> +
> +/**
> + * longjmp() - long jump
> + *
> + * Jump back to the address and the register state saved by setjmp().
> + *
> + * @env:	jump buffer
> + * @val:	value to be returned by setjmp(), 0 is replaced by 1
> + */
> +void longjmp(jmp_buf env, int val);
> +
> +#endif /* _SETJMP_H_ */
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 5164cb15986..bdf9e7e8066 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -21,7 +21,7 @@
>  #include <usb.h>
>  #include <watchdog.h>
>  #include <asm/global_data.h>
> -#include <asm/setjmp.h>
> +#include <setjmp.h>
>  #include <linux/libfdt_env.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
> diff --git a/test/lib/longjmp.c b/test/lib/longjmp.c
> index 79d889bdd5f..74c3465b8c2 100644
> --- a/test/lib/longjmp.c
> +++ b/test/lib/longjmp.c
> @@ -5,10 +5,10 @@
>   * Copyright (c) 2021, Heinrich Schuchardt <xypron.glpk@gmx.de>
>   */
>  
> +#include <setjmp.h>
>  #include <test/lib.h>
>  #include <test/test.h>
>  #include <test/ut.h>
> -#include <asm/setjmp.h>
>  
>  struct test_jmp_buf {
>  	jmp_buf env;

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Regards,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data
  2025-03-02 14:21 ` [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data Heinrich Schuchardt
@ 2025-03-04 13:49   ` Jerome Forissier
  2025-03-04 13:51   ` Ilias Apalodimas
  1 sibling, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04 13:49 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot



On 3/2/25 15:21, Heinrich Schuchardt wrote:
> From: Yao Zi <ziyao@disroot.org>
> 
> Structure jmp_buf_data provides the underlying format of jmp_buf, which
> we actually don't care about. Clean up existing code to use the standard
> jmp_buf type. This introduces no functional change.
> 
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
>  include/efi_loader.h          | 4 ++--
>  lib/efi_loader/efi_boottime.c | 9 ++++-----
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 1d75d97ebbc..22b724f311a 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -15,13 +15,13 @@
>  #include <efi_api.h>
>  #include <image.h>
>  #include <pe.h>
> +#include <setjmp.h>
>  #include <linux/list.h>
>  #include <linux/sizes.h>
>  #include <linux/oid_registry.h>
>  
>  struct blk_desc;
>  struct bootflow;
> -struct jmp_buf_data;
>  
>  #if CONFIG_IS_ENABLED(EFI_LOADER)
>  
> @@ -485,7 +485,7 @@ struct efi_loaded_image_obj {
>  	efi_status_t *exit_status;
>  	efi_uintn_t *exit_data_size;
>  	u16 **exit_data;
> -	struct jmp_buf_data *exit_jmp;
> +	jmp_buf *exit_jmp;
>  	EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
>  				     struct efi_system_table *st);
>  	u16 image_type;
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index bdf9e7e8066..853a1c8c097 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -21,7 +21,6 @@
>  #include <usb.h>
>  #include <watchdog.h>
>  #include <asm/global_data.h>
> -#include <setjmp.h>
>  #include <linux/libfdt_env.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -3199,7 +3198,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>  	void *info;
>  	efi_handle_t parent_image = current_image;
>  	efi_status_t exit_status;
> -	struct jmp_buf_data exit_jmp;
> +	jmp_buf exit_jmp;
>  
>  	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
>  
> @@ -3238,7 +3237,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>  	}
>  
>  	/* call the image! */
> -	if (setjmp(&exit_jmp)) {
> +	if (setjmp(exit_jmp)) {
>  		/*
>  		 * We called the entry point of the child image with EFI_CALL
>  		 * in the lines below. The child image called the Exit() boot
> @@ -3444,7 +3443,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
>  	struct efi_loaded_image *loaded_image_protocol;
>  	struct efi_loaded_image_obj *image_obj =
>  		(struct efi_loaded_image_obj *)image_handle;
> -	struct jmp_buf_data *exit_jmp;
> +	jmp_buf *exit_jmp;
>  
>  	EFI_ENTRY("%p, %ld, %zu, %p", image_handle, exit_status,
>  		  exit_data_size, exit_data);
> @@ -3511,7 +3510,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
>  	 */
>  	efi_restore_gd();
>  
> -	longjmp(exit_jmp, 1);
> +	longjmp(*exit_jmp, 1);
>  
>  	panic("EFI application exited");
>  out:

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Regards,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data
  2025-03-02 14:21 ` [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data Heinrich Schuchardt
@ 2025-03-04 13:49   ` Jerome Forissier
  2025-03-04 13:51   ` Ilias Apalodimas
  1 sibling, 0 replies; 18+ messages in thread
From: Jerome Forissier @ 2025-03-04 13:49 UTC (permalink / raw)
  To: Heinrich Schuchardt, Tom Rini
  Cc: Simon Glass, Philipp Tomsich, Kever Yang, Rick Chen, Leo,
	Bin Meng, Ilias Apalodimas, Matthias Brugger, Patrice Chotard,
	Adriano Cordova, Sughosh Ganu, Vincent Stehlé, Janne Grunau,
	Yao Zi, u-boot



On 3/2/25 15:21, Heinrich Schuchardt wrote:
> Instead of using the implementation specific struct jmp_buf_data use the
> standard compliant type jmp_buf when switching exception levels.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/arm/cpu/armv7/exception_level.c | 6 +++---
>  arch/arm/cpu/armv8/exception_level.c | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
> index c63b0e13666..a55c158ce51 100644
> --- a/arch/arm/cpu/armv7/exception_level.c
> +++ b/arch/arm/cpu/armv7/exception_level.c
> @@ -24,7 +24,7 @@
>   *
>   * @non_secure_jmp:	jump buffer for restoring stack and registers
>   */
> -static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
> +static void entry_non_secure(jmp_buf non_secure_jmp)
>  {
>  	dcache_enable();
>  	debug("Reached non-secure mode\n");
> @@ -42,10 +42,10 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
>  void switch_to_non_secure_mode(void)
>  {
>  	static bool is_nonsec;
> -	struct jmp_buf_data non_secure_jmp;
> +	jmp_buf non_secure_jmp;
>  
>  	if (armv7_boot_nonsec() && !is_nonsec) {
> -		if (setjmp(&non_secure_jmp))
> +		if (setjmp(non_secure_jmp))
>  			return;
>  		dcache_disable();	/* flush cache before switch to HYP */
>  		armv7_init_nonsec();
> diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
> index 58e816007f0..746737861e7 100644
> --- a/arch/arm/cpu/armv8/exception_level.c
> +++ b/arch/arm/cpu/armv8/exception_level.c
> @@ -23,7 +23,7 @@
>   *
>   * @non_secure_jmp:	jump buffer for restoring stack and registers
>   */
> -static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
> +static void entry_non_secure(jmp_buf non_secure_jmp)
>  {
>  	dcache_enable();
>  	debug("Reached non-secure mode\n");
> @@ -42,11 +42,11 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
>   */
>  void switch_to_non_secure_mode(void)
>  {
> -	struct jmp_buf_data non_secure_jmp;
> +	jmp_buf non_secure_jmp;
>  
>  	/* On AArch64 we need to make sure we call our payload in < EL3 */
>  	if (current_el() == 3) {
> -		if (setjmp(&non_secure_jmp))
> +		if (setjmp(non_secure_jmp))
>  			return;
>  		dcache_disable();	/* flush cache before switch to EL2 */
>  

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

Regards,
-- 
Jerome

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data
  2025-03-02 14:21 ` [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data Heinrich Schuchardt
  2025-03-04 13:49   ` Jerome Forissier
@ 2025-03-04 13:51   ` Ilias Apalodimas
  1 sibling, 0 replies; 18+ messages in thread
From: Ilias Apalodimas @ 2025-03-04 13:51 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Jerome Forissier, Simon Glass, Philipp Tomsich,
	Kever Yang, Rick Chen, Leo, Bin Meng, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot

On Sun, 2 Mar 2025 at 14:22, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Instead of using the implementation specific struct jmp_buf_data use the
> standard compliant type jmp_buf when switching exception levels.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> ---
>  arch/arm/cpu/armv7/exception_level.c | 6 +++---
>  arch/arm/cpu/armv8/exception_level.c | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
> index c63b0e13666..a55c158ce51 100644
> --- a/arch/arm/cpu/armv7/exception_level.c
> +++ b/arch/arm/cpu/armv7/exception_level.c
> @@ -24,7 +24,7 @@
>   *
>   * @non_secure_jmp:    jump buffer for restoring stack and registers
>   */
> -static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
> +static void entry_non_secure(jmp_buf non_secure_jmp)
>  {
>         dcache_enable();
>         debug("Reached non-secure mode\n");
> @@ -42,10 +42,10 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
>  void switch_to_non_secure_mode(void)
>  {
>         static bool is_nonsec;
> -       struct jmp_buf_data non_secure_jmp;
> +       jmp_buf non_secure_jmp;
>
>         if (armv7_boot_nonsec() && !is_nonsec) {
> -               if (setjmp(&non_secure_jmp))
> +               if (setjmp(non_secure_jmp))
>                         return;
>                 dcache_disable();       /* flush cache before switch to HYP */
>                 armv7_init_nonsec();
> diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
> index 58e816007f0..746737861e7 100644
> --- a/arch/arm/cpu/armv8/exception_level.c
> +++ b/arch/arm/cpu/armv8/exception_level.c
> @@ -23,7 +23,7 @@
>   *
>   * @non_secure_jmp:    jump buffer for restoring stack and registers
>   */
> -static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
> +static void entry_non_secure(jmp_buf non_secure_jmp)
>  {
>         dcache_enable();
>         debug("Reached non-secure mode\n");
> @@ -42,11 +42,11 @@ static void entry_non_secure(struct jmp_buf_data *non_secure_jmp)
>   */
>  void switch_to_non_secure_mode(void)
>  {
> -       struct jmp_buf_data non_secure_jmp;
> +       jmp_buf non_secure_jmp;
>
>         /* On AArch64 we need to make sure we call our payload in < EL3 */
>         if (current_el() == 3) {
> -               if (setjmp(&non_secure_jmp))
> +               if (setjmp(non_secure_jmp))
>                         return;
>                 dcache_disable();       /* flush cache before switch to EL2 */
>
> --
> 2.48.1
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data
  2025-03-02 14:21 ` [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data Heinrich Schuchardt
  2025-03-04 13:49   ` Jerome Forissier
@ 2025-03-04 13:51   ` Ilias Apalodimas
  1 sibling, 0 replies; 18+ messages in thread
From: Ilias Apalodimas @ 2025-03-04 13:51 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Jerome Forissier, Simon Glass, Philipp Tomsich,
	Kever Yang, Rick Chen, Leo, Bin Meng, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot

On Sun, 2 Mar 2025 at 14:22, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> From: Yao Zi <ziyao@disroot.org>
>
> Structure jmp_buf_data provides the underlying format of jmp_buf, which
> we actually don't care about. Clean up existing code to use the standard
> jmp_buf type. This introduces no functional change.
>
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
>  include/efi_loader.h          | 4 ++--
>  lib/efi_loader/efi_boottime.c | 9 ++++-----
>  2 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 1d75d97ebbc..22b724f311a 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -15,13 +15,13 @@
>  #include <efi_api.h>
>  #include <image.h>
>  #include <pe.h>
> +#include <setjmp.h>
>  #include <linux/list.h>
>  #include <linux/sizes.h>
>  #include <linux/oid_registry.h>
>
>  struct blk_desc;
>  struct bootflow;
> -struct jmp_buf_data;
>
>  #if CONFIG_IS_ENABLED(EFI_LOADER)
>
> @@ -485,7 +485,7 @@ struct efi_loaded_image_obj {
>         efi_status_t *exit_status;
>         efi_uintn_t *exit_data_size;
>         u16 **exit_data;
> -       struct jmp_buf_data *exit_jmp;
> +       jmp_buf *exit_jmp;
>         EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
>                                      struct efi_system_table *st);
>         u16 image_type;
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index bdf9e7e8066..853a1c8c097 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -21,7 +21,6 @@
>  #include <usb.h>
>  #include <watchdog.h>
>  #include <asm/global_data.h>
> -#include <setjmp.h>
>  #include <linux/libfdt_env.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -3199,7 +3198,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>         void *info;
>         efi_handle_t parent_image = current_image;
>         efi_status_t exit_status;
> -       struct jmp_buf_data exit_jmp;
> +       jmp_buf exit_jmp;
>
>         EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
>
> @@ -3238,7 +3237,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>         }
>
>         /* call the image! */
> -       if (setjmp(&exit_jmp)) {
> +       if (setjmp(exit_jmp)) {
>                 /*
>                  * We called the entry point of the child image with EFI_CALL
>                  * in the lines below. The child image called the Exit() boot
> @@ -3444,7 +3443,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
>         struct efi_loaded_image *loaded_image_protocol;
>         struct efi_loaded_image_obj *image_obj =
>                 (struct efi_loaded_image_obj *)image_handle;
> -       struct jmp_buf_data *exit_jmp;
> +       jmp_buf *exit_jmp;
>
>         EFI_ENTRY("%p, %ld, %zu, %p", image_handle, exit_status,
>                   exit_data_size, exit_data);
> @@ -3511,7 +3510,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
>          */
>         efi_restore_gd();
>
> -       longjmp(exit_jmp, 1);
> +       longjmp(*exit_jmp, 1);
>
>         panic("EFI application exited");
>  out:
> --
> 2.48.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] arm: include asm-generic/int-ll64.h in setjmp.h
  2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
  2025-03-02 16:01   ` Yao Zi
  2025-03-04 13:48   ` Jerome Forissier
@ 2025-03-11 12:44   ` Ilias Apalodimas
  2 siblings, 0 replies; 18+ messages in thread
From: Ilias Apalodimas @ 2025-03-11 12:44 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Jerome Forissier, Simon Glass, Philipp Tomsich,
	Kever Yang, Rick Chen, Leo, Bin Meng, Matthias Brugger,
	Patrice Chotard, Adriano Cordova, Sughosh Ganu,
	Vincent Stehlé, Janne Grunau, Yao Zi, u-boot

On Sun, 2 Mar 2025 at 16:22, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Don't assume that u32 and u64 are already defined.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/arm/include/asm/setjmp.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
> index 662bec86321..9a7f5af9f8f 100644
> --- a/arch/arm/include/asm/setjmp.h
> +++ b/arch/arm/include/asm/setjmp.h
> @@ -7,6 +7,8 @@
>  #ifndef _SETJMP_H_
>  #define _SETJMP_H_     1
>
> +#include <asm-generic/int-ll64.h>
> +
>  /*
>   * This really should be opaque, but the EFI implementation wrongly
>   * assumes that a 'struct jmp_buf_data' is defined.
> --
> 2.48.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-03-11 12:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-02 14:21 [PATCH 0/5] common: clean up usage of structure jmp_buf_data Heinrich Schuchardt
2025-03-02 14:21 ` [PATCH 1/5] sandbox: remove linux/types.h dependency in setjmp.h Heinrich Schuchardt
2025-03-04 13:48   ` Jerome Forissier
2025-03-02 14:21 ` [PATCH 2/5] arm: include asm-generic/int-ll64.h " Heinrich Schuchardt
2025-03-02 16:01   ` Yao Zi
2025-03-02 16:18     ` Heinrich Schuchardt
2025-03-02 16:20       ` Yao Zi
2025-03-04 13:48   ` Jerome Forissier
2025-03-11 12:44   ` Ilias Apalodimas
2025-03-02 14:21 ` [PATCH 3/5] common: clean up setjmp.h Heinrich Schuchardt
2025-03-04 13:49   ` Jerome Forissier
2025-03-02 14:21 ` [PATCH 4/5] efi_loader: Clean up usage of structure jmp_buf_data Heinrich Schuchardt
2025-03-04 13:49   ` Jerome Forissier
2025-03-04 13:51   ` Ilias Apalodimas
2025-03-02 14:21 ` [PATCH 5/5] arm: use type jmp_buf instead of struct jmp_buf_data Heinrich Schuchardt
2025-03-04 13:49   ` Jerome Forissier
2025-03-04 13:51   ` Ilias Apalodimas
2025-03-04  9:10 ` [PATCH 0/5] common: clean up usage of structure jmp_buf_data Jerome Forissier

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.