summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/nds32/jmpbuf-unwind.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/nds32/jmpbuf-unwind.h')
-rw-r--r--libc/sysdeps/linux/nds32/jmpbuf-unwind.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/nds32/jmpbuf-unwind.h b/libc/sysdeps/linux/nds32/jmpbuf-unwind.h
index 14a302969..8499e99b4 100644
--- a/libc/sysdeps/linux/nds32/jmpbuf-unwind.h
+++ b/libc/sysdeps/linux/nds32/jmpbuf-unwind.h
@@ -5,8 +5,24 @@
#include <setjmp.h>
#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
#define _JMPBUF_UNWINDS(jmpbuf, address) \
- ((void *) (address) < (void *) &(jmpbuf)[0].__regs[__JMP_BUF_SP])
+ ((void *) (address) < &(jmpbuf)[0].__regs[__JMP_BUF_SP])
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+ uintptr_t sp = &(regs)[0].__regs[__JMP_BUF_SP];
+ return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+ ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))