x86指令编码表 [英] x86 instruction encoding tables

查看:309
本文介绍了x86指令编码表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的重写汇编中间。而在这我很好奇实施拆装为好。我想让它简单,紧凑,并且有概念,而这样做,所以我可以利用。

I'm in middle of rewriting my assembler. While at it I'm curious about implementing disassembly as well. I want to make it simple and compact, and there's concepts I can exploit while doing so.

有可能确定从运code x86指令编码(也许preFIX字节需要太多,有点)的其余部分。我知道很多人都写为表做。

It is possible to determine rest of the x86 instruction encoding from opcode (maybe prefix bytes are required too, a bit). I know many people have written tables for doing it.

我不感兴趣约助记符但指令编码,因为这是一个实际的难题那里。对于每个运算code号我需要知道:

I'm not interested about mnemonics but instruction encoding, because it is an actual hard problem there. For each opcode number I need to know:


  • 这是否说明包含modrm?

  • 多少直接的领域这是否说明有哪些?

  • 什么编码不立即使用?

  • 在现场的指令指针-relative解决眼前的?

  • 什么样的​​寄存器做操作数的modrm使用和注册领域?

sandpile.org有几分颇多我需要的东西,但它的格式是不容易的解析。

sandpile.org has somewhat quite much what I'd need, but it's in format that isn't easy to parse.

我开始编写和验证这些表自己之前,我决定写这个问题。你知道这种现有地方的表?在不需要太多精力来解析的形式。

Before I start writing and validating those tables myself, I decided to write this question. Do you know about this kind of tables existing somewhere? In a form that doesn't require too much effort to parse.

b   byte
w   word
v   word or dword (or qword), depends on operand size attribute (0x66)
z   word or dword (or dword), depends on operand size attribute
J   instruction-relative address (next character describes type)
G   instruction group, has modrm-field (next character describes operand type)
R   has modrm-field (next two characters describe register and operand type)
M   modrm, but operand field must point to memory
O   direct offset (next character describes type)
F   FPU
T   separate table
_   defined, but no arguments

x    0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
0  Rbb  Rvv  Rbb  Rvv    b    z            Rbb  Rvv  Rbb  Rvv    b    z         T
1  Rbb  Rvv  Rbb  Rvv    b    z            Rbb  Rvv  Rbb  Rvv    b    z
2  Rbb  Rvv  Rbb  Rvv    b    z            Rbb  Rvv  Rbb  Rvv    b    z
3  Rbb  Rvv  Rbb  Rvv    b    z            Rbb  Rvv  Rbb  Rvv    b    z
4    _    _    _    _    _    _    _    _    _    _    _    _    _    _    _    _
5    _    _    _    _    _    _    _    _    _    _    _    _    _    _    _    _
6    _    _  Mvv                             z Rvvz    b Rvvb
7   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb   Jb
8  Gbb  Gvz  Gbb  Gvb  Rbb  Rvv  Rbb  Rvv  Rbb  Rvv  Rbb  Rvv       Mvv
9    _    _    _    _    _    _    _    _                        _    _    _    _
A   Ob   Ov   Ob   Ov    _    _    _    _    b    z    _    _    _    _    _    _
B    b    b    b    b    b    b    b    b    v    v    v    v    v    v    v    v
C  Gbb  Gvb    w    _                                            _    b    _    _
D   Gb   Gv   Gb   Gv                        F    F    F    F    F    F    F    F
E                                           Jz   Jz        Jb
F                        _    _   Gb   Gv    _    _    _    _    _    _   Gb   Gv

在这里,我得到了一个操作数的表。格式是这样的,该表可以解析
直出从包含它的文本文件。我离开远一些CISC和分割相关的指令。

Here I've got the table for first operand. The format is such that the table can be parsed straight out from a text file that contains it. I left away some CISC and segmentation related instructions.

对于两字节指令的机会是我需要四个这样的表。对于三字节指令,我需要两个表多。 FPU指令需要8桌,这是幸运的很简单。从那以后,我不得不x86指令pretty大块掩盖。虽然我只是去只有一个或两个表的罚款。

For two-byte instructions the chances are I need four such tables. For three-byte instructions I'll need two tables more. FPU instructions require 8 tables, which are fortunately very simple. After that I'd have pretty large chunk of x86 instructions covered up. Though I go just fine with just one or two tables.

此外,一些指令组可能需要一些小数组识别指令类型。

Further, few instruction groups might require some small arrays to recognise instruction type.

推荐答案

我相信 ref.x86asm.net 可能有你重新寻找。这是所有的x86-64指令列表中,因此很容易解析XML格式。

I believe ref.x86asm.net might have what you're looking for. It's a list of all x86-64 instructions, in an XML format that should be easy to parse.

这篇关于x86指令编码表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆