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

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: Rebased patch, conflict resolved. Created 8 years, 6 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
5 #
6 # Tests both legal and illegal variations on SP updates.
7 #
8
9 .globl _start
10 _start:
11 .align 4
12 .set noreorder
13 .set STORE_MASK,$t7
14
15 # Test sp alteration without the appropriate mask.
16
17 bundle_sp_dest_reg:
18 addiu $sp, $sp, 64 # Error, no mask after sp alteration.
19 and $sp, $a0, $a1 # Error, no mask after sp alteration.
20 mfhi $sp # Error, no mask after sp alteration.
21 clo $sp, $a2 # Error, no mask after sp alteration.
22 ins $sp, $s3, 2, 10 # Error, no mask after sp alteration.
23 lui $sp, 0x1f # Error, no mask after sp alteration.
24 mfc1 $sp, $f12 # Error, no mask after sp alteration.
25 mfhc1 $sp, $f10 # Error, no mask after sp alteration.
26 mflo $sp # Error, no mask after sp alteration.
27 movn $sp, $v0, $v1 # Error, no mask after sp alteration.
28 movt $sp, $s4, $fcc4 # Error, no mask after sp alteration.
29 mul $sp, $s0, $s1 # Error, no mask after sp alteration.
30
31 # Modify sp with lw instruction.
32
33 bundle_load_into_sp:
34 lw $sp, 16($a0) # Error, no mask after sp alteration.
35 nop
36 lw $sp, 16($a0)
37 and $sp, $sp, STORE_MASK # Error, a0 register is not masked.
38
39 # Alteration of sp with mask doesn't need a mask.
40
41 bundle_mask_doesnt_need_mask:
42 nop
43 and $sp, $sp, STORE_MASK # OK
44 nop
45 nop
46
47 # A few instructions where sp is the first operand, but is not altered.
48
49 bundle_sp_not_altered:
50 mthi $sp # OK
51 mult $sp, $t9 # OK
52 nop
53 nop
54
55 # Alteration of sp with jalr instruction, not allowed.
56
57 bundle_jalr_sp_t9:
58 nop
59 and $t9, $t9, $t6
60 jalr $sp, $t9 # Error, alteration of sp register.
61 nop # Instruction in delay slot is indented.
62
63 # Changing value of sp in delay slot, not allowed.
64
65 bundle_chk_delay_slot:
66 b bundle_chk_cross_1
67 addiu $sp, $sp, -32 # Error, delay slot splits sp alteration.
68 and $sp, $sp, STORE_MASK
69 nop
70
71 # Pseudo-instruction with sp modification crosses bundle.
72 # We allow this, because the potential jump at the start of bundle will
73 # cause executing only mask instruction for sp, which is OK.
74
75 bundle_chk_cross_1:
76 nop
77 nop
78 nop
79 addiu $sp, $sp, -32 # OK
80
81 bundle_chk_cross_2:
82 and $sp, $sp, STORE_MASK
83 nop
84 nop
85 nop
86
87 # Correct sp changes.
88
89 bundle_OK:
90 add $sp, $sp, 64 # OK
91 and $sp, $sp, STORE_MASK
92 sub $sp, $sp, 56 # OK
93 and $sp, $sp, STORE_MASK
94
95 end_of_code:
OLDNEW
« no previous file with comments | « src/trusted/validator_mips/testdata/test_read_only_regs.err ('k') | src/trusted/validator_mips/testdata/test_sp_updates.err » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698