From 3138f287b13f7f83b9290011391bbf77cbf65da0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 27 Dec 1999 16:10:31 +0000 Subject: [PATCH] x86 indirect jump/call syntax fixes. Disassembly fix for lcall. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.c | 16 ++++++++-------- include/opcode/ChangeLog | 5 +++++ include/opcode/i386.h | 7 +++++-- opcodes/ChangeLog | 4 ++++ opcodes/i386-dis.c | 2 +- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 39fb313..e9ad534 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +1999-12-27 Alan Modra + + * config/tc-i386.c (MATCH): Relax JumpAbsolute check. Emit a + warning for absolute jump/call without `*' in non-intel mode. No + need to set i.types[0] JumpAbsolute in intel mode. + 1999-12-22 Philip Blundell * config/tc-arm.c (arm_s_text): If OBJ_ELF, call the appropriate diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 5219113..2aba752 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1255,9 +1255,8 @@ md_assemble (line) with the template operand types. */ #define MATCH(overlap, given, template) \ - ((overlap) \ - && ((given) & BaseIndex) == ((overlap) & BaseIndex) \ - && ((given) & JumpAbsolute) == ((template) & JumpAbsolute)) + ((overlap & ~JumpAbsolute) \ + && ((given) & (BaseIndex|JumpAbsolute)) == ((overlap) & (BaseIndex|JumpAbsolute))) /* If given types r0 and r1 are registers they must be of the same type unless the expected operand type register overlap is null. @@ -1347,11 +1346,6 @@ md_assemble (line) i.types[xchg1] = temp_type; } - if (!strcmp(mnemonic,"jmp") - || !strcmp (mnemonic, "call")) - if ((i.types[0] & Reg) || i.types[0] & BaseIndex) - i.types[0] |= JumpAbsolute; - } overlap0 = 0; overlap1 = 0; @@ -1460,6 +1454,12 @@ md_assemble (line) return; } + if (!intel_syntax + && (i.types[0] & JumpAbsolute) != (t->operand_types[0] & JumpAbsolute)) + { + as_warn (_("Indirect %s without `*'"), t->name); + } + if ((t->opcode_modifier & (IsPrefix|IgnoreSize)) == (IsPrefix|IgnoreSize)) { /* Warn them that a data or address size prefix doesn't affect diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index f1038dc..fb573cc 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,8 @@ +1999-12-27 Alan Modra + + * i386.h: Add JumpAbsolute qualifier to all non-intel mode + indirect jumps and calls. Add FF/3 call for intel mode. + Wed Dec 1 03:05:25 1999 Jeffrey A Law (law@cygnus.com) * mn10300.h: Add new operand types. Add new instruction formats. diff --git a/include/opcode/i386.h b/include/opcode/i386.h index 7e3a564..c5f6217 100644 --- a/include/opcode/i386.h +++ b/include/opcode/i386.h @@ -315,17 +315,20 @@ static const template i386_optab[] = { {"call", 1, 0xff, 2, wl_Suf|Modrm|DefaultSize, { WordReg|WordMem|JumpAbsolute, 0, 0} }, /* Intel Syntax */ {"call", 2, 0x9a, X, wl_Suf|JumpInterSegment|DefaultSize, { Imm16, Imm16|Imm32, 0} }, +/* Intel Syntax */ +{"call", 1, 0xff, 3, wl_Suf|Modrm|DefaultSize, { WordMem, 0, 0} }, {"lcall", 2, 0x9a, X, wl_Suf|JumpInterSegment|DefaultSize, { Imm16, Imm16|Imm32, 0} }, -{"lcall", 1, 0xff, 3, wl_Suf|Modrm|DefaultSize, { WordMem, 0, 0} }, +{"lcall", 1, 0xff, 3, wl_Suf|Modrm|DefaultSize, { WordMem|JumpAbsolute, 0, 0} }, #define JUMP_PC_RELATIVE 0xeb {"jmp", 1, 0xeb, X, NoSuf|Jump, { Disp, 0, 0} }, {"jmp", 1, 0xff, 4, wl_Suf|Modrm, { WordReg|WordMem|JumpAbsolute, 0, 0} }, /* Intel Syntax */ {"jmp", 2, 0xea, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} }, +/* Intel Syntax */ {"jmp", 1, 0xff, 5, wl_Suf|Modrm, { WordMem, 0, 0} }, {"ljmp", 2, 0xea, X, wl_Suf|JumpInterSegment, { Imm16, Imm16|Imm32, 0} }, -{"ljmp", 1, 0xff, 5, wl_Suf|Modrm, { WordMem, 0, 0} }, +{"ljmp", 1, 0xff, 5, wl_Suf|Modrm, { WordMem|JumpAbsolute, 0, 0} }, {"ret", 0, 0xc3, X, wl_Suf|DefaultSize, { 0, 0, 0} }, {"ret", 1, 0xc2, X, wl_Suf|DefaultSize, { Imm16, 0, 0} }, diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0b222d0..f5b0971 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +1999-12-27 Alan Modra + + * i386-dis.c (grps[]): Correct GRP5 FF/3 from "call" to "lcall". + Wed Dec 1 03:34:53 1999 Jeffrey A Law (law@cygnus.com) * m10300-opc.c, m10300-dis.c: Add am33 support. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 3018b7b..a75d6e3 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -1749,7 +1749,7 @@ static const struct dis386 grps[][8] = { { "incQ", Ev, XX, XX }, { "decQ", Ev, XX, XX }, { "callP", indirEv, XX, XX }, - { "callP", indirEv, XX, XX }, + { "lcallP", indirEv, XX, XX }, { "jmpP", indirEv, XX, XX }, { "ljmpP", indirEv, XX, XX }, { "pushQ", Ev, XX, XX }, -- 2.7.4