setjmp.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2018 Kalray Inc.
  7. */
  8. #ifndef _BITS_SETJMP_H
  9. #define _BITS_SETJMP_H 1
  10. #if !defined _SETJMP_H && !defined _PTHREAD_H
  11. # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
  12. #endif
  13. #define SIZE_OF_REG 8
  14. /* Size of a quad reg (can't use sizeof(uint64_t) since it will be in asm */
  15. #define QUAD_REG_SIZE (4 * SIZE_OF_REG)
  16. #define JMPBUF_RA_CS_OFFSET 0
  17. #define JMPBUF_LC_LE_LS_OFFSET (2 * SIZE_OF_REG)
  18. /* Start offset of regs[] in __jmp_buf struct */
  19. #define JMPBUF_REGS_OFFSET (JMPBUF_LC_LE_LS_OFFSET + (4 * SIZE_OF_REG))
  20. #ifndef _ASM
  21. typedef struct
  22. {
  23. /* Return address */
  24. unsigned long ra;
  25. unsigned long cs;
  26. /* Store lc, le, ls into this buf */
  27. unsigned long lc_le_ls[4];
  28. /* Callee-saved GPR registers:
  29. * r12(sp) r14 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31
  30. */
  31. unsigned long regs[16];
  32. } __jmp_buf[1] __attribute__((__aligned__ (8)));
  33. #endif
  34. #endif /* bits/setjmp.h */