I'm trying to understand the LEA assembly instruction. I'm using lldb, and at this point in execution of a program, the memory is as follows:
-> 0x100000f12 <+130>: lea rdi, [rip + 0x82]
(lldb) register read rip
rip = 0x0000000100000f12
I would expect after this instruction is run, rdi should contain:
hex(0x0000000100000f12 + 0x82) = '0x100000f94'
But instead, rdi contains:
(lldb) register read rdi
rdi = 0x0000000100000f9b
Which is 7 offset of what was expected:
0x100000f9b - (0x0000000100000f12 + 0x82) = 7
I'm guessing the 7 has to do with the the size of a byte, but I would like to know more concretely what exactly is going on.