What does NOPL do in x86 system?

前端 未结 3 1253
死守一世寂寞
死守一世寂寞 2020-11-27 18:35

what is the function of NOPL in x86 machine? It feels like it doesn\'t do anything, but why is it always in the assembly code?

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 19:07

    Actually, NOP will be used in the assembly code when the code need to be patched.

    Because the size of the new instructions may be different to that of the old ones, padding is needed.

    The padding instruction should act as the same as NOP, although it may occupy several bytes.

    The reason that we insert a more complex instruction, like 66 90, instead of several NOPs, is one instruction generally executes more quickly than several NOPs.

提交回复
热议问题