1 /* Header file for the C6X EABI unwinder
2    Copyright (C) 2011-2021 Free Software Foundation, Inc.
3 
4    This file is free software; you can redistribute it and/or modify it
5    under the terms of the GNU General Public License as published by the
6    Free Software Foundation; either version 3, or (at your option) any
7    later version.
8 
9    This file is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13 
14    Under Section 7 of GPL version 3, you are granted additional
15    permissions described in the GCC Runtime Library Exception, version
16    3.1, as published by the Free Software Foundation.
17 
18    You should have received a copy of the GNU General Public License and
19    a copy of the GCC Runtime Library Exception along with this program;
20    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
21    <http://www.gnu.org/licenses/>.  */
22 
23 /* Language-independent unwinder header public defines.  This contains both
24    ABI defined objects, and GNU support routines.  */
25 
26 #ifndef UNWIND_C6X_H
27 #define UNWIND_C6X_H
28 
29 /* Not really the ARM EABI, but pretty close.  */
30 #include "unwind-arm-common.h"
31 
32 #define UNWIND_STACK_REG 31
33 /* Use A0 as a scratch register within the personality routine.  */
34 #define UNWIND_POINTER_REG 0
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39   _Unwind_Reason_Code __gnu_unwind_24bit (_Unwind_Context *, _uw, int);
40 
41   /* Decode an EH table reference to a typeinfo object.  */
42   static inline _Unwind_Word
_Unwind_decode_typeinfo_ptr(_Unwind_Ptr base,_Unwind_Word ptr)43   _Unwind_decode_typeinfo_ptr (_Unwind_Ptr base, _Unwind_Word ptr)
44     {
45       _Unwind_Word tmp;
46 
47       tmp = *(_Unwind_Word *) ptr;
48       /* Zero values are always NULL.  */
49       if (!tmp)
50 	return 0;
51 
52       /* SB-relative indirect.  Propagate the bottom 2 bits, which can
53 	 contain referenceness information in gnu unwinding tables.  */
54       tmp += base;
55       tmp = *(_Unwind_Word *) (tmp & ~(_Unwind_Word)3) | (tmp & 3);
56       return tmp;
57     }
58 
59 #define _Unwind_GetIP(context) \
60   (_Unwind_GetGR (context, 33))
61 
62 
63 #define _Unwind_SetIP(context, val) \
64   _Unwind_SetGR (context, 33, val)
65 
66 #ifdef __cplusplus
67 }   /* extern "C" */
68 #endif
69 
70 #endif /* defined UNWIND_ARM_H */
71