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