有没有某种工具可以查看 Intel x86 指令的编码?

发布于 2024-10-05 06:27:00 字数 271 浏览 0 评论 0原文

如果这可能是一个愚蠢的问题,请原谅我,但是,我正在上一个汇编课程,该课程主要使用模拟 CPU 来教授汇编代码的概念。我们甚至还没有写过英特尔程序,所以我正在努力调整。在我们的模拟 CPU 中,我们能够生成一个符号表文件,该文件给出了与指令等效的字节:

https:/ /i.sstatic.net/oIKP5.png

我可以使用 Intel x86 指令来做这样的事情吗?

Forgive me if this might be a dumb question but, I'm in an assembly class that was mostly taught using an emulated CPU that was supposed to teach the concepts of assembly code. We haven't even written an Intel program, so I'm trying to adjust. In our emulated CPU, we were able to generate a symbol table file that gave the bytes equivalent for instructions:

https://i.sstatic.net/oIKP5.png

Would I be able to do such a thing with Intel x86 instructions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

水溶 2024-10-12 06:27:00

尝试IDA。它有一个选项来显示操作码的二进制值。

编辑:嗯..它是一个反汇编程序。尝试打开一个二进制文件,并将要显示的操作码字节数(在选项/常规/中)设置为不为零的值。

如果您正在寻找一款能够实时显示您所使用的指令的操作码的 IDE,那么我认为您不会找到,因为缺乏“市场”。你能解释一下你为什么需要它吗?您想知道它们的长度,还是想学习它们?长度有简单的模式,因此通过分解许多二进制文件,您将捕获它。如果这是您想要的操作码……那么,它们有很多,几乎没有规则,而且实际上没有用处。

我明白了..那么你必须生成列表文件。你的汇编器应该有一个选项。 (对于 NASM,它是 -l listfile)。只需将任何指令放入 .asm 文件中,并为其生成列表即可。它应该包含每条指令的二进制编码。

首先,获取英特尔指令集参考,或者更好的是,此链接: http://siyobik.info/index.php?module=x86 。在那里您会发现大多数操作码都有多种编码。在您的特定情况下,操作码的位 1 指定方向,并且由于两个操作数都是寄存器,因此您可以切换方向并交换寄存器代码,结果将是相同的。通常,您可以在大多数寄存器上自由地注册算术运算。要检查这一点,请尝试使用 IDA 反编译此源文件:

db 02h, E0h
db 00h, C4h

Try IDA. It has an option to show binary values of opcodes.

EDIT: Well.. it's a disassembler. Try opening a binary file, and set the number of opcode bytes to show (in Options/General/) to something that is not zero.

If you are looking for an IDE that shows you in real time the opcodes for the instruction you've used, then I don't think you'll find one, because of lack of "market". Can you explain why you need it? Do you want to know just their length, or want to learn them? There is simple pattern for lengths, so by dissasembling many binaries you'll catch it. If it's the opcodes you want.. well, there are lots of them, almost no rules, and practically no use to do it.

I see.. then you have to generate the list file . Your assembler should have an option for that. (for NASM it's -l listfile). Just put any instruction(s) in your .asm file, and generate listing for it. It should contain the binary encoding for each instruction.

First, get Intel Instruction Set Refference, or, better, this link: http://siyobik.info/index.php?module=x86 . There you'll find that most opcodes have several encodings. In your particular case, the bit 1 of the opcode specifies direction, and since both operands are registers, you can toggle the direction and swap the register codes, and the result will be the same. Usually you have this freedom on most register to register arithmetic operations. To check this, try decompiling with IDA this source file:

db 02h, E0h
db 00h, C4h
朕就是辣么酷 2024-10-12 06:27:00

fasm.dll 附带了一个演示程序,它有一个编辑器和十六进制-查看器: 替代文本

There is a demo program shipped with fasm.dll which has an editor and hex-viewer: alt text

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