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.
This commit is contained in:
H.J. Lu
2017-06-21 08:28:30 -07:00
parent 7adc0a8174
commit 9fef80d683
14 changed files with 234 additions and 89 deletions

View File

@ -1,3 +1,10 @@
2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (reg_table): Swap indirEv with NOTRACK on "call{&|}"
and "jmp{&|}".
(NOTRACK_Fixup): Support memory indirect branch with NOTRACK
prefix.
2017-06-19 Nick Clifton <nickc@redhat.com>
PR binutils/21614

View File

@ -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;