Reputation: 588
I'm little confused with the rules of using the "xxxx PTR" with indirect operand. Can anybody make it clear ? Thanks
Upvotes: 0
Views: 307
Reputation: 477680
Perhaps you refer to this mnemonic syntax (e.g. objdump -Mintel
):
add DWORD PTR [eax],0x5
The point here is that [eax]
is just a location in memory, but it doesn't carry size information. So we don't know whether to add 5 to a byte, a word, a dword or a qword. It would be clear if we used the annotated opcode names (addb
, addw
, addl
, addq
), but this particular dialect of assember chooses instead to annotate the memory operand. In this case, it says, "treat eax
is a pointer to a dword".
By contrast, register operands need no such annotation, since the register name implies its size:
add al,0x5 ; addb
add ax,0x5 ; addw
add eax,0x5 ; addl
add rax,0x5 ; addq
Upvotes: 1