summaryrefslogtreecommitdiff
path: root/opcodes/i386-gen.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2019-12-27 09:22:03 +0100
committerJan Beulich <jbeulich@suse.com>2019-12-27 09:22:03 +0100
commit48bcea9f48cce70005307befbc604de3618bbaf7 (patch)
tree2b20e4d4a13c36eec40a4f299437715bd64d33f5 /opcodes/i386-gen.c
parent4d4eaa30055138112bd17ed6933f2da39760d9e6 (diff)
downloadbinutils-gdb-48bcea9f48cce70005307befbc604de3618bbaf7.tar.gz
x86: consolidate Disp<NN> handling a little
In memory operand addressing, which forms of displacement are permitted besides Disp8 is pretty clearly limited - outside of 64-bit mode, Disp16 or Disp32 only, depending on address size (MPX being special in not allowing Disp16), - in 64-bit mode, Disp32s or Disp64 without address size override, and solely Disp32 with one. Adjust assembler and i386-gen to match this, observing that templates already get adjusted before trying to match them against input depending on the presence of an address size prefix. This adjustment logic gets extended to all cases, as certain DispNN values should also be dropped when there's no such prefix. In fact behavior of the assembler, perhaps besides the exact diagnostics wording, should not differ between there being templates applicable to 64-bit and non-64-bit at the same time, or there being fully separate sets of templates, with their DispNN settings already reduced accordingly. This adjustment logic further gets guarded such that there wouldn't be and Disp<N> conversion based on address size prefix when this prefix doesn't control the width of the displacement (on branches other than absolute ones). These adjustments then also allow folding two MOV templates, which had been split between 64-bit and non-64-bits variants so far. Once in this area also - drop the bogus DispNN from JumpByte templates, leaving just the correct Disp8 there (compensated by i386_finalize_displacement() now setting Disp8 on their operands), - add the missing Disp32S to XBEGIN. Note that the changes make it necessary to temporarily mark a test as XFAIL; this will get taken care of by a subsequent patch. The failing parts are entirely bogus and will get replaced.
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r--opcodes/i386-gen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index b853e425e60..09fc5f8b827 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1236,7 +1236,8 @@ process_i386_operand_type (FILE *table, char *op, enum stage stage,
if (!active_cpu_flags.bitfield.cpu64
&& !active_cpu_flags.bitfield.cpumpx)
set_bitfield("Disp16", types, 1, ARRAY_SIZE (types), lineno);
- set_bitfield("Disp32", types, 1, ARRAY_SIZE (types), lineno);
+ if (!active_cpu_flags.bitfield.cpu64)
+ set_bitfield("Disp32", types, 1, ARRAY_SIZE (types), lineno);
if (!active_cpu_flags.bitfield.cpuno64)
set_bitfield("Disp32S", types, 1, ARRAY_SIZE (types), lineno);
}