1
2
3
4
5
6
7
8#define UNW_VER(x) ((x) >> 48)
9#define UNW_FLAG_MASK 0x0000ffff00000000
10#define UNW_FLAG_OSMASK 0x0000f00000000000
11#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L)
12#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L)
13#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL)
14
15enum unw_register_index {
16
17 UNW_REG_PRI_UNAT_GR,
18 UNW_REG_PRI_UNAT_MEM,
19
20
21 UNW_REG_BSP,
22 UNW_REG_BSPSTORE,
23 UNW_REG_PFS,
24 UNW_REG_RNAT,
25
26 UNW_REG_PSP,
27
28 UNW_REG_RP,
29
30
31 UNW_REG_R4, UNW_REG_R5, UNW_REG_R6, UNW_REG_R7,
32 UNW_REG_UNAT, UNW_REG_PR, UNW_REG_LC, UNW_REG_FPSR,
33 UNW_REG_B1, UNW_REG_B2, UNW_REG_B3, UNW_REG_B4, UNW_REG_B5,
34 UNW_REG_F2, UNW_REG_F3, UNW_REG_F4, UNW_REG_F5,
35 UNW_REG_F16, UNW_REG_F17, UNW_REG_F18, UNW_REG_F19,
36 UNW_REG_F20, UNW_REG_F21, UNW_REG_F22, UNW_REG_F23,
37 UNW_REG_F24, UNW_REG_F25, UNW_REG_F26, UNW_REG_F27,
38 UNW_REG_F28, UNW_REG_F29, UNW_REG_F30, UNW_REG_F31,
39 UNW_NUM_REGS
40};
41
42struct unw_info_block {
43 u64 header;
44 u64 desc[0];
45
46};
47
48struct unw_table {
49 struct unw_table *next;
50 const char *name;
51 unsigned long gp;
52 unsigned long segment_base;
53 unsigned long start;
54 unsigned long end;
55 const struct unw_table_entry *array;
56 unsigned long length;
57};
58
59enum unw_where {
60 UNW_WHERE_NONE,
61 UNW_WHERE_GR,
62 UNW_WHERE_FR,
63 UNW_WHERE_BR,
64 UNW_WHERE_SPREL,
65 UNW_WHERE_PSPREL,
66
67
68
69
70 UNW_WHERE_SPILL_HOME,
71 UNW_WHERE_GR_SAVE
72};
73
74#define UNW_WHEN_NEVER 0x7fffffff
75
76struct unw_reg_info {
77 unsigned long val;
78 enum unw_where where;
79 int when;
80};
81
82struct unw_reg_state {
83 struct unw_reg_state *next;
84 struct unw_reg_info reg[UNW_NUM_REGS];
85};
86
87struct unw_labeled_state {
88 struct unw_labeled_state *next;
89 unsigned long label;
90 struct unw_reg_state saved_state;
91};
92
93struct unw_state_record {
94 unsigned int first_region : 1;
95 unsigned int done : 1;
96 unsigned int any_spills : 1;
97 unsigned int in_body : 1;
98 unsigned long flags;
99
100 u8 *imask;
101 unsigned long pr_val;
102 unsigned long pr_mask;
103 long spill_offset;
104 int region_start;
105 int region_len;
106 int epilogue_start;
107 int epilogue_count;
108 int when_target;
109
110 u8 gr_save_loc;
111 u8 return_link_reg;
112
113 struct unw_labeled_state *labeled_states;
114 struct unw_reg_state curr;
115};
116
117enum unw_nat_type {
118 UNW_NAT_NONE,
119 UNW_NAT_VAL,
120 UNW_NAT_MEMSTK,
121 UNW_NAT_REGSTK
122};
123
124enum unw_insn_opcode {
125 UNW_INSN_ADD,
126 UNW_INSN_ADD_PSP,
127 UNW_INSN_ADD_SP,
128 UNW_INSN_MOVE,
129 UNW_INSN_MOVE2,
130 UNW_INSN_MOVE_STACKED,
131 UNW_INSN_SETNAT_MEMSTK,
132
133 UNW_INSN_SETNAT_TYPE,
134 UNW_INSN_LOAD,
135 UNW_INSN_MOVE_SCRATCH,
136 UNW_INSN_MOVE_CONST,
137};
138
139struct unw_insn {
140 unsigned int opc : 4;
141 unsigned int dst : 9;
142 signed int val : 19;
143};
144
145
146
147
148
149
150
151#define UNW_MAX_SCRIPT_LEN (UNW_NUM_REGS + 5)
152
153struct unw_script {
154 unsigned long ip;
155 unsigned long pr_mask;
156 unsigned long pr_val;
157 rwlock_t lock;
158 unsigned int flags;
159 unsigned short lru_chain;
160 unsigned short coll_chain;
161 unsigned short hint;
162 unsigned short count;
163 struct unw_insn insn[UNW_MAX_SCRIPT_LEN];
164};
165