diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-03-29 12:04:03 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-03-29 12:04:03 +0200 |
commit | 73e45eb208585e672945078b28fc8381c6f6ba5f (patch) | |
tree | ef991416848f48625b0876fc75e8c469f543a947 /opcodes/i386-gen.c | |
parent | 9df6f676c2c7280dc0c419c43927a07c6359814d (diff) | |
download | binutils-gdb-73e45eb208585e672945078b28fc8381c6f6ba5f.tar.gz |
x86: undo Prefix_0X<nn> use in opcode table
The table entries are more natural to read (and slightly shorter) when
the prefixes, like is the case for VEX/XOP/EVEX-encoded entries, are
specified as part of the opcode. This is particularly noticable for
side-by-side legacy and SSE2AVX entries.
An implication is that we now need to use "unsigned long long" for the
initially parsed opcode in i386-gen. I don't expect this to be an issue.
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r-- | opcodes/i386-gen.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index f514135b0d1..85ee1d5ea2e 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1371,7 +1371,7 @@ output_i386_opcode (FILE *table, const char *name, char *str, unsigned int i, length, prefix = 0, space = 0; char *base_opcode, *extension_opcode, *end; char *cpu_flags, *opcode_modifier, *operand_types [MAX_OPERANDS]; - unsigned long int opcode; + unsigned long long opcode; /* Find base_opcode. */ base_opcode = next_field (str, ',', &str, last); @@ -1418,10 +1418,10 @@ output_i386_opcode (FILE *table, const char *name, char *str, } } - opcode = strtoul (base_opcode, &end, 0); + opcode = strtoull (base_opcode, &end, 0); /* Determine opcode length. */ - for (length = 1; length < 4; ++length) + for (length = 1; length < 8; ++length) if (!(opcode >> (8 * length))) break; @@ -1437,7 +1437,7 @@ output_i386_opcode (FILE *table, const char *name, char *str, } if (prefix) - opcode &= (1UL << (8 * --length)) - 1; + opcode &= (1ULL << (8 * --length)) - 1; } /* Transform opcode space encoded in the opcode into opcode modifier @@ -1454,10 +1454,14 @@ output_i386_opcode (FILE *table, const char *name, char *str, if (space != SPACE_0F && --length == 1) fail (_("%s:%d: %s: unrecognized opcode encoding space\n"), filename, lineno, name); - opcode &= (1UL << (8 * --length)) - 1; + opcode &= (1ULL << (8 * --length)) - 1; } - fprintf (table, " { \"%s\", 0x%0*lx%s, %s, %lu,\n", + if (length > 2) + fail (_("%s:%d: %s: residual opcode (0x%0*llx) too large\n"), + filename, lineno, name, 2 * length, opcode); + + fprintf (table, " { \"%s\", 0x%0*llx%s, %s, %lu,\n", name, 2 * (int)length, opcode, end, extension_opcode, i); process_i386_opcode_modifier (table, opcode_modifier, space, prefix, |