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

Side by Side Diff: src/trusted/validator_mips/testdata/test_sp_updates.S

Issue 9979025: [MIPS] Adding validator for MIPS architecture. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Update per initial code review. Nexes removed. Created 8 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2012 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can
3 # be found in the LICENSE file.
4 # Copyright 2012 MIPS Technologies / RT-RK.
5
6 #
7 # Tests both legal and illegal variations on SP updates.
8 #
9
10
11
12 .globl _start
13 _start:
14 .align 4
15 .set noreorder
16 .set STORE_MASK,$t7
17
18 bundle_sp_dest_reg:
19 addiu $sp, $sp, 64 #error, b/c no mask after
20 and $sp, $a0, $a1 #error, b/c no mask after
21 mfhi $sp #error, b/c no mask after
22 clo $sp, $a2 #error, b/c no mask after
23 ins $sp, $s3, 2, 10 #error, b/c no mask after
24 lui $sp, 0x1f #error, b/c no mask after
25 mfc1 $sp, $f12 #error, b/c no mask after
26 mfhc1 $sp, $f10 #error, b/c no mask after
27 mflo $sp #error, b/c no mask after
28 movn $sp, $v0, $v1 #error, b/c no mask after
29 movt $sp, $s4, $fcc4 #error, b/c no mask after
30 mul $sp, $s0, $s1 #error, b/c no mask after
31
32 #modify sp w/ lw;
33 bundle_load_into_sp:
34 lw $sp, 16($a0) #error, b/c no mask after
35 nop
36 lw $sp, 16($a0)
37 and $sp, $sp, STORE_MASK #error
38
39 bundle_mask_doesnt_need_mask:
40 #ok
41 nop
42 and $sp, $sp, STORE_MASK
43 nop
44 nop
45
46 # a few instructions where sp is
47 # 1st operand, but don't alter it
48
49 bundle_sp_not_altered:
50 mthi $sp #ok
51 mult $sp, $t9 #ok
52 nop
53 nop
54
55 bundle_jalr_sp_t9:
56 #this should be allowed, b/c $sp will still be in the untrusted area
57 nop
58 and $t9, $t9, $t6
59 jalr $sp, $t9 #error
60 nop
61
62 bundle_chk_delay_slot:
63 b bundle_chk_cross_1
64 addiu $sp, $sp, -32 #error
65 and $sp, $sp, STORE_MASK
66 nop
67
68 bundle_chk_cross_1:
69 nop
70 nop
71 nop
72 addiu $sp, $sp, -32 #ok
73
74 bundle_chk_cross_2:
75 and $sp, $sp, STORE_MASK
76 nop
77 nop
78 nop
79
80 bundle_ok:
81 add $sp, $sp, 64 #ok
82 and $sp, $sp, STORE_MASK
83 sub $sp, $sp, 56 #ok
84 and $sp, $sp, STORE_MASK
85
86 end_of_code:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698