[PR target/115123] Fix testsuite fallout from sinking heuristic change
[gcc.git] / libphobos / libdruntime / gcc / unwind / arm.d
blob9344b0536c7a92b4e4675893ddc6eb2865c3f6e7
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
7 // version.
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.
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;
28 import gcc.config;
30 version (ARM):
31 static if (GNU_ARM_EABI_Unwinder):
33 public import gcc.unwind.arm_common;
34 import gcc.unwind.pe;
36 extern (C):
37 @nogc:
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;
43 version (linux)
44 enum _TTYPE_ENCODING = (DW_EH_PE_pcrel | DW_EH_PE_indirect);
45 else version (NetBSD)
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);
53 else
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)
69 *ip_before_insn = 0;
70 return _Unwind_GetIP(context);