This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Program Counter update

Note: This was originally posted on 15th June 2009 at http://forums.arm.com

In the Architectural Reference Manual for ARMv7 the PC update is described such that it gets update with adding 8 to the current PC while executing an ARM instruction and adding 4 for Thumb instruction. ARM instructions are 32-bit, hence I'd expect the PC to be updated by adding 4 to it rather than 8. Does anyone knows what is the reason behind this? Am I missing something or is it a mistake?

Thanks
Parents
  • Note: This was originally posted on 16th June 2009 at http://forums.arm.com

    The PC increment during "normal execution" will be 4 for ARM, and 2 or 4 for Thumb (depending if if it is a 16 or 32-bit Thumb instruction).


    That's exactly what I expected to see, PC increment of 4 for ARM, and 2 or 4 for Thumb instructions. But on page A2-11 (Section A2.3) of the manual (ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition) it's been said that:

    PC, the Program Counter
    Register R15 is the program counter:
    "¢ When executing an ARM instruction, PC reads as the address of the current
    instruction plus 8.
    "¢ When executing a Thumb instruction, PC reads as the address of the current
    instruction plus 4.
    "¢ Writing an address to PC causes a branch to that address.
    In Thumb code, most instructions cannot access PC.

    Thanks
Reply
  • Note: This was originally posted on 16th June 2009 at http://forums.arm.com

    The PC increment during "normal execution" will be 4 for ARM, and 2 or 4 for Thumb (depending if if it is a 16 or 32-bit Thumb instruction).


    That's exactly what I expected to see, PC increment of 4 for ARM, and 2 or 4 for Thumb instructions. But on page A2-11 (Section A2.3) of the manual (ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition) it's been said that:

    PC, the Program Counter
    Register R15 is the program counter:
    "¢ When executing an ARM instruction, PC reads as the address of the current
    instruction plus 8.
    "¢ When executing a Thumb instruction, PC reads as the address of the current
    instruction plus 4.
    "¢ Writing an address to PC causes a branch to that address.
    In Thumb code, most instructions cannot access PC.

    Thanks
Children
No data