From 51c8edf68bf1e16c6d05fbb31a36e0cc436a9750 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 12 Nov 2019 09:09:31 +0100 Subject: x86: fold EsSeg into IsString EsSeg (a per-operand bit) is used with IsString (a per-insn attribute) only. Extend the attribute to 2 bits, thus allowing to encode - not a string insn, - string insn with neither operand requiring use of %es:, - string insn with 1st operand requiring use of %es:, - string insn with 2nd operand requiring use of %es:, which covers all possible cases, allowing to drop EsSeg. The (transient) need to comment out the OTUnused #define did uncover an oversight in the earlier OTMax -> OTNum conversion, which is being taken care of here. --- opcodes/i386-opc.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'opcodes/i386-opc.h') diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 8f6cd04..fe20142 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -443,7 +443,11 @@ enum No_ldSuf, /* instruction needs FWAIT */ FWait, - /* quick test for string instructions */ + /* IsString provides for a quick test for string instructions, and + its actual value also indicates which of the operands (if any) + requires use of the %es segment. */ +#define IS_STRING_ES_OP0 2 +#define IS_STRING_ES_OP1 3 IsString, /* RegMem is for instructions with a modrm byte where the register destination operand should be encoded in the mod and regmem fields. @@ -661,7 +665,7 @@ typedef struct i386_opcode_modifier unsigned int no_qsuf:1; unsigned int no_ldsuf:1; unsigned int fwait:1; - unsigned int isstring:1; + unsigned int isstring:2; unsigned int regmem:1; unsigned int bndprefixok:1; unsigned int notrackprefixok:1; @@ -772,8 +776,6 @@ enum BaseIndex, /* Absolute address for jump. */ JumpAbsolute, - /* String insn operand with fixed es segment */ - EsSeg, /* BYTE size. */ Byte, /* WORD size. 2 byte */ @@ -807,8 +809,9 @@ enum (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT) /* If you get a compiler error for zero width of the unused field, - comment it out. */ + comment it out. #define OTUnused OTNum +*/ typedef union i386_operand_type { @@ -830,7 +833,6 @@ typedef union i386_operand_type unsigned int disp64:1; unsigned int baseindex:1; unsigned int jumpabsolute:1; - unsigned int esseg:1; unsigned int byte:1; unsigned int word:1; unsigned int dword:1; -- cgit v1.1