1 // Exception handling and frame unwind runtime interface routines.
2 // Copyright (C) 2011-2020 Free Software Foundation, Inc.
3 
4 // GCC is free software; you can redistribute it and/or modify it under
5 // the terms of the GNU General Public License as published by the Free
6 // Software Foundation; either version 3, or (at your option) any later
7 // version.
8 
9 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
10 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 // for more details.
13 
14 // You should have received a copy of the GNU General Public License
15 // along with GCC; see the file COPYING3.  If not see
16 // <http://www.gnu.org/licenses/>.
17 
18 // extern(C) interface for the C6X EABI unwinder library.
19 // This corresponds to unwind-c6x.h
20 
21 module gcc.unwind.c6x;
22 
23 import gcc.config;
24 
25 version (TIC6X):
26 static if (GNU_ARM_EABI_Unwinder):
27 
28 // Not really the ARM EABI, but pretty close.
29 public import gcc.unwind.arm_common;
30 
31 extern (C):
32 @nogc:
33 
34 enum int UNWIND_STACK_REG = 31;
35 // Use A0 as a scratch register within the personality routine.
36 enum int UNWIND_POINTER_REG = 0;
37 
_Unwind_GetIP(_Unwind_Context * context)38 _Unwind_Word _Unwind_GetIP(_Unwind_Context* context)
39 {
40     return _Unwind_GetGR(context, 33);
41 }
42 
_Unwind_SetIP(_Unwind_Context * context,_Unwind_Word val)43 void _Unwind_SetIP(_Unwind_Context* context, _Unwind_Word val)
44 {
45     return _Unwind_SetGR(context, 33, val);
46 }
47 
_Unwind_GetIPInfo(_Unwind_Context * context,int * ip_before_insn)48 _Unwind_Word _Unwind_GetIPInfo(_Unwind_Context* context, int* ip_before_insn)
49 {
50     *ip_before_insn = 0;
51     return _Unwind_GetIP(context);
52 }
53