1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef UNWIND_ARM_DEFINE_H
16 #define UNWIND_ARM_DEFINE_H
17 
18 #include <cinttypes>
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS {
23 namespace HiviewDFX {
24 #define REGS_PRINT_LEN 256
25 #define DWARF_PRESERVED_REGS_NUM 128
26 
27 enum RegsEnumArm : uint16_t {
28     REG_ARM_R0 = 0,
29     REG_ARM_R1,
30     REG_ARM_R2,
31     REG_ARM_R3,
32     REG_ARM_R4,
33     REG_ARM_R5,
34     REG_ARM_R6,
35     REG_ARM_R7,
36     REG_ARM_R8,
37     REG_ARM_R9,
38     REG_ARM_R10,
39     REG_ARM_R11,
40     REG_ARM_R12,
41     REG_ARM_R13,
42     REG_ARM_R14,
43     REG_ARM_R15,
44     REG_ARM_LAST,
45 
46     REG_FP = REG_ARM_R11,
47     REG_SP = REG_ARM_R13,
48     REG_LR = REG_ARM_R14,
49     REG_PC = REG_ARM_R15,
50     REG_EH = REG_ARM_R0,
51     REG_LAST = REG_ARM_LAST,
52 };
53 
54 static const std::vector<uint16_t> QUT_REGS {
55     REG_ARM_R7,
56     REG_ARM_R11,
57     REG_SP,
58     REG_PC,
59     REG_LR,
60 };
61 
62 struct RegsUserArm {
63     uint32_t regs[16]; // 16
64 };
65 
66 typedef struct UnwindUContext {
67     RegsUserArm userRegs;
68 } UnwindUContext_t;
69 } // namespace HiviewDFX
70 } // namespace OHOS
71 #endif
72