| Index: src/trusted/validator_mips/testdata/test_stores.S
|
| diff --git a/src/trusted/validator_mips/testdata/test_stores.S b/src/trusted/validator_mips/testdata/test_stores.S
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cb8705f80f49239713dbe4e0f41948ba8afc26c2
|
| --- /dev/null
|
| +++ b/src/trusted/validator_mips/testdata/test_stores.S
|
| @@ -0,0 +1,85 @@
|
| +# 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.
|
| +# Copyright 2012 MIPS Technologies / RT-RK.
|
| +
|
| +
|
| +#test if all store instrs are recognized as such
|
| +#test if store from sp is allowed
|
| +#test if mask and instr are split w/ delay slot
|
| +#test if mask and inst are in the same bundle
|
| +
|
| +
|
| +.globl _start
|
| +_start:
|
| +.align 4
|
| +.set noreorder
|
| +.set STORE_MASK,$t7
|
| +
|
| +#check store mask
|
| +bundle_store_mask:
|
| + and $a3, $a3, STORE_MASK #good mask
|
| + sw $s1, 128($a3)
|
| + and $a3, $a3, $t8 #bad mask
|
| + sw $s1, 128($a3)
|
| +
|
| +bundle_store_list:
|
| + sb $a0, 16($a1) #unsafe store, no mask
|
| + sc $a0, 16($a1) #unsafe store, no mask
|
| + sdc1 $0, 16($a1) #unsafe store, no mask
|
| + sdc2 $8, 16($a1) #unsafe store, no mask
|
| +
|
| + sh $a0, 16($a1) #unsafe store, no mask
|
| + sw $a0, 16($a1) #unsafe store, no mask
|
| + swc1 $f2, 16($a1) #unsafe store, no mask
|
| + swc2 $22, 16($a1) #unsafe store, no mask
|
| +
|
| + swl $a0, 16($a1) #unsafe store, no mask
|
| + swr $a0, 16($a1) #unsafe store, no mask
|
| + nop
|
| + nop
|
| +
|
| +bundle_indexed_store:
|
| + sdxc1 $f6, $a2($a0) #forbidden instruction
|
| + suxc1 $f4, $t8($a1) #forbidden instruction
|
| + swxc1 $f4, $t8($a1) #forbidden instruction
|
| + nop
|
| +
|
| +bundle_store_from_sp:
|
| + sw $a0, 16($sp) # ok - sw from sp doesn't need a mask
|
| + nop
|
| + nop
|
| + nop
|
| +
|
| +
|
| +bundle_chk_delay_slot:
|
| + b bundle_chk_bundle_cross_1
|
| + and $s0, $s0, STORE_MASK
|
| + sw $v0, 16($s0) #ok
|
| + nop
|
| +
|
| +bundle_chk_bundle_cross_1:
|
| + nop
|
| + nop
|
| + nop
|
| + and $a3, $a3, STORE_MASK
|
| +
|
| +bundle_chk_bundle_cross_2:
|
| + sw $a3, 16($a3) #ERROR, cross bundle
|
| + nop
|
| + nop
|
| + nop
|
| +
|
| +bundle_indexed_store_index_not_zero:
|
| + and $a0, $a0, STORE_MASK
|
| + sdxc1 $f6, $a2($a0) #forbidden instruction
|
| + nop
|
| + nop
|
| +
|
| +bundle_sp_1:
|
| + sw $sp,0($t1)
|
| + and $sp,$sp,STORE_MASK #ERROR, no mask for store for t1
|
| + nop
|
| + nop
|
| +
|
| +end_of_code:
|
|
|