计算 X86 汇编语言代码中的指令数量
我需要计算为简单的汇编语言代码生成的指令数。这样,即使存在任何循环,我也可以计算该循环中的指令数量。我只需要它,以便我可以确定代码中的每条指令可以使用 -p 选项多少次。我在 widows xp 计算机上使用 masm 。
I need to count the number of instructions that will be generated for an simple assembly language code . So that even if there is any loop I can count the number of instructions in that loop also.I just need it so that i can determine how many times i can use -p option for each instruction's in he code. I am using masm on widows xp computer .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上比你想象的要困难得多。 (有些人会说不可能 - 请参阅http://en.wikipedia.org/wiki/Halting_problem )
如果代码依赖于任何类型的数据(例如从 RAM 加载值),其行为可能会根据数据包含的内容而发生巨大变化,这将影响执行的指令数量。例如,如果它是一个循环,它可能会从内存中的某处加载其迭代计数。因此可能执行 100 条指令,或者 100000000 条指令。
This is actually much more difficult than you would think. (Some would say impossible--see http://en.wikipedia.org/wiki/Halting_problem)
If the code relies on any sort of data (e.g. loading values from RAM), its behavior could change drastically based on what the data contains, and this will affect the number of instructions executed. e.g. if it's a loop, it will probably load its iteration count from memory somewhere. So it could be 100 instructions executed, or 100000000 instructions.