banner
lca

lca

真正的不自由,是在自己的心中设下牢笼。

"Learning Notes on IDA Reverse Engineering from Scratch" - 5 (lea Instruction)

LEA Instruction

LEA stands for "LOAD EFFECTIVE ADDRESS." The instruction "LEA A, B" passes the address of B to A.
This instruction does not retrieve the contents stored in B, but only passes the address or the result of the next operand (in square brackets). This method is commonly used to obtain the address of variable parameters.

Function Parameters and Local Variables

IDA identifies that functions generally require passing parameters before calling, with most using the PUSH instruction (only for 32-bit).

Function Parameters

Passing Parameters

Although the LEA instruction uses square brackets, it only calculates the expression within the brackets and passes the address without reading its contents.

Other Uses of LEA

LEA can also be used to pass the result of an expression within square brackets to the destination register without reading the contents stored at the result address. For example, the instruction "LEA EAX, [4+5]" passes the result of the calculation, 9, to EAX, without retrieving the contents stored at address 0x9 like the instruction "MOV EAX, [4+5]" would.

LEA retrieves the address of a variable, while MOV retrieves the value stored at the variable's address (except for OFFSET).

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.