OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Several test cases are implemented in this file: |
| 6 # 1. Test if regular way to access thread pointers is allowed. |
| 7 # 2. Test different random examples of forbidden stores through $t8. |
| 8 # 3. Test different random examples of forbidden loads through $t8. |
| 9 |
| 10 |
| 11 .align 4 |
| 12 .globl __start |
| 13 __start: |
| 14 .set noreorder |
| 15 .set mips32r2 |
| 16 |
| 17 # Test valid tp access |
| 18 valid_load_access: |
| 19 lw $a0, 0($t8) # OK |
| 20 lw $a0, 4($t8) # OK |
| 21 nop |
| 22 nop |
| 23 |
| 24 # Test invalid tp access |
| 25 invalid_store_access: |
| 26 sb $a0, 4($t8) # Error, forbidden thread pointer access. |
| 27 sc $a0, 4($t8) # Error, forbidden thread pointer access. |
| 28 sdc1 $0, 4($t8) # Error, forbidden thread pointer access. |
| 29 sdc2 $8, 4($t8) # Error, forbidden thread pointer access. |
| 30 |
| 31 sh $a0, 4($t8) # Error, forbidden thread pointer access. |
| 32 sw $a0, 4($t8) # Error, forbidden thread pointer access. |
| 33 swc1 $f2, 4($t8) # Error, forbidden thread pointer access. |
| 34 swc2 $22, 4($t8) # Error, forbidden thread pointer access. |
| 35 |
| 36 swl $a0, 4($t8) # Error, forbidden thread pointer access. |
| 37 swr $a0, 4($t8) # Error, forbidden thread pointer access. |
| 38 sdxc1 $f6, $a2($t8) # Error, forbidden instruction. |
| 39 suxc1 $f4, $t8($t8) # Error, forbidden instruction. |
| 40 |
| 41 swxc1 $f4, $t8($t8) # Error, forbidden instruction. |
| 42 nop |
| 43 nop |
| 44 nop |
| 45 |
| 46 invalid_load_access: |
| 47 lb $a0, 4($t8) # Error, forbidden thread pointer access. |
| 48 lw $a0, 8($t8) # Error, forbidden thread pointer access. |
| 49 lbu $a0, 4($t8) # Error, forbidden thread pointer access. |
| 50 ldc1 $f0, 4($t8) # Error, forbidden thread pointer access. |
| 51 |
| 52 ldc2 $10, -24($t8) # Error, forbidden thread pointer access. |
| 53 lh $a0, 4($t8) # Error, forbidden thread pointer access. |
| 54 lhu $a0, 4($t8) # Error, forbidden thread pointer access. |
| 55 ll $a0, 4($t8) # Error, forbidden thread pointer access. |
| 56 |
| 57 lwc1 $f0, 4($t8) # Error, forbidden thread pointer access. |
| 58 lwc2 $10, 4($t8) # Error, forbidden thread pointer access. |
| 59 lwl $a0, 4($t8) # Error, forbidden thread pointer access. |
| 60 lwr $a0, 4($t8) # Error, forbidden thread pointer access. |
| 61 |
| 62 ldxc1 $f0, $0($t8) # Error, forbidden instruction. |
| 63 luxc1 $f0, $a2($t8) # Error, forbidden instruction. |
| 64 lwxc1 $f6, $v0($t8) # Error, forbidden instruction. |
| 65 nop |
| 66 |
| 67 .set dsp |
| 68 lbux $a3, $t2($t8) # Error, forbidden instruction. |
| 69 lhx $a1, $a2($t8) # Error, forbidden instruction. |
| 70 lwx $t1, $t2($t8) # Error, forbidden instruction. |
| 71 nop |
| 72 end_of_code: |
OLD | NEW |