jmpbuf-unwind.h 866 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * This file is subject to the terms and conditions of the LGPL V2.1
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2019 Kalray Inc.
  7. */
  8. #include <setjmp.h>
  9. #include <jmpbuf-offsets.h>
  10. /* Test if longjmp to JMPBUF would unwind the frame
  11. containing a local variable at ADDRESS. */
  12. #if __WORDSIZE == 64
  13. # define _JMPBUF_UNWINDS(jmpbuf, address) \
  14. ((void *) (address) < (void *) (jmpbuf)[JB_R12])
  15. #else
  16. #error 32-bit unsupported
  17. #endif
  18. #ifdef __UCLIBC_HAS_THREADS_NATIVE__
  19. #include <stdint.h>
  20. #include <unwind.h>
  21. #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
  22. _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
  23. #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
  24. ((uintptr_t) (_address) - (_adj) < (uintptr_t) _jmpbuf_sp(_jmpbuf) - (_adj))
  25. #endif