Reputation: 21
address and data manipulation, click to see the image
mov $0x100, %eax
mov $0x105, (%eax)
In a 32bit little-endian architecture
Could someone explain me how these mov's are working?
I understand that the second mov is informing the processor to write on the memory address corresponding to the aex register the value 0x105, but I fail to understand why it is being written on the 0x100 address
Thanks for any help
Upvotes: 2
Views: 1619
Reputation: 137
mov $0x100, %eax
it moves the immediate value 0x100
into the eax
register
mov $0x105, (%eax)
it moves the immediate value 0x105
into the dereferenced address 0x100
from eax
because you are using (%eax)
. It has the value 0x100
you put in the previous step.
Think about the concept pointer
in C
which saves the address as its value - it uses *ptr
to dereference the value while here it uses (%register)
.
To help you get something into assembly, check out here: CS107 Guide to x86-64
Upvotes: 1