rework flags in opcode table

This commit is contained in:
andromeda
2026-04-02 09:40:58 +02:00
parent 8f3d6b91f9
commit 91a609040f
2 changed files with 99 additions and 119 deletions

View File

@@ -230,11 +230,11 @@ entries are as follows:
16 bytes
+------------------------------+
| 0 operand operators |
+------------------------------+
| 127 96 |
+------------------------------+
| reserved |
+------------------------------+
+---------+--------------------+
| 127 120 | 119 96 |
+---------+--------------------+
| flags | reserved |
+---------+--------------------+
| 95 64 |
+------------------------------+
| reserved |
@@ -249,39 +249,39 @@ entries are as follows:
+----------+--------+----------+
16 bytes
+-------------------------------------------------------------+
| 1 operand operators |
+-------------------------------------------------------------+
| 127 96 |
+-------------------------------------------------------------+
| reserved |
+----------+-------+-------+-------+-------+----------+-------+
| 95 88 | 87 84 | 83 80 | 79 76 | 75 72 | 71 68 | 67 64 |
+----------+-------+-------+-------+-------+----------+-------+
| reserved | op5&8 | op4&8 | op3&8 | op2&8 | reserved | op0&8 |
+----------+-------+-------+-------+-------+----------+-------+
| 63 56 | 55 48 | 47 40 | 39 32 |
+----------+---------------+---------------+------------------+
| opcode | opcode | opcode | opcode |
| dst=rel8 | dst=rel | dst=imm8 | dst=imm |
+----------+---------------+---------------+------------------+
| 31 24 | 23 16 | 15 0 |
+----------+---------------+----------------------------------+
| reserved | opcode | token ID |
| | dst=r/m | |
+----------+---------------+----------------------------------+
+------------------------------------------+
| 1 operand operators |
+----------+----------+----------+---------+
| 127 120 | 119 112 | 111 104 | 103 96 |
+----------+----------+----------+---------+
| flags | reserved | flags5 | flags4 |
+----------+----------+----------+---------+
| 95 88 | 87 80 | 79 72 | 71 64 |
+----------+----------+----------+---------+
| flags3 | flags2 | reserved | flags0 |
+----------+----------+----------+---------+
| 63 56 | 55 48 | 47 40 | 39 32 |
+----------+----------+----------+---------+
| opcode | opcode | opcode | opcode |
| dst=rel8 | dst=rel | dst=imm8 | dst=imm |
+----------+----------+----------+---------+
| 31 24 | 23 16 | 15 0 |
+----------+----------+--------------------+
| reserved | opcode | token ID |
| | dst=r/m | |
+----------+----------+--------------------+
16 bytes
+-----------------------------------------------+
| 2 operand operators |
+-----------------------------------------------+
| 127 96 |
+-----------------------------------------------+
| reserved |
+---------+----------+-------+-------+----------+
| 95 88 | 87 80 | 79 76 | 75 72 | 71 64 |
+---------+----------+-------+-------+----------+
| flags | reserved | op3&8 | op2&8 | reserved |
+---------+-------------------------------------+
| 127 120 | 119 96 |
+---------+-------------------------------------+
| flags | reserved |
+---------+----------+--------------------------+
| 95 88 | 87 80 | 79 64 |
+---------+----------+--------------------------+
| flags3 | flags2 | reserved |
+---------+----------+-------+-------+----------+
| 63 48 | 47 40 | 39 32 |
+--------------------+---------------+----------+
@@ -305,9 +305,23 @@ entries are as follows:
| reserved | 8bit |
+----------+------+
1 byte
+----------------------------------------------------+
| flagsX byte |
+----------+-----------+-------------+---------------+
| 7 5 | 4 | 3 | 2 0 |
+----------+-----------+-------------+---------------+
| reserved | no ModR/M | 0x0F prefix | operator flag |
+----------+-----------+-------------+---------------+
; flags key:
8bit ; tte has opcodes for r/m8 and r8 instead of r/m and r respectively
; flagsX key:
no ModR/M ; there is no ModR/M byte for this opcode
0x0F prefix ; there is a 0x0F prefix for this opcode
operator flag ; contents of `reg` if applicable
; key:
r/m ; r/m 16/32/64
r/m8 ; r/m 8
@@ -317,10 +331,6 @@ imm ; imm 16/32
imm8 ; imm 8
rel ; rel 16/32
rel8 ; rel 8
opX&8 ; low 8 bits are the operator flag that goes with opcode at offset X from
; the first opcode in the table entry. High bit is (somewhat confusingly)
; a flag for whether or not the operator comes with an `0F` prefix
```
note much room to expand. If an opcode doesn't exist, it should be 0x00