1 // Exception handling and frame unwind runtime interface routines.
2 // Copyright (C) 2011-2025 Free Software Foundation, Inc.
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
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
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.
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/>.
23 // extern(C) interface for the ARM EABI unwinder library.
24 // This corresponds to unwind-arm.h
26 module gcc
.unwind
.arm
;
31 static if (GNU_ARM_EABI_Unwinder
):
33 public import gcc
.unwind
.arm_common
;
39 enum int UNWIND_STACK_REG
= 13;
40 // Use IP as a scratch register within the personality routine.
41 enum int UNWIND_POINTER_REG
= 12;
44 enum _TTYPE_ENCODING
= (DW_EH_PE_pcrel | DW_EH_PE_indirect
);
46 enum _TTYPE_ENCODING
= (DW_EH_PE_pcrel | DW_EH_PE_indirect
);
47 else version (FreeBSD
)
48 enum _TTYPE_ENCODING
= (DW_EH_PE_pcrel | DW_EH_PE_indirect
);
49 else version (Symbian
)
50 enum _TTYPE_ENCODING
= (DW_EH_PE_absptr
);
51 else version (uClinux
)
52 enum _TTYPE_ENCODING
= (DW_EH_PE_absptr
);
54 enum _TTYPE_ENCODING
= (DW_EH_PE_pcrel
);
56 // Return the address of the instruction, not the actual IP value.
57 _Unwind_Word
_Unwind_GetIP(_Unwind_Context
* context
)
59 return _Unwind_GetGR(context
, 15) & ~ cast(_Unwind_Word
) 1;
62 void _Unwind_SetIP(_Unwind_Context
* context
, _Unwind_Word val
)
64 return _Unwind_SetGR(context
, 15, val |
(_Unwind_GetGR(context
, 15) & 1));
67 _Unwind_Word
_Unwind_GetIPInfo(_Unwind_Context
* context
, int* ip_before_insn
)
70 return _Unwind_GetIP(context
);