diff options
author | Jan Beulich <jbeulich@suse.com> | 2022-11-24 09:34:52 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2022-11-24 09:34:52 +0100 |
commit | c9f5b96bdab031e9520d98e01ee1bef1ffd3b961 (patch) | |
tree | 7bf77e81e28c7d8fda786174240f22c2166d057c /opcodes | |
parent | bde9f9d7e978b190ff6fc7207e2fe293d7c989a7 (diff) | |
download | gdb-c9f5b96bdab031e9520d98e01ee1bef1ffd3b961.zip gdb-c9f5b96bdab031e9520d98e01ee1bef1ffd3b961.tar.gz gdb-c9f5b96bdab031e9520d98e01ee1bef1ffd3b961.tar.bz2 |
x86: correct handling of LAR and LSL
Both uniformly only ever take 16-bit memory operands while at the same
time requiring matching (in size) register operands, which then also
should disassemble that way. This in particular requires splitting each
of the templates for the assembler and separating decode of the
register and memory forms in the disassembler.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/i386-dis.c | 16 | ||||
-rw-r--r-- | opcodes/i386-opc.tbl | 6 | ||||
-rw-r--r-- | opcodes/i386-tbl.h | 34 |
3 files changed, 50 insertions, 6 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index e43666a..edc2ce9 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -833,6 +833,8 @@ enum MOD_0F01_REG_3, MOD_0F01_REG_5, MOD_0F01_REG_7, + MOD_0F02, + MOD_0F03, MOD_0F12_PREFIX_0, MOD_0F12_PREFIX_2, MOD_0F13, @@ -2115,8 +2117,8 @@ static const struct dis386 dis386_twobyte[] = { /* 00 */ { REG_TABLE (REG_0F00 ) }, { REG_TABLE (REG_0F01 ) }, - { "larS", { Gv, Ew }, 0 }, - { "lslS", { Gv, Ew }, 0 }, + { MOD_TABLE (MOD_0F02) }, + { MOD_TABLE (MOD_0F03) }, { Bad_Opcode }, { "syscall", { XX }, 0 }, { "clts", { XX }, 0 }, @@ -8198,6 +8200,16 @@ static const struct dis386 mod_table[][2] = { { RM_TABLE (RM_0F01_REG_7_MOD_3) }, }, { + /* MOD_0F02 */ + { "larS", { Gv, Mw }, 0 }, + { "larS", { Gv, Ev }, 0 }, + }, + { + /* MOD_0F03 */ + { "lslS", { Gv, Mw }, 0 }, + { "lslS", { Gv, Ev }, 0 }, + }, + { /* MOD_0F12_PREFIX_0 */ { "movlpX", { XM, EXq }, 0 }, { "movhlps", { XM, EXq }, 0 }, diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl index 62f1898..82011c9 100644 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -574,14 +574,16 @@ nop, 0x90, None, 0, NoSuf|RepPrefixOk, {} // Protection control. arpl, 0x63, None, Cpu286|CpuNo64, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16, Reg16|Word|Unspecified|BaseIndex } -lar, 0xf02, None, Cpu286, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +lar, 0xf02, None, Cpu286, Modrm|CheckRegSize|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } +lar, 0xf02, None, Cpu286, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Word|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } lgdt, 0xf01, 2, Cpu286|CpuNo64, Modrm|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Fword|Unspecified|BaseIndex } lgdt, 0xf01, 2, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } lidt, 0xf01, 3, Cpu286|CpuNo64, Modrm|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Fword|Unspecified|BaseIndex } lidt, 0xf01, 3, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } lldt, 0xf00, 2, Cpu286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Word|Unspecified|BaseIndex } lmsw, 0xf01, 6, Cpu286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Word|Unspecified|BaseIndex } -lsl, 0xf03, None, Cpu286, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +lsl, 0xf03, None, Cpu286, Modrm|CheckRegSize|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } +lsl, 0xf03, None, Cpu286, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Word|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ltr, 0xf00, 3, Cpu286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Word|Unspecified|BaseIndex } sgdt, 0xf01, 0, Cpu286|CpuNo64, Modrm|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Fword|Unspecified|BaseIndex } diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h index c463db9..a9bc696 100644 --- a/opcodes/i386-tbl.h +++ b/opcodes/i386-tbl.h @@ -5364,6 +5364,21 @@ const insn_template i386_optab[] = { { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } } } }, { "lar", 0x02, 2, None, + { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 }, + { { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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