the test platform is x86-32bit
.
I know that on x86-32bit
, we have two opcodes movsbl
and movzbl
which has the following semantics:
%eax = 0x12345678
%edx = 0xAAAABBBB
MOVB %dh, %al %eax = 0x123456BB
MOVSBL %dh, %eax %eax = 0xFFFFFFBB
MOVZBL %dh, %eax %eax = 0x000000BB
The above example is from here.
Then I am kind of confused with the semantics of the following instruction:
mov %dl, 0x2c(%esp)
What is the exact meaning of the above mov
, is it equal to movsbl
? or equal to movzbl
? Or neither?
If no operand sizes are explicitly provided, most assemblers will calculate the type of operation from the operand sizes. Therefore, in this case, mov %dl, 0x2c(%esp)
is equivalent to movb %dl, 0x2c(%esp)
, a simple 1 byte move, deducing the b
suffix from the one-byte register, dl
.
The reason for the 32 bit register: this stores the address of the memory location; no mismatch in operand sizes results (since a memory location can be interpreted as being any size).
User contributions licensed under CC BY-SA 3.0