1 /* Copyright (C) 2006-2022 Free Software Foundation, Inc.
2 
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public License as
7    published by the Free Software Foundation; either version 2.1 of the
8    License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #define JB_X19            0
20 #define JB_X20            1
21 #define JB_X21            2
22 #define JB_X22            3
23 #define JB_X23            4
24 #define JB_X24            5
25 #define JB_X25            6
26 #define JB_X26            7
27 #define JB_X27            8
28 #define JB_X28            9
29 #define JB_X29           10
30 #define JB_LR            11
31 #define JB_SP		 13
32 
33 #define JB_D8		 14
34 #define JB_D9		 15
35 #define JB_D10		 16
36 #define JB_D11		 17
37 #define JB_D12		 18
38 #define JB_D13		 19
39 #define JB_D14		 20
40 #define JB_D15		 21
41 
42 #ifndef  __ASSEMBLER__
43 #include <setjmp.h>
44 #include <stdint.h>
45 #include <sysdep.h>
46 
47 static inline uintptr_t __attribute__ ((unused))
_jmpbuf_sp(__jmp_buf jmpbuf)48 _jmpbuf_sp (__jmp_buf jmpbuf)
49 {
50   uintptr_t sp = jmpbuf[JB_SP];
51 #ifdef PTR_DEMANGLE
52   PTR_DEMANGLE (sp);
53 #endif
54   return sp;
55 }
56 #endif
57 
58 /* Helper for generic ____longjmp_chk(). */
59 #define JB_FRAME_ADDRESS(buf) \
60   ((void *) _jmpbuf_sp (buf))
61