Search code examples
objective-carmida

In IDA Pro what is '::lower16::' in the 2nd ARM operand do?


E.G I have this:

MOVW R1, #(:lower16:(selRef_stringWithUTF8String_ - 0xbeee)
MOV  R6, R0
MOVT.W R1, #(:upper16:(selRef_stringWithUTF8String_ - 0xbeee)

There is :lower16: and :upper16: before the address of the operand. I presume its because its in thumb mode and the size of the pointer to the string is too large so its fetching lower and upper portions? Please advise.


Solution

  • It is just as you guessed. In Thumb-2, when loading a 32-bit number it is often using a MOV/MOVT instruction pair, e.g.

    MOVW   R1, #0x1234          ; Set the value of R1.      R1 is now 0x1234
    MOVT.W R1, #0x5678          ; Set the top-16 bit of R1. R1 is now 0x56781234.
    

    IDA Pro recognized that the combined immediate value matches the address of a selector, and uses the :lower: and :upper: syntax to indicate that the value is split into two 16-bit parts.