jmpbuf-unwind.h 966 B

12345678910111213141516171819202122232425262728293031
  1. /* Examine __jmp_buf for unwinding frames. LoongArch64 version.
  2. Copyright (C) 2024 uClibc-ng contributors.
  3. Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. #include <setjmp.h>
  6. #include <stdint.h>
  7. #include <unwind.h>
  8. #include <sysdep.h>
  9. /* Test if longjmp to JMPBUF would unwind the frame
  10. containing a local variable at ADDRESS. */
  11. #define _JMPBUF_UNWINDS(jmpbuf, address) \
  12. ((void *) (address) < (void *) ((jmpbuf)[0].__sp))
  13. #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
  14. _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
  15. static inline uintptr_t __attribute__ ((unused))
  16. _jmpbuf_sp (__jmp_buf regs)
  17. {
  18. uintptr_t sp = regs[0].__sp;
  19. return sp;
  20. }
  21. #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
  22. ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
  23. /* We use the normal longjmp for unwinding. */
  24. #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)