xref: /aosp_15_r20/trusty/kernel/app/stdcalltest/sve_helper.S (revision 344aa361028b423587d4ef3fa52a23d194628137)
1*344aa361SAndroid Build Coastguard Worker/*
2*344aa361SAndroid Build Coastguard Worker * Copyright (c) 2023, Google Inc. All rights reserved
3*344aa361SAndroid Build Coastguard Worker *
4*344aa361SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining
5*344aa361SAndroid Build Coastguard Worker * a copy of this software and associated documentation files
6*344aa361SAndroid Build Coastguard Worker * (the "Software"), to deal in the Software without restriction,
7*344aa361SAndroid Build Coastguard Worker * including without limitation the rights to use, copy, modify, merge,
8*344aa361SAndroid Build Coastguard Worker * publish, distribute, sublicense, and/or sell copies of the Software,
9*344aa361SAndroid Build Coastguard Worker * and to permit persons to whom the Software is furnished to do so,
10*344aa361SAndroid Build Coastguard Worker * subject to the following conditions:
11*344aa361SAndroid Build Coastguard Worker *
12*344aa361SAndroid Build Coastguard Worker * The above copyright notice and this permission notice shall be
13*344aa361SAndroid Build Coastguard Worker * included in all copies or substantial portions of the Software.
14*344aa361SAndroid Build Coastguard Worker *
15*344aa361SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16*344aa361SAndroid Build Coastguard Worker * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17*344aa361SAndroid Build Coastguard Worker * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18*344aa361SAndroid Build Coastguard Worker * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19*344aa361SAndroid Build Coastguard Worker * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20*344aa361SAndroid Build Coastguard Worker * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21*344aa361SAndroid Build Coastguard Worker * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*344aa361SAndroid Build Coastguard Worker */
23*344aa361SAndroid Build Coastguard Worker
24*344aa361SAndroid Build Coastguard Worker#include <asm.h>
25*344aa361SAndroid Build Coastguard Worker#include <arch/asm_macros.h>
26*344aa361SAndroid Build Coastguard Worker
27*344aa361SAndroid Build Coastguard Worker.arch armv8-a+sve
28*344aa361SAndroid Build Coastguard Worker
29*344aa361SAndroid Build Coastguard Worker
30*344aa361SAndroid Build Coastguard WorkerFUNCTION(clobber_sve_asm)
31*344aa361SAndroid Build Coastguard Worker    MOV     x9, x0
32*344aa361SAndroid Build Coastguard Worker
33*344aa361SAndroid Build Coastguard Worker    // Clobber Registers
34*344aa361SAndroid Build Coastguard Worker    mov    z0.b, w9
35*344aa361SAndroid Build Coastguard Worker    mov    z1.b, w9
36*344aa361SAndroid Build Coastguard Worker    mov    z2.b, w9
37*344aa361SAndroid Build Coastguard Worker    mov    z3.b, w9
38*344aa361SAndroid Build Coastguard Worker    mov    z4.b, w9
39*344aa361SAndroid Build Coastguard Worker    mov    z5.b, w9
40*344aa361SAndroid Build Coastguard Worker    mov    z6.b, w9
41*344aa361SAndroid Build Coastguard Worker    mov    z7.b, w9
42*344aa361SAndroid Build Coastguard Worker    mov    z8.b, w9
43*344aa361SAndroid Build Coastguard Worker    mov    z9.b, w9
44*344aa361SAndroid Build Coastguard Worker    mov    z10.b, w9
45*344aa361SAndroid Build Coastguard Worker    mov    z11.b, w9
46*344aa361SAndroid Build Coastguard Worker    mov    z12.b, w9
47*344aa361SAndroid Build Coastguard Worker    mov    z13.b, w9
48*344aa361SAndroid Build Coastguard Worker    mov    z14.b, w9
49*344aa361SAndroid Build Coastguard Worker    mov    z15.b, w9
50*344aa361SAndroid Build Coastguard Worker    mov    z16.b, w9
51*344aa361SAndroid Build Coastguard Worker    mov    z17.b, w9
52*344aa361SAndroid Build Coastguard Worker    mov    z18.b, w9
53*344aa361SAndroid Build Coastguard Worker    mov    z19.b, w9
54*344aa361SAndroid Build Coastguard Worker    mov    z20.b, w9
55*344aa361SAndroid Build Coastguard Worker    mov    z21.b, w9
56*344aa361SAndroid Build Coastguard Worker    mov    z22.b, w9
57*344aa361SAndroid Build Coastguard Worker    mov    z23.b, w9
58*344aa361SAndroid Build Coastguard Worker    mov    z24.b, w9
59*344aa361SAndroid Build Coastguard Worker    mov    z25.b, w9
60*344aa361SAndroid Build Coastguard Worker    mov    z26.b, w9
61*344aa361SAndroid Build Coastguard Worker    mov    z27.b, w9
62*344aa361SAndroid Build Coastguard Worker    mov    z28.b, w9
63*344aa361SAndroid Build Coastguard Worker    mov    z29.b, w9
64*344aa361SAndroid Build Coastguard Worker    mov    z30.b, w9
65*344aa361SAndroid Build Coastguard Worker    mov    z31.b, w9
66*344aa361SAndroid Build Coastguard Worker
67*344aa361SAndroid Build Coastguard Worker    ptrue   p0.B
68*344aa361SAndroid Build Coastguard Worker    ptrue   p1.B
69*344aa361SAndroid Build Coastguard Worker    ptrue   p2.B
70*344aa361SAndroid Build Coastguard Worker    ptrue   p3.B
71*344aa361SAndroid Build Coastguard Worker    ptrue   p4.B
72*344aa361SAndroid Build Coastguard Worker    ptrue   p5.B
73*344aa361SAndroid Build Coastguard Worker    ptrue   p6.B
74*344aa361SAndroid Build Coastguard Worker    ptrue   p7.B
75*344aa361SAndroid Build Coastguard Worker    ptrue   p8.B
76*344aa361SAndroid Build Coastguard Worker    ptrue   p9.B
77*344aa361SAndroid Build Coastguard Worker    ptrue   p10.B
78*344aa361SAndroid Build Coastguard Worker    ptrue   p11.B
79*344aa361SAndroid Build Coastguard Worker    ptrue   p12.B
80*344aa361SAndroid Build Coastguard Worker    ptrue   p13.B
81*344aa361SAndroid Build Coastguard Worker    ptrue   p14.B
82*344aa361SAndroid Build Coastguard Worker    ptrue   p15.B
83*344aa361SAndroid Build Coastguard Worker
84*344aa361SAndroid Build Coastguard Worker    // If sve is available return #0x0 'NO Error'
85*344aa361SAndroid Build Coastguard Worker    mov x0, #0
86*344aa361SAndroid Build Coastguard Worker    ret
87*344aa361SAndroid Build Coastguard Worker
88*344aa361SAndroid Build Coastguard WorkerFUNCTION(load_sve_asm)
89*344aa361SAndroid Build Coastguard Worker    mov x9, x0 // base address array
90*344aa361SAndroid Build Coastguard Worker    mov x8, #0 // offset
91*344aa361SAndroid Build Coastguard Worker    mov x7, x1 // offset increment
92*344aa361SAndroid Build Coastguard Worker
93*344aa361SAndroid Build Coastguard Worker    ST1B    z0.b, p0, [x9, x8]
94*344aa361SAndroid Build Coastguard Worker
95*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
96*344aa361SAndroid Build Coastguard Worker    ST1B    z1.b, p0, [x9, x8]
97*344aa361SAndroid Build Coastguard Worker
98*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
99*344aa361SAndroid Build Coastguard Worker    ST1B    z2.b, p0, [x9, x8]
100*344aa361SAndroid Build Coastguard Worker
101*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
102*344aa361SAndroid Build Coastguard Worker    ST1B    z3.b, p0, [x9, x8]
103*344aa361SAndroid Build Coastguard Worker
104*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
105*344aa361SAndroid Build Coastguard Worker    ST1B    z4.b, p0, [x9, x8]
106*344aa361SAndroid Build Coastguard Worker
107*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
108*344aa361SAndroid Build Coastguard Worker    ST1B    z5.b, p0, [x9, x8]
109*344aa361SAndroid Build Coastguard Worker
110*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
111*344aa361SAndroid Build Coastguard Worker    ST1B    z6.b, p0, [x9, x8]
112*344aa361SAndroid Build Coastguard Worker
113*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
114*344aa361SAndroid Build Coastguard Worker    ST1B    z7.b, p0, [x9, x8]
115*344aa361SAndroid Build Coastguard Worker
116*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
117*344aa361SAndroid Build Coastguard Worker    ST1B    z8.b, p0, [x9, x8]
118*344aa361SAndroid Build Coastguard Worker
119*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
120*344aa361SAndroid Build Coastguard Worker    ST1B    z9.b, p0, [x9, x8]
121*344aa361SAndroid Build Coastguard Worker
122*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
123*344aa361SAndroid Build Coastguard Worker    ST1B    z10.b, p0, [x9, x8]
124*344aa361SAndroid Build Coastguard Worker
125*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
126*344aa361SAndroid Build Coastguard Worker    ST1B    z11.b, p0, [x9, x8]
127*344aa361SAndroid Build Coastguard Worker
128*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
129*344aa361SAndroid Build Coastguard Worker    ST1B    z12.b, p0, [x9, x8]
130*344aa361SAndroid Build Coastguard Worker
131*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
132*344aa361SAndroid Build Coastguard Worker    ST1B    z13.b, p0, [x9, x8]
133*344aa361SAndroid Build Coastguard Worker
134*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
135*344aa361SAndroid Build Coastguard Worker    ST1B    z14.b, p0, [x9, x8]
136*344aa361SAndroid Build Coastguard Worker
137*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
138*344aa361SAndroid Build Coastguard Worker    ST1B    z15.b, p0, [x9, x8]
139*344aa361SAndroid Build Coastguard Worker
140*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
141*344aa361SAndroid Build Coastguard Worker    ST1B    z16.b, p0, [x9, x8]
142*344aa361SAndroid Build Coastguard Worker
143*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
144*344aa361SAndroid Build Coastguard Worker    ST1B    z17.b, p0, [x9, x8]
145*344aa361SAndroid Build Coastguard Worker
146*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
147*344aa361SAndroid Build Coastguard Worker    ST1B    z18.b, p0, [x9, x8]
148*344aa361SAndroid Build Coastguard Worker
149*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
150*344aa361SAndroid Build Coastguard Worker    ST1B    z19.b, p0, [x9, x8]
151*344aa361SAndroid Build Coastguard Worker
152*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
153*344aa361SAndroid Build Coastguard Worker    ST1B    z20.b, p0, [x9, x8]
154*344aa361SAndroid Build Coastguard Worker
155*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
156*344aa361SAndroid Build Coastguard Worker    ST1B    z21.b, p0, [x9, x8]
157*344aa361SAndroid Build Coastguard Worker
158*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
159*344aa361SAndroid Build Coastguard Worker    ST1B    z22.b, p0, [x9, x8]
160*344aa361SAndroid Build Coastguard Worker
161*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
162*344aa361SAndroid Build Coastguard Worker    ST1B    z23.b, p0, [x9, x8]
163*344aa361SAndroid Build Coastguard Worker
164*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
165*344aa361SAndroid Build Coastguard Worker    ST1B    z24.b, p0, [x9, x8]
166*344aa361SAndroid Build Coastguard Worker
167*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
168*344aa361SAndroid Build Coastguard Worker    ST1B    z25.b, p0, [x9, x8]
169*344aa361SAndroid Build Coastguard Worker
170*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
171*344aa361SAndroid Build Coastguard Worker    ST1B    z26.b, p0, [x9, x8]
172*344aa361SAndroid Build Coastguard Worker
173*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
174*344aa361SAndroid Build Coastguard Worker    ST1B    z27.b, p0, [x9, x8]
175*344aa361SAndroid Build Coastguard Worker
176*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
177*344aa361SAndroid Build Coastguard Worker    ST1B    z28.b, p0, [x9, x8]
178*344aa361SAndroid Build Coastguard Worker
179*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
180*344aa361SAndroid Build Coastguard Worker    ST1B    z29.b, p0, [x9, x8]
181*344aa361SAndroid Build Coastguard Worker
182*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
183*344aa361SAndroid Build Coastguard Worker    ST1B    z30.b, p0, [x9, x8]
184*344aa361SAndroid Build Coastguard Worker
185*344aa361SAndroid Build Coastguard Worker    ADD     x8, x8, x7
186*344aa361SAndroid Build Coastguard Worker    ST1B    z31.b, p0, [x9, x8]
187*344aa361SAndroid Build Coastguard Worker
188*344aa361SAndroid Build Coastguard Worker    mov x0, #0
189*344aa361SAndroid Build Coastguard Worker    ret
190