66 unw_decode_uleb128 (
unsigned char **dpp)
70 unsigned char *bp = *dpp;
75 result |= (byte & 0x7f) << shift;
76 if ((byte & 0x80) == 0)
84 static unsigned char *
85 unw_decode_x1 (
unsigned char *
dp,
unsigned char code,
void *
arg)
87 unsigned char byte1, abreg;
91 t = unw_decode_uleb128 (&dp);
92 off = unw_decode_uleb128 (&dp);
93 abreg = (byte1 & 0x7f);
101 static unsigned char *
102 unw_decode_x2 (
unsigned char *dp,
unsigned char code,
void *arg)
104 unsigned char byte1, byte2, abreg,
x, ytreg;
107 byte1 = *dp++; byte2 = *dp++;
108 t = unw_decode_uleb128 (&dp);
109 abreg = (byte1 & 0x7f);
111 x = (byte1 >> 7) & 1;
112 if ((byte1 & 0x80) == 0 && ytreg == 0)
119 static unsigned char *
120 unw_decode_x3 (
unsigned char *dp,
unsigned char code,
void *arg)
122 unsigned char byte1, byte2, abreg, qp;
125 byte1 = *dp++; byte2 = *dp++;
126 t = unw_decode_uleb128 (&dp);
127 off = unw_decode_uleb128 (&dp);
130 abreg = (byte2 & 0x7f);
139 static unsigned char *
140 unw_decode_x4 (
unsigned char *dp,
unsigned char code,
void *arg)
142 unsigned char byte1, byte2, byte3, qp, abreg,
x, ytreg;
145 byte1 = *dp++; byte2 = *dp++; byte3 = *dp++;
146 t = unw_decode_uleb128 (&dp);
149 abreg = (byte2 & 0x7f);
150 x = (byte2 >> 7) & 1;
153 if ((byte2 & 0x80) == 0 && byte3 == 0)
160 static unsigned char *
161 unw_decode_r1 (
unsigned char *dp,
unsigned char code,
void *arg)
163 int body = (code & 0x20) != 0;
166 rlen = (code & 0x1f);
171 static unsigned char *
172 unw_decode_r2 (
unsigned char *dp,
unsigned char code,
void *arg)
174 unsigned char byte1,
mask, grsave;
179 mask = ((code & 0x7) << 1) | ((byte1 >> 7) & 1);
180 grsave = (byte1 & 0x7f);
181 rlen = unw_decode_uleb128 (&dp);
186 static unsigned char *
187 unw_decode_r3 (
unsigned char *dp,
unsigned char code,
void *arg)
191 rlen = unw_decode_uleb128 (&dp);
196 static unsigned char *
197 unw_decode_p1 (
unsigned char *dp,
unsigned char code,
void *arg)
199 unsigned char brmask = (code & 0x1f);
205 static unsigned char *
206 unw_decode_p2_p5 (
unsigned char *dp,
unsigned char code,
void *arg)
208 if ((code & 0x10) == 0)
210 unsigned char byte1 = *dp++;
213 (byte1 & 0x7f), arg);
215 else if ((code & 0x08) == 0)
217 unsigned char byte1 = *dp++,
r,
dst;
219 r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1);
220 dst = (byte1 & 0x7f);
238 else if ((code & 0x7) == 0)
240 else if ((code & 0x7) == 1)
242 unw_word grmask, frmask, byte1, byte2, byte3;
244 byte1 = *dp++; byte2 = *dp++; byte3 = *dp++;
245 grmask = ((byte1 >> 4) & 0xf);
246 frmask = ((byte1 & 0xf) << 16) | (byte2 << 8) | byte3;
254 static unsigned char *
255 unw_decode_p6 (
unsigned char *dp,
unsigned char code,
void *arg)
257 int gregs = (code & 0x10) != 0;
258 unsigned char mask = (code & 0x0f);
267 static unsigned char *
268 unw_decode_p7_p10 (
unsigned char *dp,
unsigned char code,
void *arg)
270 unsigned char r, byte1, byte2;
273 if ((code & 0x10) == 0)
276 t = unw_decode_uleb128 (&dp);
280 size = unw_decode_uleb128 (&dp);
309 t = unw_decode_uleb128 (&dp);
337 byte1 = *dp++; byte2 = *dp++;
342 byte1 = *dp++; byte2 = *dp++;
347 return unw_decode_x1 (dp, code, arg);
350 return unw_decode_x2 (dp, code, arg);
353 return unw_decode_x3 (dp, code, arg);
356 return unw_decode_x4 (dp, code, arg);
366 static unsigned char *
367 unw_decode_b1 (
unsigned char *dp,
unsigned char code,
void *arg)
371 if ((code & 0x20) != 0)
378 static unsigned char *
379 unw_decode_b2 (
unsigned char *dp,
unsigned char code,
void *arg)
383 t = unw_decode_uleb128 (&dp);
388 static unsigned char *
389 unw_decode_b3_x4 (
unsigned char *dp,
unsigned char code,
void *arg)
393 if ((code & 0x10) == 0)
395 t = unw_decode_uleb128 (&dp);
396 ecount = unw_decode_uleb128 (&dp);
399 else if ((code & 0x07) == 0)
401 label = unw_decode_uleb128 (&dp);
402 if ((code & 0x08) != 0)
410 case 1:
return unw_decode_x1 (dp, code, arg);
411 case 2:
return unw_decode_x2 (dp, code, arg);
412 case 3:
return unw_decode_x3 (dp, code, arg);
413 case 4:
return unw_decode_x4 (dp, code, arg);
419 typedef unsigned char *(*unw_decoder) (
unsigned char *,
unsigned char,
void *);
449 static inline unsigned char *
450 unw_decode (
unsigned char *dp,
int inside_body,
void *arg)
456 decoder = unw_decode_table[inside_body][code >> 5];