diff options
author | Jan Beulich <jbeulich@suse.com> | 2019-10-30 09:05:46 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2019-10-30 09:05:46 +0100 |
commit | 507916b8551f6227da9fe8071267c164a3014b79 (patch) | |
tree | 3c019d5339902332e6faca696ab8f9e60aad73e1 /opcodes/i386-gen.c | |
parent | 74fb338f4689b1072a5933102fe1f08caab5bac6 (diff) | |
download | gdb-507916b8551f6227da9fe8071267c164a3014b79.zip gdb-507916b8551f6227da9fe8071267c164a3014b79.tar.gz gdb-507916b8551f6227da9fe8071267c164a3014b79.tar.bz2 |
x86: drop stray W
The flag is used to indicate opcodes which can be switched between byte
and word/dword/qword forms (in a "canonical" way). Obviously it's quite
odd then to see it on insns not allowing for byte operands in the first
place. As a result the opcode bytes need to be adjusted accordingly,
which includes comparisons done in optimize_encoding().
To make re-introduction of such issues less likely have i386-gen
diagnose it (in a generally non-fatal way for now).
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r-- | opcodes/i386-gen.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index 0c7ea10..1c5082e 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1107,6 +1107,8 @@ process_i386_opcode_modifier (FILE *table, char *mod, char **opnd, int lineno) if (strcmp (mod, "0")) { + unsigned int have_w = 0, bwlq_suf = 0xf; + last = mod + strlen (mod); for (next = mod; next && next < last; ) { @@ -1120,8 +1122,30 @@ process_i386_opcode_modifier (FILE *table, char *mod, char **opnd, int lineno) lineno); if (strcasecmp(str, "IsString") == 0) active_isstring = 1; + + if (strcasecmp(str, "W") == 0) + have_w = 1; + + if (strcasecmp(str, "No_bSuf") == 0) + bwlq_suf &= ~1; + if (strcasecmp(str, "No_wSuf") == 0) + bwlq_suf &= ~2; + if (strcasecmp(str, "No_lSuf") == 0) + bwlq_suf &= ~4; + if (strcasecmp(str, "No_qSuf") == 0) + bwlq_suf &= ~8; } } + + if (have_w && !bwlq_suf) + fail ("%s: %d: stray W modifier\n", filename, lineno); + if (have_w && !(bwlq_suf & 1)) + fprintf (stderr, "%s: %d: W modifier without Byte operand(s)\n", + filename, lineno); + if (have_w && !(bwlq_suf & ~1)) + fprintf (stderr, + "%s: %d: W modifier without Word/Dword/Qword operand(s)\n", + filename, lineno); } output_opcode_modifier (table, modifiers, ARRAY_SIZE (modifiers)); } |