Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

x86 heap method

Im trying to understand what this x86 instruction is doing:

 movl %eax, heap(,%rdx,4)

This is what I think its doing:

move value in eax to area in memory starting at label heap and displaced bytes from the value in rdx.

Is this correct?

Thanks

like image 358
banditKing Avatar asked Sep 05 '26 22:09

banditKing


1 Answers

The AT&T syntax for memory operands is:

%segreg:disp(base,index,scale).

So the memory address in the instruction you've shown is (better represented in Intel syntax):

heap[rdx*4] 

So in other words, store the value in eax at rdx*4 bytes from the beginning of heap. From this, we can infer that heap is probably an array of 4-byte integers, and rdx is a loop counter or index into that array.

In Intel syntax, this would be:

mov heap[rdx*4], eax

For a comparsion between the syntaxes, see this page.

like image 172
Jonathon Reinhart Avatar answered Sep 08 '26 13:09

Jonathon Reinhart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!