计算 X86 汇编语言代码中的指令数量

发布于 2024-12-28 16:09:59 字数 118 浏览 5 评论 0原文

我需要计算为简单的汇编语言代码生成的指令数。这样,即使存在任何循环,我也可以计算该循环中的指令数量。我只需要它,以便我可以确定代码中的每条指令可以使用 -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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年已逝 2025-01-04 16:09:59

这实际上比你想象的要困难得多。 (有些人会说不可能 - 请参阅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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文