aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-09-12 14:17:20 +0100
committerMichael Brown <mcb30@ipxe.org>2024-09-12 15:01:04 +0100
commit5de5d4626e192f5d0e6c97e14ce03b92a43622b3 (patch)
tree3947d6e1f9b5c877140006f248147f2e503e8e41
parenta1830ff43c5f8ee2957eb537f24670265ebd233b (diff)
downloadipxe-5de5d4626e192f5d0e6c97e14ce03b92a43622b3.tar.gz
[libc] Centralise architecture-independent portions of setjmp.h
The definitions of the setjmp() and longjmp() functions are common to all architectures, with only the definition of the jump buffer structure being architecture-specific. Move the architecture-specific portions to bits/setjmp.h and provide a common setjmp.h for the function definitions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/arch/arm32/include/bits/setjmp.h (renamed from src/arch/arm32/include/setjmp.h)12
-rw-r--r--src/arch/arm64/include/bits/setjmp.h (renamed from src/arch/arm64/include/setjmp.h)12
-rw-r--r--src/arch/i386/include/bits/setjmp.h (renamed from src/arch/i386/include/setjmp.h)12
-rw-r--r--src/arch/loong64/include/bits/setjmp.h23
-rw-r--r--src/arch/x86_64/include/bits/setjmp.h (renamed from src/arch/x86_64/include/setjmp.h)12
-rw-r--r--src/include/setjmp.h (renamed from src/arch/loong64/include/setjmp.h)19
6 files changed, 36 insertions, 54 deletions
diff --git a/src/arch/arm32/include/setjmp.h b/src/arch/arm32/include/bits/setjmp.h
index 4828b47a2..9ee264ecd 100644
--- a/src/arch/arm32/include/setjmp.h
+++ b/src/arch/arm32/include/bits/setjmp.h
@@ -1,5 +1,5 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
@@ -29,10 +29,4 @@ typedef struct {
uint32_t lr;
} jmp_buf[1];
-extern int __asmcall __attribute__ (( returns_twice ))
-setjmp ( jmp_buf env );
-
-extern void __asmcall __attribute__ (( noreturn ))
-longjmp ( jmp_buf env, int val );
-
-#endif /* _SETJMP_H */
+#endif /* _BITS_SETJMP_H */
diff --git a/src/arch/arm64/include/setjmp.h b/src/arch/arm64/include/bits/setjmp.h
index 85a7a9cad..6ffd2fb0a 100644
--- a/src/arch/arm64/include/setjmp.h
+++ b/src/arch/arm64/include/bits/setjmp.h
@@ -1,5 +1,5 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
@@ -35,10 +35,4 @@ typedef struct {
uint64_t sp;
} jmp_buf[1];
-extern int __asmcall __attribute__ (( returns_twice ))
-setjmp ( jmp_buf env );
-
-extern void __asmcall __attribute__ (( noreturn ))
-longjmp ( jmp_buf env, int val );
-
-#endif /* _SETJMP_H */
+#endif /* _BITS_SETJMP_H */
diff --git a/src/arch/i386/include/setjmp.h b/src/arch/i386/include/bits/setjmp.h
index 98566696a..6b2ec9613 100644
--- a/src/arch/i386/include/setjmp.h
+++ b/src/arch/i386/include/bits/setjmp.h
@@ -1,5 +1,5 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
@@ -21,10 +21,4 @@ typedef struct {
uint32_t ebp;
} jmp_buf[1];
-extern int __asmcall __attribute__ (( returns_twice ))
-setjmp ( jmp_buf env );
-
-extern void __asmcall __attribute__ (( noreturn ))
-longjmp ( jmp_buf env, int val );
-
-#endif /* _SETJMP_H */
+#endif /* _BITS_SETJMP_H */
diff --git a/src/arch/loong64/include/bits/setjmp.h b/src/arch/loong64/include/bits/setjmp.h
new file mode 100644
index 000000000..c8d7cef0e
--- /dev/null
+++ b/src/arch/loong64/include/bits/setjmp.h
@@ -0,0 +1,23 @@
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+/** A jump buffer */
+typedef struct {
+ uint64_t s0;
+ uint64_t s1;
+ uint64_t s2;
+ uint64_t s3;
+ uint64_t s4;
+ uint64_t s5;
+ uint64_t s6;
+ uint64_t s7;
+ uint64_t s8;
+
+ uint64_t fp;
+ uint64_t sp;
+ uint64_t ra;
+} jmp_buf[1];
+
+#endif /* _BITS_SETJMP_H */
diff --git a/src/arch/x86_64/include/setjmp.h b/src/arch/x86_64/include/bits/setjmp.h
index 69835d9fa..adfb869ea 100644
--- a/src/arch/x86_64/include/setjmp.h
+++ b/src/arch/x86_64/include/bits/setjmp.h
@@ -1,5 +1,5 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
@@ -25,10 +25,4 @@ typedef struct {
uint64_t r15;
} jmp_buf[1];
-extern int __asmcall __attribute__ (( returns_twice ))
-setjmp ( jmp_buf env );
-
-extern void __asmcall __attribute__ (( noreturn ))
-longjmp ( jmp_buf env, int val );
-
-#endif /* _SETJMP_H */
+#endif /* _BITS_SETJMP_H */
diff --git a/src/arch/loong64/include/setjmp.h b/src/include/setjmp.h
index 1e5168338..d8cd02f46 100644
--- a/src/arch/loong64/include/setjmp.h
+++ b/src/include/setjmp.h
@@ -3,24 +3,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-#include <stdint.h>
-
-/** jump buffer env*/
-typedef struct {
- uint64_t s0;
- uint64_t s1;
- uint64_t s2;
- uint64_t s3;
- uint64_t s4;
- uint64_t s5;
- uint64_t s6;
- uint64_t s7;
- uint64_t s8;
-
- uint64_t fp;
- uint64_t sp;
- uint64_t ra;
-} jmp_buf[1];
+#include <bits/setjmp.h>
extern int __asmcall __attribute__ (( returns_twice ))
setjmp ( jmp_buf env );