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 
9 #ifndef _BITS_SETJMP_H
10 #define _BITS_SETJMP_H  1
11 
12 #if !defined _SETJMP_H && !defined _PTHREAD_H
13 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
14 #endif
15 
16 #define SIZE_OF_REG 8
17 
18 /* Size of a quad reg (can't use sizeof(uint64_t) since it will be in asm */
19 #define QUAD_REG_SIZE (4 * SIZE_OF_REG)
20 
21 
22 #define JMPBUF_RA_CS_OFFSET  0
23 #define JMPBUF_LC_LE_LS_OFFSET (2 * SIZE_OF_REG)
24 /* Start offset of  regs[] in __jmp_buf struct */
25 #define JMPBUF_REGS_OFFSET   (JMPBUF_LC_LE_LS_OFFSET + (4 * SIZE_OF_REG))
26 
27 #ifndef _ASM
28 typedef struct
29   {
30     /* Return address */
31     unsigned long ra;
32     unsigned long cs;
33 
34     /* Store lc, le, ls into this buf */
35     unsigned long lc_le_ls[4];
36 
37     /* Callee-saved GPR registers:
38      * r12(sp) r14 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31
39      */
40     unsigned long regs[16];
41 
42   } __jmp_buf[1] __attribute__((__aligned__ (8)));
43 
44 #endif
45 
46 #endif  /* bits/setjmp.h */
47