ARM Technical Support Knowledge Articles

In AArch64 how can I read the current PC value?

Applies to: ARMv8 Architecture

Answer

In AArch64 the PC (program counter) is not a general purpose register, and cannot be directly accessed by most instructions.

One way to read the current PC is with the ADR instruction.  This returns an address of a label, calculated by adding an offset to the PC.  Executing "ADR, Xd, ." the '.' (dot) character in place of the label returns the address of the ADR instruction in Xd. You can find more information about ADR here.

Also to make the debugging more convenient, the DS-5 debugger still keeps PC as a register in the register view for AArch64.

Article last edited on: 2015-01-19 12:15:09

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential