From 9fef80d683d79934bacd3221f5252ce8c14ff5c0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 21 Jun 2017 08:28:30 -0700 Subject: x86: CET v2.0: Update NOTRACK prefix Update NOTRACK prefix handling to support memory indirect branch for CET v2.0: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf gas/ * config/tc-i386.c (md_assemble): Update NOTRACK prefix check. * testsuite/gas/i386/notrack-intel.d: Updated. * testsuite/gas/i386/notrack.d: Likewise. * testsuite/gas/i386/notrackbad.l: Likewise. * testsuite/gas/i386/x86-64-notrack-intel.d: Likewise. * testsuite/gas/i386/x86-64-notrack.d: Likewise. * testsuite/gas/i386/x86-64-notrackbad.l: Likewise. * testsuite/gas/i386/notrack.s: Add NOTRACK prefix tests with memory indirect branch. * testsuite/gas/i386/x86-64-notrack.s: Likewise. * testsuite/gas/i386/notrackbad.s: Remove memory indirect branch with NOTRACK prefix. * testsuite/gas/i386/x86-64-notrackbad.s: Likewise. opcodes/ * i386-dis.c (reg_table): Swap indirEv with NOTRACK on "call{&|}" and "jmp{&|}". (NOTRACK_Fixup): Support memory indirect branch with NOTRACK prefix. --- opcodes/i386-dis.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'opcodes/i386-dis.c') diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index d461d08594..2e35e38e2b 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -3552,9 +3552,9 @@ static const struct dis386 reg_table[][8] = { { { "incQ", { Evh1 }, 0 }, { "decQ", { Evh1 }, 0 }, - { "call{&|}", { indirEv, NOTRACK, BND }, 0 }, + { "call{&|}", { NOTRACK, indirEv, BND }, 0 }, { MOD_TABLE (MOD_FF_REG_3) }, - { "jmp{&|}", { indirEv, NOTRACK, BND }, 0 }, + { "jmp{&|}", { NOTRACK, indirEv, BND }, 0 }, { MOD_TABLE (MOD_FF_REG_5) }, { "pushU", { stackEv }, 0 }, { Bad_Opcode }, @@ -16816,14 +16816,12 @@ static void NOTRACK_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) { - if (modrm.mod == 3 - && active_seg_prefix == PREFIX_DS + if (active_seg_prefix == PREFIX_DS && (address_mode != mode_64bit || last_data_prefix < 0)) { - /* NOTRACK prefix is only valid on register indirect branch - instructions and it must be the last prefix before REX - prefix and opcode. NB: DATA prefix is unsupported for - Intel64. */ + /* NOTRACK prefix is only valid on indirect branch instructions + and it must be the last prefix before REX prefix and opcode. + NB: DATA prefix is unsupported for Intel64. */ if (last_active_prefix >= 0) { int notrack_prefix = last_active_prefix; -- cgit v1.2.3