I\'m trying to understand the following problem: what does 100, %eax do exactaly
ID: 3865397 • Letter: I
Question
I'm trying to understand the following problem: what does 100, %eax do exactaly? if we said movl, $100, %eax, that would be eax = the value 100
but without the constant sign, we are talking about memory here? Can someone tell me what this instruction does and what the solution to this problem is?
Please explain in detial for a thumbs up :)
What would the value in eax be after the performing movl 100, %eax
Memory looks like
Addr
100
101
102
103
104
105
Value
0x11
0x22
0x33
0x44
0x55
0x66
If the machine is little Endian?
Big Endian?
Addr
100
101
102
103
104
105
Value
0x11
0x22
0x33
0x44
0x55
0x66
Explanation / Answer
It simply states that, move the value or value at the specified location from right to left.
Now, lets understand what is %eax.
%eax is nothing but register EAX;
(%eax) is the memory location whose address is contained in the register EAX;
Now if you see carefully , %eax is register and if we put () around them they become memory which is refering the EAX register.
And one more thing to know, the literal values must be prefixed by a '$' sign .
Now finally coming to your command:
movl $100, %eax
This statement says that, we are moving the value 100. to register EAX.
Now if it was :
movl $100, (%eax)
This statement would have moved the value 100 to memory location of EAX register.
Now if you ask me, this statment is based on whch system little endian or big endian?
The answer is this is Intel 32 bit Little Endian system, this is identified by %eax, the % are used in 32 bit architecture.