Reputation: 455
If I have an IA32 instruction like the following:
lea 0x4(x1, x2, x3), %eax
What do x1, x2, and x3 represent? Thanks.
Upvotes: 0
Views: 2384
Reputation: 43688
They are a base register, an index register, and a scale value. So, it's useful for calculating the address of an element of an array base of elements of size scale at position index, i.e. in C:
base[index]
where scale will be 1 for a char array, 2 for a short array, ... on typical C compilers for x86.
Upvotes: 0
Reputation: 12164
If you mean "what is lea for," follow the link in Greg's comment.
If your question is about the syntax and are familiar with Intel syntax (but not AT&T syntax), x1 is the base, x2 is the index, and x3 is the scale (with 0x4 being the displacement). Thus,
lea 0x4(x1,x2,x3),%eax
is equivalent to
lea eax,[x1+x3*x2+4]
See this article on SourceForge for more.
Upvotes: 4