The above is the disassembly of a 64 bit ARM firmware image. Does anybody know what those
@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:
use 64-bit pointers placed in the constant pool near the instruction and load them with the
LDRinstruction. This is doable but such pointers need to be updated (relocated) if the image is loaded at a non-default address.
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
then, we can either use
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
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.