1 //===--- ARMEHABI.h - ARM Exception Handling ABI ----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines the constants for the ARM unwind opcodes and exception 10 // handling table entry kinds. 11 // 12 // The enumerations and constants in this file reflect the ARM EHABI 13 // Specification as published by ARM. 14 // 15 // Exception Handling ABI for the ARM Architecture r2.09 - November 30, 2012 16 // 17 // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf 18 // 19 //===----------------------------------------------------------------------===// 20 21 #ifndef LLVM_SUPPORT_ARMEHABI_H 22 #define LLVM_SUPPORT_ARMEHABI_H 23 24 namespace llvm { 25 namespace ARM { 26 namespace EHABI { 27 /// ARM exception handling table entry kinds 28 enum EHTEntryKind { 29 EHT_GENERIC = 0x00, 30 EHT_COMPACT = 0x80 31 }; 32 33 enum { 34 /// Special entry for the function never unwind 35 EXIDX_CANTUNWIND = 0x1 36 }; 37 38 /// ARM-defined frame unwinding opcodes 39 enum UnwindOpcodes { 40 // Format: 00xxxxxx 41 // Purpose: vsp = vsp + ((x << 2) + 4) 42 UNWIND_OPCODE_INC_VSP = 0x00, 43 44 // Format: 01xxxxxx 45 // Purpose: vsp = vsp - ((x << 2) + 4) 46 UNWIND_OPCODE_DEC_VSP = 0x40, 47 48 // Format: 10000000 00000000 49 // Purpose: refuse to unwind 50 UNWIND_OPCODE_REFUSE = 0x8000, 51 52 // Format: 1000xxxx xxxxxxxx 53 // Purpose: pop r[15:12], r[11:4] 54 // Constraint: x != 0 55 UNWIND_OPCODE_POP_REG_MASK_R4 = 0x8000, 56 57 // Format: 1001xxxx 58 // Purpose: vsp = r[x] 59 // Constraint: x != 13 && x != 15 60 UNWIND_OPCODE_SET_VSP = 0x90, 61 62 // Format: 10100xxx 63 // Purpose: pop r[(4+x):4] 64 UNWIND_OPCODE_POP_REG_RANGE_R4 = 0xa0, 65 66 // Format: 10101xxx 67 // Purpose: pop r14, r[(4+x):4] 68 UNWIND_OPCODE_POP_REG_RANGE_R4_R14 = 0xa8, 69 70 // Format: 10110000 71 // Purpose: finish 72 UNWIND_OPCODE_FINISH = 0xb0, 73 74 // Format: 10110100 75 // Purpose: Pop Return Address Authetication Code 76 UNWIND_OPCODE_POP_RA_AUTH_CODE = 0xb4, 77 78 // Format: 10110001 0000xxxx 79 // Purpose: pop r[3:0] 80 // Constraint: x != 0 81 UNWIND_OPCODE_POP_REG_MASK = 0xb100, 82 83 // Format: 10110010 x(uleb128) 84 // Purpose: vsp = vsp + ((x << 2) + 0x204) 85 UNWIND_OPCODE_INC_VSP_ULEB128 = 0xb2, 86 87 // Format: 10110011 xxxxyyyy 88 // Purpose: pop d[(x+y):x] 89 UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX = 0xb300, 90 91 // Format: 10111xxx 92 // Purpose: pop d[(8+x):8] 93 UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX_D8 = 0xb8, 94 95 // Format: 11000xxx 96 // Purpose: pop wR[(10+x):10] 97 UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE_WR10 = 0xc0, 98 99 // Format: 11000110 xxxxyyyy 100 // Purpose: pop wR[(x+y):x] 101 UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE = 0xc600, 102 103 // Format: 11000111 0000xxxx 104 // Purpose: pop wCGR[3:0] 105 // Constraint: x != 0 106 UNWIND_OPCODE_POP_WIRELESS_MMX_REG_MASK = 0xc700, 107 108 // Format: 11001000 xxxxyyyy 109 // Purpose: pop d[(16+x+y):(16+x)] 110 UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D16 = 0xc800, 111 112 // Format: 11001001 xxxxyyyy 113 // Purpose: pop d[(x+y):x] 114 UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD = 0xc900, 115 116 // Format: 11010xxx 117 // Purpose: pop d[(8+x):8] 118 UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D8 = 0xd0 119 }; 120 121 /// ARM-defined Personality Routine Index 122 enum PersonalityRoutineIndex { 123 // To make the exception handling table become more compact, ARM defined 124 // several personality routines in EHABI. There are 3 different 125 // personality routines in ARM EHABI currently. It is possible to have 16 126 // pre-defined personality routines at most. 127 AEABI_UNWIND_CPP_PR0 = 0, 128 AEABI_UNWIND_CPP_PR1 = 1, 129 AEABI_UNWIND_CPP_PR2 = 2, 130 131 NUM_PERSONALITY_INDEX 132 }; 133 } 134 } 135 } 136 137 #endif 138