PC value in between two instructions (program counter)

霸气de小男生 提交于 2019-12-13 01:13:18

问题


Trying to understand the cause of the watchdog. The snippet of assembly routine is as follows:

fe813cf0:       2820            cmp     r0, #32
fe813cf2:       dbf0            blt.n   fe813cd6 <XYZ+0x10>
fe813cf4:       f04f 30ff       mov.w   r0, #4294967295 ; 0xffffffff
fe813cf8:       bd10            pop     {r4, pc}

My PC value from dump is fe813cf3. What does this mean? How should I interpret it? Please let me know if more info is required.


回答1:


If it's a watchdog that triggers, that seems to indicate that the processor has hung. The state you're capturing might be corrupt, in the worst case. Not sure how you get the "dump", so it's hard to tell.

In general on ARM, an odd address indicates a jump that wanted to switch to the Thumb instruction set.

See for instance this documentation of the BX (branch exchange) instruction:

The BX instruction branches to the address contained in a specified register. The value of bit 0 of the branch address determines whether execution continues in ARM state or Thumb state.

Bit 0 of an address can be used in this way because:

  • All ARM instructions are word-aligned. This means that bits 0 and 1 of the address of any ARM instruction are ignored because these bits refer to the halfword and byte part of the address.

  • All Thumb instructions are halfword-aligned. This means that bit 0 of the address of any Thumb instruction is ignored because it refers to the byte part of the address.

However, I'm pretty sure the above implies that the PC is never actually set to an odd address, bit 0 is cleared by the branch instruction.



来源:https://stackoverflow.com/questions/16079189/pc-value-in-between-two-instructions-program-counter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!