1 /*
2  * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
3  *
4  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
5  * in this tarball.
6  */
7 
8 #include <setjmp.h>
9 #include <stdint.h>
10 #include <unwind.h>
11 
12 /* Test if longjmp to JMPBUF would unwind the frame
13    containing a local variable at ADDRESS.  */
14 #define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
15   ((void *) (address) < (void *) demangle (jmpbuf[0].__sp))
16 
17 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
18   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
19 
20 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
21   ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf[0].__sp) - (_adj))
22 
23