jmpbuf-offsets.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Private macros for accessing __jmp_buf contents. Nios II version.
  2. Copyright (C) 2006-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <http://www.gnu.org/licenses/>. */
  15. /* Save offsets within __jmp_buf. */
  16. #define JB_R16 0
  17. #define JB_R17 1
  18. #define JB_R18 2
  19. #define JB_R19 3
  20. #define JB_R20 4
  21. #define JB_R21 5
  22. #define JB_R22 6
  23. #define JB_FP 7
  24. #define JB_RA 8
  25. #define JB_SP 9
  26. #ifndef __ASSEMBLER__
  27. #include <setjmp.h>
  28. #include <stdint.h>
  29. #include <sysdep.h>
  30. static inline uintptr_t __attribute__ ((unused))
  31. _jmpbuf_sp (__jmp_buf jmpbuf)
  32. {
  33. uintptr_t sp = jmpbuf[JB_SP];
  34. #ifdef PTR_DEMANGLE
  35. PTR_DEMANGLE (sp);
  36. #endif
  37. return sp;
  38. }
  39. #endif
  40. /* Helper for generic ____longjmp_chk(). */
  41. #define JB_FRAME_ADDRESS(buf) ((void *) _jmpbuf_sp (buf))