I see this instruction in the beginning of several Windows programs.It's copying a register to itself, so basically, this acts as a nop.What's the purpose of this instruction?
What is the purpose of 'mov edi, edi'?
disassembly;windows
Raymond Chen (Microsoft) has a blog post discussing this in detail:http://blogs.msdn.com/b/oldnewthing/archive/2011/09/21/10214405.aspxIn short, it's a compile time addition applied in order to support run time hot patching, so the function can have the first two bytes overwritten with a JMP instruction to redirect execution to another piece of code.