• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ARM64_DEFINE_H
16 #define UNWIND_ARM64_DEFINE_H
17 
18 #include <cinttypes>
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS {
23 namespace HiviewDFX {
24 #define REGS_PRINT_LEN 1024
25 #define DWARF_PRESERVED_REGS_NUM 97
26 
27 enum RegsEnumArm64 : uint16_t {
28     REG_AARCH64_X0 = 0,
29     REG_AARCH64_X1,
30     REG_AARCH64_X2,
31     REG_AARCH64_X3,
32     REG_AARCH64_X4,
33     REG_AARCH64_X5,
34     REG_AARCH64_X6,
35     REG_AARCH64_X7,
36     REG_AARCH64_X8,
37     REG_AARCH64_X9,
38     REG_AARCH64_X10,
39     REG_AARCH64_X11,
40     REG_AARCH64_X12,
41     REG_AARCH64_X13,
42     REG_AARCH64_X14,
43     REG_AARCH64_X15,
44     REG_AARCH64_X16,
45     REG_AARCH64_X17,
46     REG_AARCH64_X18,
47     REG_AARCH64_X19,
48     REG_AARCH64_X20,
49     REG_AARCH64_X21,
50     REG_AARCH64_X22,
51     REG_AARCH64_X23,
52     REG_AARCH64_X24,
53     REG_AARCH64_X25,
54     REG_AARCH64_X26,
55     REG_AARCH64_X27,
56     REG_AARCH64_X28,
57     REG_AARCH64_X29,
58     REG_AARCH64_X30,
59     REG_AARCH64_X31,
60     REG_AARCH64_PC,
61     REG_AARCH64_PSTATE,
62     REG_AARCH64_ESR,
63     REG_AARCH64_LAST,
64 
65     REG_SP = REG_AARCH64_X31,
66     REG_LR = REG_AARCH64_X30,
67     REG_FP = REG_AARCH64_X29,
68     REG_PC = REG_AARCH64_PC,
69     REG_EH = REG_AARCH64_X0,
70     REG_LAST = REG_AARCH64_LAST,
71 };
72 
73 static const std::vector<uint16_t> QUT_REGS {
74     REG_AARCH64_X0,
75     REG_AARCH64_X29,
76     REG_SP,
77     REG_PC,
78     REG_LR,
79 };
80 
81 struct RegsUserArm64 {
82     uint64_t regs[31]; // 31
83     uint64_t sp;
84     uint64_t pc;
85     uint64_t pstate;
86 };
87 
88 typedef struct UnwindUContext {
89     RegsUserArm64 userRegs;
90 } UnwindUContext_t;
91 } // namespace HiviewDFX
92 } // namespace OHOS
93 #endif
94