|
@@ -33,18 +33,18 @@
|
33
|
33
|
*/
|
34
|
34
|
static bool isDataProc(uint32_t instr) {
|
35
|
35
|
|
36
|
|
- uint8_t opcode = (instr & 0x01e00000) >> 21;
|
|
36
|
+ uint8_t opcode = (instr & 0x01E00000) >> 21;
|
37
|
37
|
bool S = (instr & 0x00100000) ? true : false;
|
38
|
38
|
|
39
|
|
- if((instr & 0xfc000000) != 0xe0000000) {
|
|
39
|
+ if ((instr & 0xFC000000) != 0xE0000000) {
|
40
|
40
|
return false;
|
41
|
|
- } else
|
42
|
|
- if(!S && opcode >= 8 && opcode <= 11) {
|
|
41
|
+ }
|
|
42
|
+ else if (!S && opcode >= 8 && opcode <= 11) {
|
43
|
43
|
/* TST, TEQ, CMP and CMN all require S to be set */
|
44
|
44
|
return false;
|
45
|
|
- } else {
|
46
|
|
- return true;
|
47
|
45
|
}
|
|
46
|
+ else
|
|
47
|
+ return true;
|
48
|
48
|
}
|
49
|
49
|
|
50
|
50
|
UnwResult UnwStartArm(UnwState * const state) {
|
|
@@ -56,20 +56,20 @@ UnwResult UnwStartArm(UnwState * const state) {
|
56
|
56
|
uint32_t instr;
|
57
|
57
|
|
58
|
58
|
/* Attempt to read the instruction */
|
59
|
|
- if(!state->cb->readW(state->regData[15].v, &instr)) {
|
|
59
|
+ if (!state->cb->readW(state->regData[15].v, &instr)) {
|
60
|
60
|
return UNWIND_IREAD_W_FAIL;
|
61
|
61
|
}
|
62
|
62
|
|
63
|
63
|
UnwPrintd4("A %x %x %08x:", state->regData[13].v, state->regData[15].v, instr);
|
64
|
64
|
|
65
|
65
|
/* Check that the PC is still on Arm alignment */
|
66
|
|
- if(state->regData[15].v & 0x3) {
|
|
66
|
+ if (state->regData[15].v & 0x3) {
|
67
|
67
|
UnwPrintd1("\nError: PC misalignment\n");
|
68
|
68
|
return UNWIND_INCONSISTENT;
|
69
|
69
|
}
|
70
|
70
|
|
71
|
71
|
/* Check that the SP and PC have not been invalidated */
|
72
|
|
- if(!M_IsOriginValid(state->regData[13].o) || !M_IsOriginValid(state->regData[15].o)) {
|
|
72
|
+ if (!M_IsOriginValid(state->regData[13].o) || !M_IsOriginValid(state->regData[15].o)) {
|
73
|
73
|
UnwPrintd1("\nError: PC or SP invalidated\n");
|
74
|
74
|
return UNWIND_INCONSISTENT;
|
75
|
75
|
}
|
|
@@ -78,12 +78,12 @@ UnwResult UnwStartArm(UnwState * const state) {
|
78
|
78
|
* This is tested prior to data processing to prevent
|
79
|
79
|
* mis-interpretation as an invalid TEQ instruction.
|
80
|
80
|
*/
|
81
|
|
- if((instr & 0xfffffff0) == 0xe12fff10) {
|
82
|
|
- uint8_t rn = instr & 0xf;
|
|
81
|
+ if ((instr & 0xFFFFFFF0) == 0xE12FFF10) {
|
|
82
|
+ uint8_t rn = instr & 0xF;
|
83
|
83
|
|
84
|
84
|
UnwPrintd4("BX r%d\t ; r%d %s\n", rn, rn, M_Origin2Str(state->regData[rn].o));
|
85
|
85
|
|
86
|
|
- if(!M_IsOriginValid(state->regData[rn].o)) {
|
|
86
|
+ if (!M_IsOriginValid(state->regData[rn].o)) {
|
87
|
87
|
UnwPrintd1("\nUnwind failure: BX to untracked register\n");
|
88
|
88
|
return UNWIND_FAILURE;
|
89
|
89
|
}
|
|
@@ -92,19 +92,18 @@ UnwResult UnwStartArm(UnwState * const state) {
|
92
|
92
|
state->regData[15].v = state->regData[rn].v;
|
93
|
93
|
|
94
|
94
|
/* Check if the return value is from the stack */
|
95
|
|
- if(state->regData[rn].o == REG_VAL_FROM_STACK) {
|
|
95
|
+ if (state->regData[rn].o == REG_VAL_FROM_STACK) {
|
96
|
96
|
|
97
|
97
|
/* Now have the return address */
|
98
|
98
|
UnwPrintd2(" Return PC=%x\n", state->regData[15].v & (~0x1));
|
99
|
99
|
|
100
|
100
|
/* Report the return address */
|
101
|
|
- if(!UnwReportRetAddr(state, state->regData[rn].v)) {
|
102
|
|
- return UNWIND_TRUNCATED;
|
103
|
|
- }
|
|
101
|
+ if (!UnwReportRetAddr(state, state->regData[rn].v))
|
|
102
|
+ return UNWIND_TRUNCATED;
|
104
|
103
|
}
|
105
|
104
|
|
106
|
105
|
/* Determine the return mode */
|
107
|
|
- if(state->regData[rn].v & 0x1) {
|
|
106
|
+ if (state->regData[rn].v & 0x1) {
|
108
|
107
|
|
109
|
108
|
/* Branching to THUMB */
|
110
|
109
|
return UnwStartThumb(state);
|
|
@@ -118,16 +117,16 @@ UnwResult UnwStartArm(UnwState * const state) {
|
118
|
117
|
}
|
119
|
118
|
}
|
120
|
119
|
/* Branch */
|
121
|
|
- else if((instr & 0xff000000) == 0xea000000) {
|
|
120
|
+ else if ((instr & 0xFF000000) == 0xEA000000) {
|
122
|
121
|
|
123
|
|
- int32_t offset = (instr & 0x00ffffff);
|
|
122
|
+ int32_t offset = (instr & 0x00FFFFFF);
|
124
|
123
|
|
125
|
124
|
/* Shift value */
|
126
|
125
|
offset = offset << 2;
|
127
|
126
|
|
128
|
127
|
/* Sign extend if needed */
|
129
|
|
- if(offset & 0x02000000) {
|
130
|
|
- offset |= 0xfc000000;
|
|
128
|
+ if (offset & 0x02000000) {
|
|
129
|
+ offset |= 0xFC000000;
|
131
|
130
|
}
|
132
|
131
|
|
133
|
132
|
UnwPrintd2("B %d\n", offset);
|
|
@@ -142,11 +141,11 @@ UnwResult UnwStartArm(UnwState * const state) {
|
142
|
141
|
}
|
143
|
142
|
|
144
|
143
|
/* MRS */
|
145
|
|
- else if((instr & 0xffbf0fff) == 0xe10f0000) {
|
|
144
|
+ else if ((instr & 0xFFBF0FFF) == 0xE10F0000) {
|
146
|
145
|
#if defined(UNW_DEBUG)
|
147
|
146
|
bool R = (instr & 0x00400000) ? true : false;
|
148
|
147
|
#endif
|
149
|
|
- uint8_t rd = (instr & 0x0000f000) >> 12;
|
|
148
|
+ uint8_t rd = (instr & 0x0000F000) >> 12;
|
150
|
149
|
|
151
|
150
|
UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd);
|
152
|
151
|
|
|
@@ -154,7 +153,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
154
|
153
|
state->regData[rd].o = REG_VAL_INVALID;
|
155
|
154
|
}
|
156
|
155
|
/* MSR */
|
157
|
|
- else if((instr & 0xffb0f000) == 0xe120f000) {
|
|
156
|
+ else if ((instr & 0xFFB0F000) == 0xE120F000) {
|
158
|
157
|
#if defined(UNW_DEBUG)
|
159
|
158
|
bool R = (instr & 0x00400000) ? true : false;
|
160
|
159
|
|
|
@@ -170,15 +169,15 @@ UnwResult UnwStartArm(UnwState * const state) {
|
170
|
169
|
*/
|
171
|
170
|
}
|
172
|
171
|
/* Data processing */
|
173
|
|
- else if(isDataProc(instr)) {
|
|
172
|
+ else if (isDataProc(instr)) {
|
174
|
173
|
bool I = (instr & 0x02000000) ? true : false;
|
175
|
|
- uint8_t opcode = (instr & 0x01e00000) >> 21;
|
|
174
|
+ uint8_t opcode = (instr & 0x01E00000) >> 21;
|
176
|
175
|
#if defined(UNW_DEBUG)
|
177
|
176
|
bool S = (instr & 0x00100000) ? true : false;
|
178
|
177
|
#endif
|
179
|
|
- uint8_t rn = (instr & 0x000f0000) >> 16;
|
180
|
|
- uint8_t rd = (instr & 0x0000f000) >> 12;
|
181
|
|
- uint16_t operand2 = (instr & 0x00000fff);
|
|
178
|
+ uint8_t rn = (instr & 0x000F0000) >> 16;
|
|
179
|
+ uint8_t rd = (instr & 0x0000F000) >> 12;
|
|
180
|
+ uint16_t operand2 = (instr & 0x00000FFF);
|
182
|
181
|
uint32_t op2val;
|
183
|
182
|
int op2origin;
|
184
|
183
|
|
|
@@ -203,8 +202,8 @@ UnwResult UnwStartArm(UnwState * const state) {
|
203
|
202
|
|
204
|
203
|
/* Decode operand 2 */
|
205
|
204
|
if (I) {
|
206
|
|
- uint8_t shiftDist = (operand2 & 0x0f00) >> 8;
|
207
|
|
- uint8_t shiftConst = (operand2 & 0x00ff);
|
|
205
|
+ uint8_t shiftDist = (operand2 & 0x0F00) >> 8;
|
|
206
|
+ uint8_t shiftConst = (operand2 & 0x00FF);
|
208
|
207
|
|
209
|
208
|
/* rotate const right by 2 * shiftDist */
|
210
|
209
|
shiftDist *= 2;
|
|
@@ -217,7 +216,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
217
|
216
|
else {
|
218
|
217
|
|
219
|
218
|
/* Register and shift */
|
220
|
|
- uint8_t rm = (operand2 & 0x000f);
|
|
219
|
+ uint8_t rm = (operand2 & 0x000F);
|
221
|
220
|
uint8_t regShift = (operand2 & 0x0010) ? true : false;
|
222
|
221
|
uint8_t shiftType = (operand2 & 0x0060) >> 5;
|
223
|
222
|
uint32_t shiftDist;
|
|
@@ -227,16 +226,16 @@ UnwResult UnwStartArm(UnwState * const state) {
|
227
|
226
|
UnwPrintd2("r%d ", rm);
|
228
|
227
|
|
229
|
228
|
/* Get the shift distance */
|
230
|
|
- if(regShift) {
|
|
229
|
+ if (regShift) {
|
231
|
230
|
|
232
|
|
- uint8_t rs = (operand2 & 0x0f00) >> 8;
|
|
231
|
+ uint8_t rs = (operand2 & 0x0F00) >> 8;
|
233
|
232
|
|
234
|
|
- if(operand2 & 0x00800) {
|
|
233
|
+ if (operand2 & 0x00800) {
|
235
|
234
|
|
236
|
235
|
UnwPrintd1("\nError: Bit should be zero\n");
|
237
|
236
|
return UNWIND_ILLEGAL_INSTR;
|
238
|
237
|
}
|
239
|
|
- else if(rs == 15) {
|
|
238
|
+ else if (rs == 15) {
|
240
|
239
|
|
241
|
240
|
UnwPrintd1("\nError: Cannot use R15 with register shift\n");
|
242
|
241
|
return UNWIND_ILLEGAL_INSTR;
|
|
@@ -249,10 +248,10 @@ UnwResult UnwStartArm(UnwState * const state) {
|
249
|
248
|
UnwPrintd7("%s r%d\t; r%d %s r%d %s", shiftMnu[shiftType], rs, rm, M_Origin2Str(state->regData[rm].o), rs, M_Origin2Str(state->regData[rs].o));
|
250
|
249
|
}
|
251
|
250
|
else {
|
252
|
|
- shiftDist = (operand2 & 0x0f80) >> 7;
|
|
251
|
+ shiftDist = (operand2 & 0x0F80) >> 7;
|
253
|
252
|
op2origin = REG_VAL_FROM_CONST;
|
254
|
253
|
|
255
|
|
- if(shiftDist) {
|
|
254
|
+ if (shiftDist) {
|
256
|
255
|
UnwPrintd3("%s #%d", shiftMnu[shiftType], shiftDist);
|
257
|
256
|
}
|
258
|
257
|
UnwPrintd3("\t; r%d %s", rm, M_Origin2Str(state->regData[rm].o));
|
|
@@ -265,7 +264,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
265
|
264
|
break;
|
266
|
265
|
|
267
|
266
|
case 1: /* logical right */
|
268
|
|
- if(!regShift && shiftDist == 0) {
|
|
267
|
+ if (!regShift && shiftDist == 0) {
|
269
|
268
|
shiftDist = 32;
|
270
|
269
|
}
|
271
|
270
|
|
|
@@ -273,19 +272,19 @@ UnwResult UnwStartArm(UnwState * const state) {
|
273
|
272
|
break;
|
274
|
273
|
|
275
|
274
|
case 2: /* arithmetic right */
|
276
|
|
- if(!regShift && shiftDist == 0) {
|
|
275
|
+ if (!regShift && shiftDist == 0) {
|
277
|
276
|
shiftDist = 32;
|
278
|
277
|
}
|
279
|
278
|
|
280
|
|
- if(state->regData[rm].v & 0x80000000) {
|
|
279
|
+ if (state->regData[rm].v & 0x80000000) {
|
281
|
280
|
|
282
|
281
|
/* Register shifts maybe greater than 32 */
|
283
|
|
- if(shiftDist >= 32) {
|
284
|
|
- op2val = 0xffffffff;
|
|
282
|
+ if (shiftDist >= 32) {
|
|
283
|
+ op2val = 0xFFFFFFFF;
|
285
|
284
|
}
|
286
|
285
|
else {
|
287
|
286
|
op2val = state->regData[rm].v >> shiftDist;
|
288
|
|
- op2val |= 0xffffffff << (32 - shiftDist);
|
|
287
|
+ op2val |= 0xFFFFFFFF << (32 - shiftDist);
|
289
|
288
|
}
|
290
|
289
|
}
|
291
|
290
|
else {
|
|
@@ -295,7 +294,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
295
|
294
|
|
296
|
295
|
case 3: /* rotate right */
|
297
|
296
|
|
298
|
|
- if(!regShift && shiftDist == 0) {
|
|
297
|
+ if (!regShift && shiftDist == 0) {
|
299
|
298
|
/* Rotate right with extend.
|
300
|
299
|
* This uses the carry bit and so always has an
|
301
|
300
|
* untracked result.
|
|
@@ -305,7 +304,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
305
|
304
|
}
|
306
|
305
|
else {
|
307
|
306
|
/* Limit shift distance to 0-31 incase of register shift */
|
308
|
|
- shiftDist &= 0x1f;
|
|
307
|
+ shiftDist &= 0x1F;
|
309
|
308
|
|
310
|
309
|
op2val = (state->regData[rm].v >> shiftDist) |
|
311
|
310
|
(state->regData[rm].v << (32 - shiftDist));
|
|
@@ -318,7 +317,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
318
|
317
|
}
|
319
|
318
|
|
320
|
319
|
/* Decide the data origin */
|
321
|
|
- if(M_IsOriginValid(op2origin) &&
|
|
320
|
+ if (M_IsOriginValid(op2origin) &&
|
322
|
321
|
M_IsOriginValid(state->regData[rm].o)) {
|
323
|
322
|
|
324
|
323
|
op2origin = state->regData[rm].o;
|
|
@@ -338,7 +337,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
338
|
337
|
case 4: /* ADD: Rd:= Op1 + Op2 */
|
339
|
338
|
case 12: /* ORR: Rd:= Op1 OR Op2 */
|
340
|
339
|
case 14: /* BIC: Rd:= Op1 AND NOT Op2 */
|
341
|
|
- if(!M_IsOriginValid(state->regData[rn].o) ||
|
|
340
|
+ if (!M_IsOriginValid(state->regData[rn].o) ||
|
342
|
341
|
!M_IsOriginValid(op2origin)) {
|
343
|
342
|
state->regData[rd].o = REG_VAL_INVALID;
|
344
|
343
|
}
|
|
@@ -368,14 +367,14 @@ UnwResult UnwStartArm(UnwState * const state) {
|
368
|
367
|
}
|
369
|
368
|
|
370
|
369
|
/* Account for pre-fetch by temporarily adjusting PC */
|
371
|
|
- if(rn == 15) {
|
|
370
|
+ if (rn == 15) {
|
372
|
371
|
|
373
|
372
|
/* If the shift amount is specified in the instruction,
|
374
|
373
|
* the PC will be 8 bytes ahead. If a register is used
|
375
|
374
|
* to specify the shift amount the PC will be 12 bytes
|
376
|
375
|
* ahead.
|
377
|
376
|
*/
|
378
|
|
- if(!I && (operand2 & 0x0010))
|
|
377
|
+ if (!I && (operand2 & 0x0010))
|
379
|
378
|
state->regData[rn].v += 12;
|
380
|
379
|
else
|
381
|
380
|
state->regData[rn].v += 8;
|
|
@@ -430,8 +429,8 @@ UnwResult UnwStartArm(UnwState * const state) {
|
430
|
429
|
}
|
431
|
430
|
|
432
|
431
|
/* Remove the prefetch offset from the PC */
|
433
|
|
- if(rd != 15 && rn == 15) {
|
434
|
|
- if(!I && (operand2 & 0x0010))
|
|
432
|
+ if (rd != 15 && rn == 15) {
|
|
433
|
+ if (!I && (operand2 & 0x0010))
|
435
|
434
|
state->regData[rn].v -= 12;
|
436
|
435
|
else
|
437
|
436
|
state->regData[rn].v -= 8;
|
|
@@ -441,22 +440,22 @@ UnwResult UnwStartArm(UnwState * const state) {
|
441
|
440
|
/* Block Data Transfer
|
442
|
441
|
* LDM, STM
|
443
|
442
|
*/
|
444
|
|
- else if((instr & 0xfe000000) == 0xe8000000) {
|
|
443
|
+ else if ((instr & 0xFE000000) == 0xE8000000) {
|
445
|
444
|
|
446
|
445
|
bool P = (instr & 0x01000000) ? true : false;
|
447
|
446
|
bool U = (instr & 0x00800000) ? true : false;
|
448
|
447
|
bool S = (instr & 0x00400000) ? true : false;
|
449
|
448
|
bool W = (instr & 0x00200000) ? true : false;
|
450
|
449
|
bool L = (instr & 0x00100000) ? true : false;
|
451
|
|
- uint16_t baseReg = (instr & 0x000f0000) >> 16;
|
452
|
|
- uint16_t regList = (instr & 0x0000ffff);
|
|
450
|
+ uint16_t baseReg = (instr & 0x000F0000) >> 16;
|
|
451
|
+ uint16_t regList = (instr & 0x0000FFFF);
|
453
|
452
|
uint32_t addr = state->regData[baseReg].v;
|
454
|
453
|
bool addrValid = M_IsOriginValid(state->regData[baseReg].o);
|
455
|
454
|
int8_t r;
|
456
|
455
|
|
457
|
456
|
#if defined(UNW_DEBUG)
|
458
|
457
|
/* Display the instruction */
|
459
|
|
- if(L) {
|
|
458
|
+ if (L) {
|
460
|
459
|
UnwPrintd6("LDM%c%c r%d%s, {reglist}%s\n", P ? 'E' : 'F', U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : "");
|
461
|
460
|
}
|
462
|
461
|
else {
|
|
@@ -467,15 +466,15 @@ UnwResult UnwStartArm(UnwState * const state) {
|
467
|
466
|
* this is a load including the PC when the S-bit indicates that
|
468
|
467
|
* that CPSR is loaded from SPSR (also untracked, but ignored).
|
469
|
468
|
*/
|
470
|
|
- if(S && (!L || (regList & (0x01 << 15)) == 0)) {
|
|
469
|
+ if (S && (!L || (regList & (0x01 << 15)) == 0)) {
|
471
|
470
|
UnwPrintd1("\nError:S-bit set requiring banked registers\n");
|
472
|
471
|
return UNWIND_FAILURE;
|
473
|
472
|
}
|
474
|
|
- else if(baseReg == 15) {
|
|
473
|
+ else if (baseReg == 15) {
|
475
|
474
|
UnwPrintd1("\nError: r15 used as base register\n");
|
476
|
475
|
return UNWIND_FAILURE;
|
477
|
476
|
}
|
478
|
|
- else if(regList == 0) {
|
|
477
|
+ else if (regList == 0) {
|
479
|
478
|
UnwPrintd1("\nError: Register list empty\n");
|
480
|
479
|
return UNWIND_FAILURE;
|
481
|
480
|
}
|
|
@@ -488,21 +487,21 @@ UnwResult UnwStartArm(UnwState * const state) {
|
488
|
487
|
do {
|
489
|
488
|
|
490
|
489
|
/* Check if the register is to be transferred */
|
491
|
|
- if(regList & (0x01 << r)) {
|
|
490
|
+ if (regList & (0x01 << r)) {
|
492
|
491
|
|
493
|
|
- if(P)
|
|
492
|
+ if (P)
|
494
|
493
|
addr += U ? 4 : -4;
|
495
|
494
|
|
496
|
|
- if(L) {
|
|
495
|
+ if (L) {
|
497
|
496
|
|
498
|
|
- if(addrValid) {
|
|
497
|
+ if (addrValid) {
|
499
|
498
|
|
500
|
|
- if(!UnwMemReadRegister(state, addr, &state->regData[r])) {
|
|
499
|
+ if (!UnwMemReadRegister(state, addr, &state->regData[r])) {
|
501
|
500
|
return UNWIND_DREAD_W_FAIL;
|
502
|
501
|
}
|
503
|
502
|
|
504
|
503
|
/* Update the origin if read via the stack pointer */
|
505
|
|
- if(M_IsOriginValid(state->regData[r].o) && baseReg == 13) {
|
|
504
|
+ if (M_IsOriginValid(state->regData[r].o) && baseReg == 13) {
|
506
|
505
|
state->regData[r].o = REG_VAL_FROM_STACK;
|
507
|
506
|
}
|
508
|
507
|
|
|
@@ -517,8 +516,8 @@ UnwResult UnwStartArm(UnwState * const state) {
|
517
|
516
|
}
|
518
|
517
|
}
|
519
|
518
|
else {
|
520
|
|
- if(addrValid) {
|
521
|
|
- if(!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) {
|
|
519
|
+ if (addrValid) {
|
|
520
|
+ if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) {
|
522
|
521
|
return UNWIND_DWRITE_W_FAIL;
|
523
|
522
|
}
|
524
|
523
|
}
|
|
@@ -526,36 +525,36 @@ UnwResult UnwStartArm(UnwState * const state) {
|
526
|
525
|
UnwPrintd2(" R%d = 0x%08x\n", r);
|
527
|
526
|
}
|
528
|
527
|
|
529
|
|
- if(!P)
|
|
528
|
+ if (!P)
|
530
|
529
|
addr += U ? 4 : -4;
|
531
|
530
|
}
|
532
|
531
|
|
533
|
532
|
/* Check the next register */
|
534
|
533
|
r += U ? 1 : -1;
|
535
|
534
|
|
536
|
|
- } while(r >= 0 && r <= 15);
|
|
535
|
+ } while (r >= 0 && r <= 15);
|
537
|
536
|
|
538
|
537
|
/* Check the writeback bit */
|
539
|
|
- if(W)
|
|
538
|
+ if (W)
|
540
|
539
|
state->regData[baseReg].v = addr;
|
541
|
540
|
|
542
|
541
|
/* Check if the PC was loaded */
|
543
|
|
- if(L && (regList & (0x01 << 15))) {
|
544
|
|
- if(!M_IsOriginValid(state->regData[15].o)) {
|
|
542
|
+ if (L && (regList & (0x01 << 15))) {
|
|
543
|
+ if (!M_IsOriginValid(state->regData[15].o)) {
|
545
|
544
|
/* Return address is not valid */
|
546
|
545
|
UnwPrintd1("PC popped with invalid address\n");
|
547
|
546
|
return UNWIND_FAILURE;
|
548
|
547
|
}
|
549
|
548
|
else {
|
550
|
549
|
/* Store the return address */
|
551
|
|
- if(!UnwReportRetAddr(state, state->regData[15].v)) {
|
|
550
|
+ if (!UnwReportRetAddr(state, state->regData[15].v)) {
|
552
|
551
|
return UNWIND_TRUNCATED;
|
553
|
552
|
}
|
554
|
553
|
|
555
|
554
|
UnwPrintd2(" Return PC=0x%x", state->regData[15].v);
|
556
|
555
|
|
557
|
556
|
/* Determine the return mode */
|
558
|
|
- if(state->regData[15].v & 0x1) {
|
|
557
|
+ if (state->regData[15].v & 0x1) {
|
559
|
558
|
/* Branching to THUMB */
|
560
|
559
|
return UnwStartThumb(state);
|
561
|
560
|
}
|
|
@@ -578,7 +577,7 @@ UnwResult UnwStartArm(UnwState * const state) {
|
578
|
577
|
UnwPrintd1("\n");
|
579
|
578
|
|
580
|
579
|
/* Should never hit the reset vector */
|
581
|
|
- if(state->regData[15].v == 0) return UNWIND_RESET;
|
|
580
|
+ if (state->regData[15].v == 0) return UNWIND_RESET;
|
582
|
581
|
|
583
|
582
|
/* Check next address */
|
584
|
583
|
state->regData[15].v += 4;
|
|
@@ -587,10 +586,10 @@ UnwResult UnwStartArm(UnwState * const state) {
|
587
|
586
|
UnwMemHashGC(state);
|
588
|
587
|
|
589
|
588
|
t--;
|
590
|
|
- if(t == 0)
|
|
589
|
+ if (t == 0)
|
591
|
590
|
return UNWIND_EXHAUSTED;
|
592
|
591
|
|
593
|
|
- } while(!found);
|
|
592
|
+ } while (!found);
|
594
|
593
|
|
595
|
594
|
return UNWIND_UNSUPPORTED;
|
596
|
595
|
}
|