enter image description here

The above is the disassembly of a 64 bit ARM firmware image. Does anybody know what those @PAGE and @PAGEOFF symbols mean?


in AArch64, all instructions are 32-bit long. Obviously, this is not enough to encode 64-bit addresses which AArch64 may need to process. So there's two options:

  1. use 64-bit pointers placed in the constant pool near the instruction and load them with the LDR instruction. This is doable but such pointers need to be updated (relocated) if the image is loaded at a non-default address.

  2. Use PC-relative addressing to load addresses at a fixed offset from the current location (PIC code). This is the more common approach but the offset is still limited by the instruction size. So ARM designers came up with a clever hack: use two instructions to allow for a much wider range.

The ADRP instruction loads the address of the 4KB page anywhere in the +/-4GB (33 bits) range of the current instruction (which takes 21 high bits of the offset). this is denoted by the @PAGE operator. then, we can either use LDR or STR to read or write any address inside that page or ADD to to calculate the final address using the remaining 12 bits of the offset (denoted by@PAGEOFF).

So basically you can consider those instruction pairs as if the last one directly accesses the final address of the location before the @ and you can ignore the suffixes if you don't plan to reassemble the file.

See also https://stackoverflow.com/questions/34003338/llvm-arm64-assembly-getting-a-symbol-label-address


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.