diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-01-26 10:34:48 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-01-26 10:34:48 +0100 |
commit | c179ace029aff5916c02168fa925b2269d7da0ec (patch) | |
tree | e91552b1a7da62946e98e70b4574ad40164f4872 | |
parent | 836f6ceb83dceca0c261507928fbd7fe5a6aea65 (diff) | |
download | gdb-c179ace029aff5916c02168fa925b2269d7da0ec.zip gdb-c179ace029aff5916c02168fa925b2269d7da0ec.tar.gz gdb-c179ace029aff5916c02168fa925b2269d7da0ec.tar.bz2 |
x86/APX: TILE{RELEASE,ZERO} have no EVEX encodings
Re-using the entire VEX decode hierarchy for the respective major opcode
has led to those two also being decoded as-if valid. Follow the earlier
USE_X86_64_EVEX_{PFX,W}_TABLE approach to avoid this happening.
-rw-r--r-- | opcodes/i386-dis-evex.h | 4 | ||||
-rw-r--r-- | opcodes/i386-dis.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h index 62cf7d7..45b5265 100644 --- a/opcodes/i386-dis-evex.h +++ b/opcodes/i386-dis-evex.h @@ -375,9 +375,9 @@ static const struct dis386 evex_table[][256] = { { "vpsllv%DQ", { XM, Vex, EXx }, PREFIX_DATA }, /* 48 */ { Bad_Opcode }, - { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F3849) }, + { X86_64_EVEX_MEM_W_TABLE (VEX_W_0F3849_X86_64_L_0) }, { Bad_Opcode }, - { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F384B) }, + { X86_64_EVEX_MEM_W_TABLE (VEX_W_0F384B_X86_64_L_0) }, { "vrcp14p%XW", { XM, EXx }, PREFIX_DATA }, { "vrcp14s%XW", { XMScalar, VexScalar, EXdq }, PREFIX_DATA }, { "vrsqrt14p%XW", { XM, EXx }, 0 }, diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 4a5efa7..62c37a9 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -823,6 +823,7 @@ enum USE_X86_64_EVEX_FROM_VEX_TABLE, USE_X86_64_EVEX_PFX_TABLE, USE_X86_64_EVEX_W_TABLE, + USE_X86_64_EVEX_MEM_W_TABLE, USE_3BYTE_TABLE, USE_XOP_8F_TABLE, USE_VEX_C4_TABLE, @@ -845,6 +846,7 @@ enum DIS386 (USE_X86_64_EVEX_FROM_VEX_TABLE, (I)) #define X86_64_EVEX_PFX_TABLE(I) DIS386 (USE_X86_64_EVEX_PFX_TABLE, (I)) #define X86_64_EVEX_W_TABLE(I) DIS386 (USE_X86_64_EVEX_W_TABLE, (I)) +#define X86_64_EVEX_MEM_W_TABLE(I) DIS386 (USE_X86_64_EVEX_MEM_W_TABLE, (I)) #define THREE_BYTE_TABLE(I) DIS386 (USE_3BYTE_TABLE, (I)) #define XOP_8F_TABLE() DIS386 (USE_XOP_8F_TABLE, 0) #define VEX_C4_TABLE() DIS386 (USE_VEX_C4_TABLE, 0) @@ -8802,6 +8804,7 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) case USE_X86_64_EVEX_FROM_VEX_TABLE: case USE_X86_64_EVEX_PFX_TABLE: case USE_X86_64_EVEX_W_TABLE: + case USE_X86_64_EVEX_MEM_W_TABLE: ins->evex_type = evex_from_vex; /* EVEX from VEX instructions are 64-bit only and require that EVEX.z, EVEX.L'L, EVEX.b, and the lower 2 bits of EVEX.aaa must be 0. */ @@ -8816,6 +8819,12 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) goto use_prefix_table; if (dp->op[0].bytemode == USE_X86_64_EVEX_W_TABLE) goto use_vex_w_table; + if (dp->op[0].bytemode == USE_X86_64_EVEX_MEM_W_TABLE) + { + if (ins->modrm.mod == 3) + return &bad_opcode; + goto use_vex_w_table; + } /* Fall through. */ case USE_X86_64_TABLE: |