This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f0669ebd590 arch/arm64: Save d8-d15 in setjmp() and make jmp_buf hold
them.
f0669ebd590 is described below
commit f0669ebd590321594fffb7427f994eae6a98842c
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Oct 8 19:49:29 2026 +0200
arch/arm64: Save d8-d15 in setjmp() and make jmp_buf hold them.
arch_setjmp.S stores d8-d15 only under CONFIG_ARCH_FPU, but it did not
include nuttx/config.h. So setjmp() never saved these registers and
longjmp() never restored them. They are callee-saved (AAPCS64), so a
function that kept a value in one of them could see it change after a
longjmp().
Include nuttx/config.h. The assembly then stores d8-d15, eight bytes
each, at offsets 112 to 176. struct setjmp_buf_s declared them as
eight 4-byte floats, 32 bytes short, so declare them as uint64_t too.
jmp_buf is now 176 bytes with the FPU, and its layout matches the
assembly.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
arch/arm64/include/setjmp.h | 18 ++++++++++--------
libs/libc/machine/arm64/arch_setjmp.S | 6 ++++++
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/include/setjmp.h b/arch/arm64/include/setjmp.h
index dd5fcc6b72b..e2cdfa6c9cf 100644
--- a/arch/arm64/include/setjmp.h
+++ b/arch/arm64/include/setjmp.h
@@ -54,14 +54,16 @@ struct setjmp_buf_s
uint64_t gap;
#ifdef CONFIG_ARCH_FPU
- float q8;
- float q9;
- float q10;
- float q11;
- float q12;
- float q13;
- float q14;
- float q15;
+ /* The low 64 bits of v8-v15, the callee-saved FP registers */
+
+ uint64_t d8;
+ uint64_t d9;
+ uint64_t d10;
+ uint64_t d11;
+ uint64_t d12;
+ uint64_t d13;
+ uint64_t d14;
+ uint64_t d15;
#endif
};
diff --git a/libs/libc/machine/arm64/arch_setjmp.S
b/libs/libc/machine/arm64/arch_setjmp.S
index 6c9a9ef67c5..af435e38a96 100644
--- a/libs/libc/machine/arm64/arch_setjmp.S
+++ b/libs/libc/machine/arm64/arch_setjmp.S
@@ -29,6 +29,12 @@
*
****************************************************************************/
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
#define GPR_LAYOUT \
REG_PAIR (x19, x20, 0); \
REG_PAIR (x21, x22, 16); \