Index: src/trusted/validator_arm/testdata-thumb/it_test.S |
diff --git a/src/trusted/validator_arm/testdata-thumb/it_test.S b/src/trusted/validator_arm/testdata-thumb/it_test.S |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7dbb4b8cf4ed6a0cf7e4b357f77182c801c9f33c |
--- /dev/null |
+++ b/src/trusted/validator_arm/testdata-thumb/it_test.S |
@@ -0,0 +1,71 @@ |
+#include "masks.h" |
+.syntax unified |
+.code 16 |
+.thumb_func |
+.global _start |
+_start: |
+ // Test legit behavior |
+ cmp r0, r0 |
+ ite eq |
+ moveq r0, r0 |
+ movne r0, r0 |
+ |
+ // Pad to right before bundle boundary |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ |
+ // Test bundle issues. |
+ ite ne |
+ movne r0, r0 |
+ moveq r0, r0 |
+ |
+ // Next bundle |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ |
+ |
+ // Test legal branch |
+ ittt ne |
+ bicne r0, HIGH_TWO |
+ orrne r0, LOW_FOUR |
+ bxne r0 |
+ |
+ // Moving to next bundle for room... |
+ mov r0, r0 |
+ mov r0, r0 |
+ |
+ // Test illegal branch |
+ itet eq |
+ biceq r0, HIGH_TWO |
+ orrne r0, LOW_FOUR |
+ bxeq r0 |
+ |
+ // Moving to the next bundle again |
+ // (and partway in so we're not always aligned) |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ mov r0, r0 |
+ |
+ // Test legal data write |
+ itt cc |
+ biccc r0, HIGH_TWO |
+ strcc r1, [r0] |
+ |
+ // Pad |
+ mov r0, r0 |
+ mov r0, r0 |
+ |
+ // Test illegal data write |
+ ite cc |
+ biccc r0, HIGH_TWO |
+ strcs r1, [r0] |
+ |
+// TODO(jasonwkim) Manually add a sequence that will fire the it_safety issue. |
+// Not doing this now because the assembler will reject all such sequences, |
+// so I will have to enter the hex manually. |