问题
I'm having a little trouble with imagining how data moves into the RAX register.
Here is the assembly language:
.data
dwordVal DWORD 94326732h
.code
mov rax, 0FFFFFFFF00000000h
mov rax, dwordVal
I read that you cannot move a smaller operand into a larger operand with MOV. It seems to me that dwordVal would only fill the lower half of the 64 bit rax register, so this would not be permitted. Please correct me if I'm wrong.
回答1:
A mov instruction will always fill the destination operand with a complete value, of exactly the same size as the destination operand.
So, your understanding is incorrect. You cannot fill part of rax with a mov.
As Jester has already said in a comment, precisely what will happen as a result of that mov rax, dwordVal depends on the conventions followed by your assembler, and some assemblers would actually reject such a thing as illegal.
One thing I can tell you is that there will be absolutely nothing left in rax from that 0FFFFFFFF00000000h that was previously loaded into it.
来源:https://stackoverflow.com/questions/48449833/move-smaller-operand-into-larger-operand