diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-05-22 11:02:46 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-05-22 11:02:58 -0700 |
commit | 04ef582ace91cad765d056cc95624478e0421144 (patch) | |
tree | ce513249defa49cae554a37f0f532d696a6e788a /gas | |
parent | 25f94347373b1b6f4bfc79eeb38e79d383195779 (diff) | |
download | gdb-04ef582ace91cad765d056cc95624478e0421144.zip gdb-04ef582ace91cad765d056cc95624478e0421144.tar.gz gdb-04ef582ace91cad765d056cc95624478e0421144.tar.bz2 |
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.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 23 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 75 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/notrack-intel.d | 29 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/notrack.d | 28 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/notrack.s | 35 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/notrackbad.l | 52 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/notrackbad.s | 22 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-notrack-intel.d | 30 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-notrack.d | 29 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-notrack.s | 40 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-notrackbad.l | 52 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-notrackbad.s | 22 |
13 files changed, 426 insertions, 17 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 58a3ffa..6926e97 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,26 @@ +2017-05-22 H.J. Lu <hongjiu.lu@intel.com> + + * 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. + 2017-05-22 Jiong Wang <jiong.wang@arm.com> * configure.tgt: Set "arch" to "aarch64" if ${cpu} equals "aarch64". diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 6250793..6c1091e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -66,8 +66,11 @@ #define HLE_PREFIX REP_PREFIX #define BND_PREFIX REP_PREFIX #define LOCK_PREFIX 5 -#define REX_PREFIX 6 /* must come last. */ -#define MAX_PREFIXES 7 /* max prefixes per opcode */ +/* Only one of NOTRACK_PREFIX and SEG_PREFIX can be used at the same + time. */ +#define NOTRACK_PREFIX 6 +#define REX_PREFIX 7 /* must come last. */ +#define MAX_PREFIXES 8 /* max prefixes per opcode */ /* we define the syntax here (modulo base,index,scale syntax) */ #define REGISTER_PREFIX '%' @@ -388,6 +391,9 @@ struct _i386_insn /* Have BND prefix. */ const char *bnd_prefix; + /* Have NOTRACK prefix. */ + const char *notrack_prefix; + /* Error message. */ enum i386_error error; }; @@ -2144,6 +2150,7 @@ enum PREFIX_GROUP PREFIX_EXIST = 0, PREFIX_LOCK, PREFIX_REP, + PREFIX_DS, PREFIX_OTHER }; @@ -2152,7 +2159,8 @@ enum PREFIX_GROUP same class already exists. b. PREFIX_LOCK if lock prefix is added. c. PREFIX_REP if rep/repne prefix is added. - d. PREFIX_OTHER if other prefix is added. + d. PREFIX_DS if ds prefix is added. + e. PREFIX_OTHER if other prefix is added. */ static enum PREFIX_GROUP @@ -2177,8 +2185,10 @@ add_prefix (unsigned int prefix) default: abort (); - case CS_PREFIX_OPCODE: case DS_PREFIX_OPCODE: + ret = PREFIX_DS; + /* Fall through. */ + case CS_PREFIX_OPCODE: case ES_PREFIX_OPCODE: case FS_PREFIX_OPCODE: case GS_PREFIX_OPCODE: @@ -3702,6 +3712,15 @@ md_assemble (char *line) if (i.bnd_prefix && !i.tm.opcode_modifier.bndprefixok) as_bad (_("expecting valid branch instruction after `bnd'")); + /* Check NOTRACK prefix. */ + if (i.notrack_prefix + && (!i.tm.opcode_modifier.notrackprefixok + || i.reg_operands != 1 + || i.disp_operands != 0 + || i.mem_operands != 0 + || i.imm_operands != 0)) + as_bad (_("expecting register indirect branch instruction after `notrack'")); + if (i.tm.cpu_flags.bitfield.cpumpx) { if (flag_code == CODE_64BIT && i.prefix[ADDR_PREFIX]) @@ -3964,20 +3983,42 @@ parse_insn (char *line, char *mnemonic) else { /* Add prefix, checking for repeated prefixes. */ - switch (add_prefix (current_templates->start->base_opcode)) + enum PREFIX_GROUP p + = add_prefix (current_templates->start->base_opcode); + if (p == PREFIX_DS + && current_templates->start->cpu_flags.bitfield.cpucet) { - case PREFIX_EXIST: - return NULL; - case PREFIX_REP: - if (current_templates->start->cpu_flags.bitfield.cpuhle) - i.hle_prefix = current_templates->start->name; - else if (current_templates->start->cpu_flags.bitfield.cpumpx) - i.bnd_prefix = current_templates->start->name; - else - i.rep_prefix = current_templates->start->name; - break; - default: - break; + i.notrack_prefix = current_templates->start->name; + /* Move NOTRACK_PREFIX_OPCODE to NOTRACK_PREFIX slot so + that it is placed before others. */ + i.prefix[SEG_PREFIX] = 0; + i.prefix[NOTRACK_PREFIX] = NOTRACK_PREFIX_OPCODE; + } + else + { + switch (p) + { + case PREFIX_EXIST: + return NULL; + case PREFIX_REP: + if (current_templates->start->cpu_flags.bitfield.cpuhle) + i.hle_prefix = current_templates->start->name; + else if (current_templates->start->cpu_flags.bitfield.cpumpx) + i.bnd_prefix = current_templates->start->name; + else + i.rep_prefix = current_templates->start->name; + break; + default: + break; + } + + if (i.notrack_prefix != NULL) + { + /* There must be no other prefixes after NOTRACK + prefix. */ + as_bad (_("expecting no other prefixes after `notrack'")); + return NULL; + } } } /* Skip past PREFIX_SEPARATOR and reset token_start. */ diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index c1d6af7..67a7a13 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -385,6 +385,9 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "cet" run_dump_test "cet-intel" run_dump_test "pseudos" + run_dump_test "notrack" + run_dump_test "notrack-intel" + run_list_test "notrackbad" "-al" # These tests require support for 8 and 16 bit relocs, # so we only run them for ELF and COFF targets. @@ -805,6 +808,9 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-cet" run_dump_test "x86-64-cet-intel" run_dump_test "x86-64-pseudos" + run_dump_test "x86-64-notrack" + run_dump_test "x86-64-notrack-intel" + run_list_test "x86-64-notrackbad" "-al" if { ![istarget "*-*-aix*"] && ![istarget "*-*-beos*"] diff --git a/gas/testsuite/gas/i386/notrack-intel.d b/gas/testsuite/gas/i386/notrack-intel.d new file mode 100644 index 0000000..b99e194 --- /dev/null +++ b/gas/testsuite/gas/i386/notrack-intel.d @@ -0,0 +1,29 @@ +#source: notrack.s +#objdump: -dw -Mintel +#name: i386 NOTRACK prefix (Intel disassembly) + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 3e ff d0 notrack call eax +[ ]*[a-f0-9]+: 66 3e ff d0 notrack call ax +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp eax +[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmp ax +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call eax +[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack call ax +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp eax +[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmp ax +[ ]*[a-f0-9]+: 3e ff d0 notrack call eax +[ ]*[a-f0-9]+: 66 3e ff d0 notrack call ax +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp eax +[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmp ax +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call eax +[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack call ax +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp eax +[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmp ax +[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call eax +[ ]*[a-f0-9]+: 3e 66 ff d0 ds call ax +#pass diff --git a/gas/testsuite/gas/i386/notrack.d b/gas/testsuite/gas/i386/notrack.d new file mode 100644 index 0000000..eda09eb --- /dev/null +++ b/gas/testsuite/gas/i386/notrack.d @@ -0,0 +1,28 @@ +#objdump: -dw +#name: i386 NOTRACK prefix + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 3e ff d0 notrack call \*%eax +[ ]*[a-f0-9]+: 66 3e ff d0 notrack callw \*%ax +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp \*%eax +[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmpw \*%ax +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call \*%eax +[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack callw \*%ax +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp \*%eax +[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmpw \*%ax +[ ]*[a-f0-9]+: 3e ff d0 notrack call \*%eax +[ ]*[a-f0-9]+: 66 3e ff d0 notrack callw \*%ax +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp \*%eax +[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmpw \*%ax +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call \*%eax +[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack callw \*%ax +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp \*%eax +[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmpw \*%ax +[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call \*%eax +[ ]*[a-f0-9]+: 3e 66 ff d0 ds callw \*%ax +#pass diff --git a/gas/testsuite/gas/i386/notrack.s b/gas/testsuite/gas/i386/notrack.s new file mode 100644 index 0000000..3b8b210 --- /dev/null +++ b/gas/testsuite/gas/i386/notrack.s @@ -0,0 +1,35 @@ +# Check 32bit NOTRACK prefix + + .allow_index_reg + .text +_start: + notrack call *%eax + notrack call *%ax + notrack jmp *%eax + notrack jmp *%ax + + bnd notrack call *%eax + bnd notrack call *%ax + bnd notrack jmp *%eax + bnd notrack jmp *%ax + + .intel_syntax noprefix + notrack call eax + notrack call ax + notrack jmp eax + notrack jmp ax + + bnd notrack call eax + bnd notrack call ax + bnd notrack jmp eax + bnd notrack jmp ax + + .byte 0x3e + .byte 0xf2 + .byte 0xff + .byte 0xd0 + + .byte 0x3e + .byte 0x66 + .byte 0xff + .byte 0xd0 diff --git a/gas/testsuite/gas/i386/notrackbad.l b/gas/testsuite/gas/i386/notrackbad.l new file mode 100644 index 0000000..b092ab2 --- /dev/null +++ b/gas/testsuite/gas/i386/notrackbad.l @@ -0,0 +1,52 @@ +.*: Assembler messages: +.*:6: Error: expecting register indirect branch instruction after `notrack' +.*:6: Warning: skipping prefixes on this instruction +.*:7: Error: expecting register indirect branch instruction after `notrack' +.*:7: Warning: skipping prefixes on this instruction +.*:9: Error: expecting register indirect branch instruction after `notrack' +.*:10: Error: expecting register indirect branch instruction after `notrack' +.*:11: Error: same type of prefix used twice +.*:12: Error: expecting no other prefixes after `notrack' +.*:13: Error: expecting no other prefixes after `notrack' +.*:14: Error: expecting no other prefixes after `notrack' +.*:17: Error: expecting register indirect branch instruction after `notrack' +.*:18: Error: expecting register indirect branch instruction after `notrack' +.*:19: Error: same type of prefix used twice +.*:20: Error: expecting no other prefixes after `notrack' +.*:21: Error: expecting no other prefixes after `notrack' +.*:22: Error: expecting no other prefixes after `notrack' +GAS LISTING .* + + +[ ]*1[ ]+\# Check 32bit unsupported NOTRACK prefix +[ ]*2[ ]+ +[ ]*3[ ]+\.allow_index_reg +[ ]*4[ ]+\.text +[ ]*5[ ]+_start: +[ ]*6[ ]+\?\?\?\? E8FCFFFF notrack call foo +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +\*\*\*\* Warning: skipping prefixes on this instruction +[ ]*6[ ]+FF +[ ]*7[ ]+\?\?\?\? E9FCFFFF notrack jmp foo +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +\*\*\*\* Warning: skipping prefixes on this instruction +[ ]*7[ ]+FF +[ ]*8[ ]+ +[ ]*9[ ]+\?\?\?\? 3EFF10 notrack call \*\(%eax\) +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*10[ ]+\?\?\?\? 3EFF20 notrack jmp \*\(%eax\) +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*11[ ]+fs notrack call \*%eax +[ ]*12[ ]+notrack fs call \*%eax +[ ]*13[ ]+notrack bnd call \*%eax +[ ]*14[ ]+notrack data16 call \*%eax +[ ]*15[ ]+ +[ ]*16[ ]+\.intel_syntax noprefix +[ ]*17[ ]+\?\?\?\? 3EFF10 notrack call \[eax\] +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*18[ ]+\?\?\?\? 3EFF20 notrack jmp \[eax\] +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*19[ ]+fs notrack call eax +[ ]*20[ ]+notrack fs call eax +[ ]*21[ ]+notrack bnd call eax +[ ]*22[ ]+notrack data16 call eax diff --git a/gas/testsuite/gas/i386/notrackbad.s b/gas/testsuite/gas/i386/notrackbad.s new file mode 100644 index 0000000..c7eae50 --- /dev/null +++ b/gas/testsuite/gas/i386/notrackbad.s @@ -0,0 +1,22 @@ +# Check 32bit unsupported NOTRACK prefix + + .allow_index_reg + .text +_start: + notrack call foo + notrack jmp foo + + notrack call *(%eax) + notrack jmp *(%eax) + fs notrack call *%eax + notrack fs call *%eax + notrack bnd call *%eax + notrack data16 call *%eax + + .intel_syntax noprefix + notrack call [eax] + notrack jmp [eax] + fs notrack call eax + notrack fs call eax + notrack bnd call eax + notrack data16 call eax diff --git a/gas/testsuite/gas/i386/x86-64-notrack-intel.d b/gas/testsuite/gas/i386/x86-64-notrack-intel.d new file mode 100644 index 0000000..6e0cfdb --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-notrack-intel.d @@ -0,0 +1,30 @@ +#source: x86-64-notrack.s +#objdump: -dw -Mintel +#name: x86-64 NOTRACK prefix (Intel disassembly) + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 3e ff d0 notrack call rax +[ ]*[a-f0-9]+: 3e 41 ff d0 notrack call r8 +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp rax +[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmp r8 +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call rax +[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack call r8 +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp rax +[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmp r8 +[ ]*[a-f0-9]+: 3e ff d0 notrack call rax +[ ]*[a-f0-9]+: 3e 41 ff d0 notrack call r8 +[ ]*[a-f0-9]+: 3e ff e0 notrack jmp rax +[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmp r8 +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call rax +[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack call r8 +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp rax +[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmp r8 +[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call rax +[ ]*[a-f0-9]+: 3e 66 ff d0 ds call ax +[ ]*[a-f0-9]+: 66 3e ff d0 ds call ax +#pass diff --git a/gas/testsuite/gas/i386/x86-64-notrack.d b/gas/testsuite/gas/i386/x86-64-notrack.d new file mode 100644 index 0000000..0f63f12 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-notrack.d @@ -0,0 +1,29 @@ +#objdump: -dw +#name: x86-64 NOTRACK prefix + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 3e ff d0 notrack callq \*%rax +[ ]*[a-f0-9]+: 3e 41 ff d0 notrack callq \*%r8 +[ ]*[a-f0-9]+: 3e ff e0 notrack jmpq \*%rax +[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmpq \*%r8 +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack callq \*%rax +[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack callq \*%r8 +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmpq \*%rax +[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmpq \*%r8 +[ ]*[a-f0-9]+: 3e ff d0 notrack callq \*%rax +[ ]*[a-f0-9]+: 3e 41 ff d0 notrack callq \*%r8 +[ ]*[a-f0-9]+: 3e ff e0 notrack jmpq \*%rax +[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmpq \*%r8 +[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack callq \*%rax +[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack callq \*%r8 +[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmpq \*%rax +[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmpq \*%r8 +[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd callq \*%rax +[ ]*[a-f0-9]+: 3e 66 ff d0 ds callw \*%ax +[ ]*[a-f0-9]+: 66 3e ff d0 ds callw \*%ax +#pass diff --git a/gas/testsuite/gas/i386/x86-64-notrack.s b/gas/testsuite/gas/i386/x86-64-notrack.s new file mode 100644 index 0000000..f90a870 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-notrack.s @@ -0,0 +1,40 @@ +# Check 64bit NOTRACK prefix + + .allow_index_reg + .text +_start: + notrack call *%rax + notrack call *%r8 + notrack jmp *%rax + notrack jmp *%r8 + + bnd notrack call *%rax + bnd notrack call *%r8 + bnd notrack jmp *%rax + bnd notrack jmp *%r8 + + .intel_syntax noprefix + notrack call rax + notrack call r8 + notrack jmp rax + notrack jmp r8 + + bnd notrack call rax + bnd notrack call r8 + bnd notrack jmp rax + bnd notrack jmp r8 + + .byte 0x3e + .byte 0xf2 + .byte 0xff + .byte 0xd0 + + .byte 0x3e + .byte 0x66 + .byte 0xff + .byte 0xd0 + + .byte 0x66 + .byte 0x3e + .byte 0xff + .byte 0xd0 diff --git a/gas/testsuite/gas/i386/x86-64-notrackbad.l b/gas/testsuite/gas/i386/x86-64-notrackbad.l new file mode 100644 index 0000000..a72e37d --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-notrackbad.l @@ -0,0 +1,52 @@ +.*: Assembler messages: +.*:6: Error: expecting register indirect branch instruction after `notrack' +.*:6: Warning: skipping prefixes on this instruction +.*:7: Error: expecting register indirect branch instruction after `notrack' +.*:7: Warning: skipping prefixes on this instruction +.*:9: Error: expecting register indirect branch instruction after `notrack' +.*:10: Error: expecting register indirect branch instruction after `notrack' +.*:11: Error: same type of prefix used twice +.*:12: Error: expecting no other prefixes after `notrack' +.*:13: Error: expecting no other prefixes after `notrack' +.*:14: Error: expecting no other prefixes after `notrack' +.*:17: Error: expecting register indirect branch instruction after `notrack' +.*:18: Error: expecting register indirect branch instruction after `notrack' +.*:19: Error: same type of prefix used twice +.*:20: Error: expecting no other prefixes after `notrack' +.*:21: Error: expecting no other prefixes after `notrack' +.*:22: Error: expecting no other prefixes after `notrack' +GAS LISTING .* + + +[ ]*1[ ]+\# Check 64bit unsupported NOTRACK prefix +[ ]*2[ ]+ +[ ]*3[ ]+\.allow_index_reg +[ ]*4[ ]+\.text +[ ]*5[ ]+_start: +[ ]*6[ ]+\?\?\?\? E8000000 notrack call foo +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +\*\*\*\* Warning: skipping prefixes on this instruction +[ ]*6[ ]+00 +[ ]*7[ ]+\?\?\?\? E9000000 notrack jmp foo +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +\*\*\*\* Warning: skipping prefixes on this instruction +[ ]*7[ ]+00 +[ ]*8[ ]+ +[ ]*9[ ]+\?\?\?\? 3EFF10 notrack call \*\(%rax\) +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*10[ ]+\?\?\?\? 3EFF20 notrack jmp \*\(%rax\) +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*11[ ]+fs notrack call \*%rax +[ ]*12[ ]+notrack fs call \*%rax +[ ]*13[ ]+notrack bnd call \*%rax +[ ]*14[ ]+notrack data16 call \*%rax +[ ]*15[ ]+ +[ ]*16[ ]+\.intel_syntax noprefix +[ ]*17[ ]+\?\?\?\? 3EFF10 notrack call \[rax\] +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*18[ ]+\?\?\?\? 3EFF20 notrack jmp \[rax\] +\*\*\*\* Error: expecting register indirect branch instruction after `notrack' +[ ]*19[ ]+fs notrack call rax +[ ]*20[ ]+notrack fs call rax +[ ]*21[ ]+notrack bnd call rax +[ ]*22[ ]+notrack data16 call rax diff --git a/gas/testsuite/gas/i386/x86-64-notrackbad.s b/gas/testsuite/gas/i386/x86-64-notrackbad.s new file mode 100644 index 0000000..59d6248 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-notrackbad.s @@ -0,0 +1,22 @@ +# Check 64bit unsupported NOTRACK prefix + + .allow_index_reg + .text +_start: + notrack call foo + notrack jmp foo + + notrack call *(%rax) + notrack jmp *(%rax) + fs notrack call *%rax + notrack fs call *%rax + notrack bnd call *%rax + notrack data16 call *%rax + + .intel_syntax noprefix + notrack call [rax] + notrack jmp [rax] + fs notrack call rax + notrack fs call rax + notrack bnd call rax + notrack data16 call rax |