1 /* $NetBSD: decode.h,v 1.1 2006/04/07 14:21:37 cherry Exp $ */
3 /* Contributed to the NetBSD Foundation by Cherry G. Mathew <cherry@mahiti.org>
4 * This file contains prototypes to decode unwind descriptors.
7 #define MAXSTATERECS 20 /* The maximum number of descriptor records per region */
9 #define IS_R1(byte) (( (byte) & 0xc0) == 0)
10 #define IS_R2(byte) (((byte) & 0xf8) == 0x40)
11 #define IS_R3(byte) (((byte) & 0xfc) == 0x60)
12 #define IS_P1(byte) (((byte) & 0xe0) == 0x80)
13 #define IS_P2(byte) (((byte) & 0xf0) == 0xa0)
14 #define IS_P3(byte) (((byte) & 0xf8) == 0xb0)
15 #define IS_P4(byte) ((byte) == (char) 0xb8)
16 #define IS_P5(byte) ((byte) == (char) 0xb9)
17 #define IS_P6(byte) (((byte) & 0xe0) == 0xc0)
18 #define IS_P7(byte) (((byte) & 0xf0) == 0xe0)
19 #define IS_P8(byte) ((byte) == (char) 0xf0)
20 #define IS_P9(byte) ((byte) == (char) 0xf1)
21 #define IS_P10(byte) ((byte) ==(char) 0xff)
22 #define IS_B1(byte) (((byte) & 0xc0) == 0x80)
23 #define IS_B2(byte) (((byte) & 0xe0) == 0xc0)
24 #define IS_B3(byte) ((byte) == (char) 0xe0)
25 #define IS_B4(byte) (((byte) & 0xf7) == 0xf0)
26 #define IS_X1(byte) ((byte) == (char) 0xf9)
27 #define IS_X2(byte) ((byte) == (char) 0xfa)
28 #define IS_X3(byte) ((byte) == (char) 0xfb)
29 #define IS_X4(byte) ((byte) == (char) 0xfc)
31 struct unwind_desc_R1
{
36 struct unwind_desc_R2
{
46 struct unwind_desc_R3
{
51 struct unwind_desc_P1
{
55 struct unwind_desc_P2
{
60 struct unwind_desc_P3
{
65 struct unwind_desc_P4
{
69 struct unwind_desc_P5
{
74 struct unwind_desc_P6
{
79 struct unwind_desc_P7
{
85 struct unwind_desc_P8
{
90 struct unwind_desc_P9
{
95 struct unwind_desc_P10
{
100 struct unwind_desc_B1
{
105 struct unwind_desc_B2
{
110 struct unwind_desc_B3
{
115 struct unwind_desc_B4
{
120 struct unwind_desc_X1
{
129 struct unwind_desc_X2
{
141 struct unwind_desc_X3
{
151 struct unwind_desc_X4
{
163 struct unwind_desc_R1 R1
;
164 struct unwind_desc_R2 R2
;
165 struct unwind_desc_R3 R3
;
167 struct unwind_desc_P1 P1
;
168 struct unwind_desc_P2 P2
;
169 struct unwind_desc_P3 P3
;
170 struct unwind_desc_P4 P4
;
171 struct unwind_desc_P5 P5
;
172 struct unwind_desc_P6 P6
;
173 struct unwind_desc_P7 P7
;
174 struct unwind_desc_P8 P8
;
175 struct unwind_desc_P9 P9
;
176 struct unwind_desc_P10 P10
;
178 struct unwind_desc_B1 B1
;
179 struct unwind_desc_B2 B2
;
180 struct unwind_desc_B3 B3
;
181 struct unwind_desc_B4 B4
;
183 struct unwind_desc_X1 X1
;
184 struct unwind_desc_X2 X2
;
185 struct unwind_desc_X3 X3
;
186 struct unwind_desc_X4 X4
;
191 P1
, P2
, P3
, P4
, P5
, P6
, P7
, P8
, P9
, P10
,
197 /* A record chain is a decoded unwind descriptor.
198 * It is usefull for post processing unwind descriptors.
202 enum record_type type
;
203 union unwind_desc udesc
;
208 /* Decode Function prototypes. */
211 unwind_decode_ule128(char *buf
, unsigned long *);
213 unwind_decode_R1(char *buf
, union unwind_desc
*uwd
);
215 unwind_decode_R2(char *buf
, union unwind_desc
*uwd
);
217 unwind_decode_R3(char *buf
, union unwind_desc
*uwd
);
219 unwind_decode_P1(char *buf
, union unwind_desc
*uwd
);
221 unwind_decode_P2(char *buf
, union unwind_desc
*uwd
);
223 unwind_decode_P3(char *buf
, union unwind_desc
*uwd
);
225 unwind_decode_P4(char *buf
, union unwind_desc
*uwd
, vsize_t len
);
227 unwind_decode_P5(char *buf
, union unwind_desc
*uwd
);
229 unwind_decode_P6(char *buf
, union unwind_desc
*uwd
);
231 unwind_decode_P7(char *buf
, union unwind_desc
*uwd
);
233 unwind_decode_P8(char *buf
, union unwind_desc
*uwd
);
235 unwind_decode_P9(char *buf
, union unwind_desc
*uwd
);
237 unwind_decode_P10(char *buf
, union unwind_desc
*uwd
);
239 unwind_decode_B1(char *buf
, union unwind_desc
*uwd
);
241 unwind_decode_B2(char *buf
, union unwind_desc
*uwd
);
243 unwind_decode_B3(char *buf
, union unwind_desc
*uwd
);
245 unwind_decode_B4(char *buf
, union unwind_desc
*uwd
);
247 unwind_decode_X1(char *buf
, union unwind_desc
*uwd
);
249 unwind_decode_X2(char *buf
, union unwind_desc
*uwd
);
251 unwind_decode_X3(char *buf
, union unwind_desc
*uwd
);
253 unwind_decode_X4(char *buf
, union unwind_desc
*uwd
);