Index: src/trusted/validator_x86/testdata/64/rep_tests.tf |
diff --git a/src/trusted/validator_x86/testdata/64/rep_tests.tf b/src/trusted/validator_x86/testdata/64/rep_tests.tf |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1e167919e2fc26f1d8173662ece0c27ed912d35d |
--- /dev/null |
+++ b/src/trusted/validator_x86/testdata/64/rep_tests.tf |
@@ -0,0 +1,81 @@ |
+BITS: 64 |
+OUTCOME: invalid |
+ |
+# This file does some simple tests to see if we recognize when the REP/REPNE (F2 F3) |
+# prefix bytes are allowed. |
+ |
+# The following is an example of an instruction without the REP/REPNE prefix. |
+# add %al, %al |
+asm: add %al,%al |
+hex: 00 c0 |
+ |
+ |
+# The following is the same instruction with an illegal REP prefix. |
+hex: f3 00 c0 |
+nc_out: ERROR: Use of REP (F3) prefix for instruction not allowed by Native Client |
+ |
+ |
+# The following is the same instruction with an illegal REPNE prefix. |
+hex: f2 00 c0 |
+nc_out: ERROR: Use of REPNE (F2) prefix for instruction not allowed by Native Client |
+ |
+ |
+# The following is an example of a multibyte instruction explicitly requiring |
+# a REP prefix. |
+# movss %xmm0, [%rdx] |
+asm: movss (%rdx),%xmm0 |
+hex: f3 0f 10 02 |
+nc_out: ERROR: Invalid base register in memory offset |
+ |
+ |
+# The following is an example of a multibyte instruction explicitly requiring |
+# a REPNE prefix. |
+# movsd [%rsp+0x10], %xmm2 |
+asm: movsd %xmm2,0x10(%rsp) |
+hex: f2 0f 11 54 24 10 |
+ |
+ |
+# The following is an example of an instruction that can get a REP prefix. |
+# insb |
+asm: insb (%dx),%es:(%rdi) |
+hex: 6c |
+nc_out: ERROR: This instruction has been marked illegal by Native Client |
+nc_out: ERROR: Segment memory reference not allowed |
+ |
+ |
+# The same instrucition with a REP prefix. |
+asm: rep insb (%dx),%es:(%rdi) |
+hex: f3 6c |
+nc_out: ERROR: This instruction has been marked illegal by Native Client |
+nc_out: ERROR: Segment memory reference not allowed |
+ |
+ |
+# The same instruction with a REPNE prefix. |
+asm: repnz insb (%dx),%es:(%rdi) |
+hex: f2 6c |
+nc_out: ERROR: This instruction has been marked illegal by Native Client |
+nc_out: ERROR: Use of REPNE (F2) prefix for instruction not allowed by Native Client |
+nc_out: ERROR: Segment memory reference not allowed |
+ |
+ |
+# The following is an example of an instruction that can get a REP/REPNE prefix. |
+# cmpsb |
+asm: cmpsb %es:(%rdi),%ds:(%rsi) |
+hex: a6 |
+nc_out: ERROR: Segment memory reference not allowed |
+nc_out: ERROR: Segment memory reference not allowed |
+ |
+ |
+# The same instruction with a REP prefix. |
+asm: repz cmpsb %es:(%rdi),%ds:(%rsi) |
+hex: f3 a6 |
+nc_out: ERROR: Segment memory reference not allowed |
+nc_out: ERROR: Segment memory reference not allowed |
+ |
+ |
+# The same instruction with a REPNE prefix |
+asm: repnz cmpsb %es:(%rdi),%ds:(%rsi) |
+hex: f2 a6 |
+nc_out: ERROR: Segment memory reference not allowed |
+nc_out: ERROR: Segment memory reference not allowed |
+ |