x86: Add NOTRACK prefix support
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 22 May 2017 18:02:46 +0000 (11:02 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 22 May 2017 18:02:58 +0000 (11:02 -0700)
commit04ef582ace91cad765d056cc95624478e0421144
treece513249defa49cae554a37f0f532d696a6e788a
parent25f94347373b1b6f4bfc79eeb38e79d383195779
x86: Add NOTRACK prefix support

For register indirect branches, NOTRACK prefix (0x3e), which is also
the DS segment register prefix, can be used to ignore the CET indirect
branch track.

gas/

* config/tc-i386.c (REX_PREFIX): Changed to 7.
(NOTRACK_PREFIX): New.
(MAX_PREFIXES): Changed to 8.
(_i386_insn): Add notrack_prefix.
(PREFIX_GROUP): Add PREFIX_DS.
(add_prefix): Return PREFIX_DS for DS_PREFIX_OPCODE.
(md_assemble): Check if NOTRACK prefix is supported.
(parse_insn): Set notrack_prefix and issue an error for
other prefixes after NOTRACK prefix.
* testsuite/gas/i386/i386.exp: Run tests for NOTRACK prefix.
* testsuite/gas/i386/notrack-intel.d: New file.
* testsuite/gas/i386/notrack.d: Likewise.
* testsuite/gas/i386/notrack.s: Likewise.
* testsuite/gas/i386/notrackbad.l: Likewise.
* testsuite/gas/i386/notrackbad.s: Likewise.
* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
* testsuite/gas/i386/x86-64-notrack.d: Likewise.
* testsuite/gas/i386/x86-64-notrack.s: Likewise.
* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.

include/

* include/opcode/i386.h (NOTRACK_PREFIX_OPCODE): New.

opcodes/

* i386-dis.c (NOTRACK_Fixup): New.
(NOTRACK): Likewise.
(NOTRACK_PREFIX): Likewise.
(last_active_prefix): Likewise.
(reg_table): Use NOTRACK on indirect call and jmp.
(ckprefix): Set last_active_prefix.
(prefix_name): Return "notrack" for NOTRACK_PREFIX.
* i386-gen.c (opcode_modifiers): Add NoTrackPrefixOk.
* i386-opc.h (NoTrackPrefixOk): New.
(i386_opcode_modifier): Add notrackprefixok.
* i386-opc.tbl: Add NoTrackPrefixOk to indirect call and jmp.
Add notrack.
* i386-tbl.h: Regenerated.
21 files changed:
gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/notrack-intel.d [new file with mode: 0644]
gas/testsuite/gas/i386/notrack.d [new file with mode: 0644]
gas/testsuite/gas/i386/notrack.s [new file with mode: 0644]
gas/testsuite/gas/i386/notrackbad.l [new file with mode: 0644]
gas/testsuite/gas/i386/notrackbad.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-notrack-intel.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-notrack.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-notrack.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-notrackbad.l [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-notrackbad.s [new file with mode: 0644]
include/ChangeLog
include/opcode/i386.h
opcodes/ChangeLog
opcodes/i386-dis.c
opcodes/i386-gen.c
opcodes/i386-opc.h
opcodes/i386-opc.tbl
opcodes/i386-tbl.h