ARM寄存器被污染的可能原因是什么?

时间:2015-03-26 05:36:32

标签: arm cpu-registers neon

最近我遇到了这个奇怪的问题(Thumb2 instr-set)。说我有以下代码:

000a8948 <some_func>:
a8948:       e92d 4ff0       stmdb   sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
a894c:       460f            mov     r7, r1
a894e:       f8df 8260       ldr.w   r8, [pc, #608]
a8952:       4606            mov     r6, r0       --> r0 shows b89a8408 in backtrace
a8954:       4b97            ldr     r3, [pc, #604]
a8956:       f100 0410       add.w   r4, r0, #16  --> only place r4 gets assigned, but it can't be 0.
a895a:       44f8            add     r8, pc
a895c:       f04f 0900       mov.w   r9, #0
a8960:       ed2d 8b04       vpush   {d8-d9}
a8964:       f858 1003       ldr.w   r1, [r8, r3]
a8968:       b095            sub     sp, #84 ; 0x54
a896a:       f8df b24c       ldr.w   fp, [pc, #588]
a896e:       ad0c            add     r5, sp, #48
a8970:       f8df c248       ldr.w   ip, [pc, #584]
a8974:       f8df a248       ldr.w   sl, [pc, #584]
a8978:       ed9f 8b8b       vldr    d8, [pc, #556]
a897c:       680a            ldr     r2, [r1, #0]
a897e:       44fb            add     fp, pc
a8980:       44fc            add     ip, pc
a8982:       44fa            add     sl, pc
a8984:       9107            str     r1, [sp, #28]
a8986:       9213            str     r2, [sp, #76]
a8988:       6823            ldr     r3, [r4, #0]     // ERR: SIGSEGV happens, code 1 (SEGV_MAPPER), fault addr 0x0

所以当这个问题发生时,r4转向值0,我无法弄清楚r4是如何被污染的,因为它只被分配到a8956行的r0 + 16?是不是霓虹灯指令以某种方式写了r4?

0 个答案:

没有答案