From 284f02bba855e37809d001b2ce4c98fce0a8eec0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 9 Jun 1998 16:21:35 +0000 Subject: [PATCH] Tue Jun 9 12:20:05 1998 Alan Modra * config/tc-i386.h: Change Data16 to Size16, Data32 to Size32, IgnoreDataSize to IgnoreSize as they are used for address size as well as data size. * config/tc-i386.c: Likewise. Add code to reject addr32/data32 in 32-bit mode, similarly addr16/data16 and variants. --- gas/ChangeLog | 8 ++++++++ gas/config/tc-i386.c | 18 ++++++++++++++---- gas/config/tc-i386.h | 6 +++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 29bc25a..4acb72b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +Tue Jun 9 12:20:05 1998 Alan Modra + + * config/tc-i386.h: Change Data16 to Size16, Data32 to Size32, + IgnoreDataSize to IgnoreSize as they are used for address size as + well as data size. + * config/tc-i386.c: Likewise. Add code to reject addr32/data32 in + 32-bit mode, similarly addr16/data16 and variants. + Mon Jun 8 18:32:01 1998 Nick Clifton * config/tc-d30v.c (md_assemble): Fix handling of reverse diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index ea2a984..8a41231 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -934,8 +934,18 @@ md_assemble (line) if (*l != END_OF_INSN && current_templates - && (current_templates->start->opcode_modifier & IsPrefix) != 0) + && (current_templates->start->opcode_modifier & IsPrefix)) { + /* If we are in 16-bit mode, do not allow addr16 or data16. + Similarly, in 32-bit mode, do not allow addr32 or data32. */ + if ((current_templates->start->opcode_modifier & (Size16 | Size32)) + && (((current_templates->start->opcode_modifier & Size32) != 0) + ^ flag_16bit_code)) + { + as_bad (_("redundant %s prefix"), + current_templates->start->name); + return; + } /* Add prefix, checking for repeated prefixes. */ switch (add_prefix (current_templates->start->base_opcode)) { @@ -1246,9 +1256,9 @@ md_assemble (line) /* If matched instruction specifies an explicit opcode suffix, use it. */ - if (i.tm.opcode_modifier & (Data16|Data32)) + if (i.tm.opcode_modifier & (Size16 | Size32)) { - if (i.tm.opcode_modifier & Data16) + if (i.tm.opcode_modifier & Size16) i.suffix = WORD_OPCODE_SUFFIX; else i.suffix = DWORD_OPCODE_SUFFIX; @@ -1453,7 +1463,7 @@ md_assemble (line) prefix anyway. */ if ((i.suffix == DWORD_OPCODE_SUFFIX || i.suffix == LONG_OPCODE_SUFFIX) == flag_16bit_code - && !(i.tm.opcode_modifier & IgnoreDataSize)) + && !(i.tm.opcode_modifier & IgnoreSize)) { unsigned int prefix = DATA_PREFIX_OPCODE; if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */ diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 11a4d32..39f8d14 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -312,9 +312,9 @@ typedef struct #define FloatD 0x400 /* direction for float insns: MUST BE 0x400 */ #define Seg2ShortForm 0x800 /* encoding of load segment reg insns */ #define Seg3ShortForm 0x1000 /* fs/gs segment register insns. */ -#define Data16 0x2000 /* needs data prefix if in 32-bit mode */ -#define Data32 0x4000 /* needs data prefix if in 16-bit mode */ -#define IgnoreDataSize 0x8000 /* instruction ignores operand size prefix */ +#define Size16 0x2000 /* needs size prefix if in 32-bit mode */ +#define Size32 0x4000 /* needs size prefix if in 16-bit mode */ +#define IgnoreSize 0x8000 /* instruction ignores operand size prefix */ #define No_bSuf 0x10000 /* b suffix on instruction illegal */ #define No_wSuf 0x20000 /* w suffix on instruction illegal */ #define No_lSuf 0x40000 /* l suffix on instruction illegal */ -- 2.7.4