x86 操作码编码:sib 字节
我目前正在尝试编写一个反汇编程序。我找到了以下操作码列表及其含义,因此我决定在运行时解析它: http://web.archive。 org/web/20150810224114/http://mprolab.teipir.gr/vivlio80X86/pentium.txt
但我卡在操作码 0x00 处: 后面跟着一个 reg/modbyte。解析它对我来说并不是什么问题。
但我在使用 Scale-Index-Base 字节时遇到了问题:
如果你实际上指定 esp 作为索引寄存器,那么实际上意味着没有索引寄存器。
这同样适用于带有 ebp 的基址寄存器。但我已经用 C++ 内联汇编器尝试过:可以编译: add [ebp*2+ebp],cl
那么当使用ebp作为基址寄存器实际上意味着根本不使用基址寄存器时,如何将ebp用作基址寄存器!?
I'm currently trying to write a disassembler. I found the following list of opcodes and their meanings, so i decided to parse it at runtime:
http://web.archive.org/web/20150810224114/http://mprolab.teipir.gr/vivlio80X86/pentium.txt
But i am stuck at the opcode 0x00:
It is followed by a reg/modbyte. Parsing it was not much of a problem for me.
But I'm having trouble with the Scale-Index-Base byte:
If you actually specify esp as index register, it actually means that there is no index register.
The same applies for the base register with ebp. But I've tried it with C++ inline assembler: It is possible to compile:add [ebp*2+ebp],cl
So how can ebp be used as base register when using ebp as base register actually means using no base register at all!?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“缺少 EBP”情况仅适用于 ModR/M.Mod 字段具有二进制值 00 的情况。如果需要 EBP 作为基础,汇编器会将 Mod 更改为 01 二进制,并添加 8 位位移,其值为零:
004C6D00 add [ebp+ebp*2], cl
The "missing EBP" case apply only in case ModR/M.Mod field has value 00 binary. If you need EBP as a base, the assembler changes the Mod to 01 binary and adds 8-bit displacement with value of zero:
004C6D00 add [ebp+ebp*2], cl