Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1351)

Unified Diff: src/trusted/validator_mips/testdata/test_jmp_reg.S

Issue 9979025: [MIPS] Adding validator for MIPS architecture. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Rebased patch, conflict resolved. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/trusted/validator_mips/testdata/test_jmp_reg.S
diff --git a/src/trusted/validator_mips/testdata/test_jmp_reg.S b/src/trusted/validator_mips/testdata/test_jmp_reg.S
new file mode 100644
index 0000000000000000000000000000000000000000..a7e92695d1cdaafffdd67ccc344bb11e3cfa8853
--- /dev/null
+++ b/src/trusted/validator_mips/testdata/test_jmp_reg.S
@@ -0,0 +1,84 @@
+# Copyright 2012 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can
+# be found in the LICENSE file.
+
+#
+# Test jump register instructions (jr and jalr).
+#
+
+.globl _start
+_start:
+.align 4
+.set noreorder
+.set JUMP_MASK,$t6
+.set STORE_MASK,$t7
+
+bundle_8mod16_jr:
+ nop
+ and $t1,$t1,JUMP_MASK
+ jr $t1 # OK
+ nop # Instruction in the delay slot is indented.
+
+bundle_4mod16_jr:
+ and $t1,$t1,JUMP_MASK
+ jr $t1 # OK
+ nop
+ nop
+
+bundle_8mod16_jalr:
+ nop
+ and $t1,$t1,JUMP_MASK
+ jalr $t1 # OK
+ nop
+
+ # Jalr instruction not at bundle offset 8.
+
+bundle_4mod16_jalr:
+ and $t1,$t1,JUMP_MASK
+ jalr $t1 # Error, misaligned call.
+ nop
+ and $a1,$a1,JUMP_MASK
+
+cross_bundle:
+ jr $a1 # Error, pseudo-instruction crosses bundle.
+ nop
+ nop
+ nop
+
+bundle_bad_mask:
+ addiu $a0, $zero, 16
+ and $a1, $a1, STORE_MASK
+ jalr $a1 # Error, bad jump mask.
+ nop
+
+bundle_no_mask:
+ addiu $a0, $zero, 16
+ lw $a2, 16($sp)
+ jalr $a1 # Error, no jump mask.
+ nop
+
+bundle_jalr_t0_t9:
+ addu $s0, $a0, $a1
+ and $v0, $v0, JUMP_MASK
+ jalr $t0, $v0 # ok
+ nop
+
+bundle_jalr_t7_t9:
+ addu $s0, $a0, $a1
+ and $v0, $v0, JUMP_MASK
+ jalr STORE_MASK, $v0 # Error, alteration of read only register.
+ nop
+
+bundle_jalr_t7_t92:
+ addu $s0, $a0, $a1
+ and $v0, $v0, JUMP_MASK
+ jalr $sp, $v0 # Error, alteration of sp register.
+ nop
+
+bundle_jal_delay_slot:
+ b bundle_jalr_t7_t92
+ and $v0, $v0, JUMP_MASK
+ jalr $t0, $v0 # OK
+ nop
+
+end_of_code:
« no previous file with comments | « src/trusted/validator_mips/testdata/test_jmp_imm.err ('k') | src/trusted/validator_mips/testdata/test_jmp_reg.err » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698