问题
lea 0x0(%esi),%esi
I believe it has no result and is simply filling space. Is this the case?
回答1:
Its a NOP. It adds the contents of %esi and 0x0, and puts the result in %esi. Somebody either has a clumsy code generator or needs to fill N bytes, where this instruction is the right size.
LEA instructions execute quite fast (typically 1 clock), so this is a lot better than N nops.
The x86 being as quirky as it is, has a variety of instructions that effectively don't do anything but fill differing numbers of bytes. You may find other useless instructions of different lengths. You tend to find instructions that are long but execute in 1 clock or less.
The AMD x86-64 manual has some suggestions as to what should be used for NOPs; they suggest one of the prefix opcodes repeated a number of times before an actual NOP, IIRC. Such prefix opcodes are consumed very quickly by the instruction fetch engine; mostly their cost is hidden in instruction pre-fetch, and not in instruction execution time.
来源:https://stackoverflow.com/questions/10505690/what-is-the-meaning-of-lea-0x0esi-esi