blob: dfd0f2f1a9a0e7f42fd6a269707f10279ded94ec [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handleye83b0ca2014-01-14 18:17:09 +00002 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <arch_helpers.h>
32
Achin Gupta4f6ad662013-10-25 09:08:21 +010033 .globl read_vbar_el1
34 .globl read_vbar_el2
35 .globl read_vbar_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010036 .globl write_vbar_el1
37 .globl write_vbar_el2
38 .globl write_vbar_el3
39
Achin Gupta4f6ad662013-10-25 09:08:21 +010040 .globl read_sctlr_el1
41 .globl read_sctlr_el2
42 .globl read_sctlr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010043 .globl write_sctlr_el1
44 .globl write_sctlr_el2
45 .globl write_sctlr_el3
46
Achin Gupta4f6ad662013-10-25 09:08:21 +010047 .globl read_actlr_el1
48 .globl read_actlr_el2
49 .globl read_actlr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010050 .globl write_actlr_el1
51 .globl write_actlr_el2
52 .globl write_actlr_el3
53
Achin Gupta4f6ad662013-10-25 09:08:21 +010054 .globl read_esr_el1
55 .globl read_esr_el2
56 .globl read_esr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010057 .globl write_esr_el1
58 .globl write_esr_el2
59 .globl write_esr_el3
60
Achin Gupta4f6ad662013-10-25 09:08:21 +010061 .globl read_afsr0_el1
62 .globl read_afsr0_el2
63 .globl read_afsr0_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010064 .globl write_afsr0_el1
65 .globl write_afsr0_el2
66 .globl write_afsr0_el3
67
Achin Gupta4f6ad662013-10-25 09:08:21 +010068 .globl read_afsr1_el1
69 .globl read_afsr1_el2
70 .globl read_afsr1_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010071 .globl write_afsr1_el1
72 .globl write_afsr1_el2
73 .globl write_afsr1_el3
74
Achin Gupta4f6ad662013-10-25 09:08:21 +010075 .globl read_far_el1
76 .globl read_far_el2
77 .globl read_far_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010078 .globl write_far_el1
79 .globl write_far_el2
80 .globl write_far_el3
81
Achin Gupta4f6ad662013-10-25 09:08:21 +010082 .globl read_mair_el1
83 .globl read_mair_el2
84 .globl read_mair_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010085 .globl write_mair_el1
86 .globl write_mair_el2
87 .globl write_mair_el3
88
Achin Gupta4f6ad662013-10-25 09:08:21 +010089 .globl read_amair_el1
90 .globl read_amair_el2
91 .globl read_amair_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +010092 .globl write_amair_el1
93 .globl write_amair_el2
94 .globl write_amair_el3
95
Achin Gupta4f6ad662013-10-25 09:08:21 +010096 .globl read_rvbar_el1
97 .globl read_rvbar_el2
98 .globl read_rvbar_el3
99
Achin Gupta4f6ad662013-10-25 09:08:21 +0100100 .globl read_rmr_el1
101 .globl read_rmr_el2
102 .globl read_rmr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +0100103 .globl write_rmr_el1
104 .globl write_rmr_el2
105 .globl write_rmr_el3
106
Achin Gupta4f6ad662013-10-25 09:08:21 +0100107 .globl read_tcr_el1
108 .globl read_tcr_el2
109 .globl read_tcr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +0100110 .globl write_tcr_el1
111 .globl write_tcr_el2
112 .globl write_tcr_el3
113
Achin Gupta4f6ad662013-10-25 09:08:21 +0100114 .globl read_cptr_el2
115 .globl read_cptr_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +0100116 .globl write_cptr_el2
117 .globl write_cptr_el3
118
Achin Gupta4f6ad662013-10-25 09:08:21 +0100119 .globl read_ttbr0_el1
120 .globl read_ttbr0_el2
121 .globl read_ttbr0_el3
Achin Gupta4f6ad662013-10-25 09:08:21 +0100122 .globl write_ttbr0_el1
123 .globl write_ttbr0_el2
124 .globl write_ttbr0_el3
125
Achin Gupta4f6ad662013-10-25 09:08:21 +0100126 .globl read_ttbr1_el1
127 .globl read_ttbr1_el2
128 .globl write_ttbr1
129 .globl write_ttbr1_el1
130 .globl write_ttbr1_el2
131
132 .globl read_cpacr
133 .globl write_cpacr
134
135 .globl read_cntfrq
136 .globl write_cntfrq
137
138 .globl read_cpuectlr
139 .globl write_cpuectlr
140
141 .globl read_cnthctl_el2
142 .globl write_cnthctl_el2
143
144 .globl read_cntfrq_el0
145 .globl write_cntfrq_el0
146
147 .globl read_scr
148 .globl write_scr
149
150 .globl read_hcr
151 .globl write_hcr
152
153 .globl read_midr
154 .globl read_mpidr
155
156 .globl read_current_el
157 .globl read_id_pfr1_el1
158 .globl read_id_aa64pfr0_el1
159
160#if SUPPORT_VFP
161 .globl enable_vfp
162 .globl read_fpexc
163 .globl write_fpexc
164#endif
165
166
167 .section .text, "ax"
168
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000169read_current_el: ; .type read_current_el, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100170 mrs x0, CurrentEl
171 ret
172
173
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000174read_id_pfr1_el1: ; .type read_id_pfr1_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100175 mrs x0, id_pfr1_el1
176 ret
177
178
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000179read_id_aa64pfr0_el1: ; .type read_id_aa64pfr0_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100180 mrs x0, id_aa64pfr0_el1
181 ret
182
183
184 /* -----------------------------------------------------
185 * VBAR accessors
186 * -----------------------------------------------------
187 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000188read_vbar_el1: ; .type read_vbar_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100189 mrs x0, vbar_el1
190 ret
191
192
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000193read_vbar_el2: ; .type read_vbar_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100194 mrs x0, vbar_el2
195 ret
196
197
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000198read_vbar_el3: ; .type read_vbar_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100199 mrs x0, vbar_el3
200 ret
201
202
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000203write_vbar_el1: ; .type write_vbar_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100204 msr vbar_el1, x0
205 isb
206 ret
207
208
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000209write_vbar_el2: ; .type write_vbar_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100210 msr vbar_el2, x0
211 isb
212 ret
213
214
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000215write_vbar_el3: ; .type write_vbar_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100216 msr vbar_el3, x0
217 isb
218 ret
219
220
221 /* -----------------------------------------------------
222 * AFSR0 accessors
223 * -----------------------------------------------------
224 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000225read_afsr0_el1: ; .type read_afsr0_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100226 mrs x0, afsr0_el1
227 ret
228
229
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000230read_afsr0_el2: ; .type read_afsr0_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100231 mrs x0, afsr0_el2
232 ret
233
234
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000235read_afsr0_el3: ; .type read_afsr0_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100236 mrs x0, afsr0_el3
237 ret
238
239
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000240write_afsr0_el1: ; .type write_afsr0_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100241 msr afsr0_el1, x0
242 isb
243 ret
244
245
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000246write_afsr0_el2: ; .type write_afsr0_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100247 msr afsr0_el2, x0
248 isb
249 ret
250
251
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000252write_afsr0_el3: ; .type write_afsr0_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100253 msr afsr0_el3, x0
254 isb
255 ret
256
257
258 /* -----------------------------------------------------
259 * FAR accessors
260 * -----------------------------------------------------
261 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000262read_far_el1: ; .type read_far_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100263 mrs x0, far_el1
264 ret
265
266
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000267read_far_el2: ; .type read_far_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100268 mrs x0, far_el2
269 ret
270
271
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000272read_far_el3: ; .type read_far_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100273 mrs x0, far_el3
274 ret
275
276
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000277write_far_el1: ; .type write_far_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100278 msr far_el1, x0
279 isb
280 ret
281
282
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000283write_far_el2: ; .type write_far_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100284 msr far_el2, x0
285 isb
286 ret
287
288
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000289write_far_el3: ; .type write_far_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100290 msr far_el3, x0
291 isb
292 ret
293
294
295 /* -----------------------------------------------------
296 * MAIR accessors
297 * -----------------------------------------------------
298 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000299read_mair_el1: ; .type read_mair_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100300 mrs x0, mair_el1
301 ret
302
303
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000304read_mair_el2: ; .type read_mair_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100305 mrs x0, mair_el2
306 ret
307
308
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000309read_mair_el3: ; .type read_mair_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100310 mrs x0, mair_el3
311 ret
312
313
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000314write_mair_el1: ; .type write_mair_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100315 msr mair_el1, x0
316 isb
317 ret
318
319
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000320write_mair_el2: ; .type write_mair_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100321 msr mair_el2, x0
322 isb
323 ret
324
325
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000326write_mair_el3: ; .type write_mair_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100327 msr mair_el3, x0
328 isb
329 ret
330
331
332 /* -----------------------------------------------------
333 * AMAIR accessors
334 * -----------------------------------------------------
335 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000336read_amair_el1: ; .type read_amair_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100337 mrs x0, amair_el1
338 ret
339
340
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000341read_amair_el2: ; .type read_amair_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100342 mrs x0, amair_el2
343 ret
344
345
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000346read_amair_el3: ; .type read_amair_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100347 mrs x0, amair_el3
348 ret
349
350
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000351write_amair_el1: ; .type write_amair_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100352 msr amair_el1, x0
353 isb
354 ret
355
356
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000357write_amair_el2: ; .type write_amair_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100358 msr amair_el2, x0
359 isb
360 ret
361
362
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000363write_amair_el3: ; .type write_amair_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100364 msr amair_el3, x0
365 isb
366 ret
367
368
369 /* -----------------------------------------------------
370 * RVBAR accessors
371 * -----------------------------------------------------
372 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000373read_rvbar_el1: ; .type read_rvbar_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100374 mrs x0, rvbar_el1
375 ret
376
377
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000378read_rvbar_el2: ; .type read_rvbar_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100379 mrs x0, rvbar_el2
380 ret
381
382
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000383read_rvbar_el3: ; .type read_rvbar_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100384 mrs x0, rvbar_el3
385 ret
386
387
388 /* -----------------------------------------------------
389 * RMR accessors
390 * -----------------------------------------------------
391 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000392read_rmr_el1: ; .type read_rmr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100393 mrs x0, rmr_el1
394 ret
395
396
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000397read_rmr_el2: ; .type read_rmr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100398 mrs x0, rmr_el2
399 ret
400
401
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000402read_rmr_el3: ; .type read_rmr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100403 mrs x0, rmr_el3
404 ret
405
406
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000407write_rmr_el1: ; .type write_rmr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100408 msr rmr_el1, x0
409 isb
410 ret
411
412
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000413write_rmr_el2: ; .type write_rmr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100414 msr rmr_el2, x0
415 isb
416 ret
417
418
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000419write_rmr_el3: ; .type write_rmr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100420 msr rmr_el3, x0
421 isb
422 ret
423
424
Achin Gupta4f6ad662013-10-25 09:08:21 +0100425 /* -----------------------------------------------------
426 * AFSR1 accessors
427 * -----------------------------------------------------
428 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000429read_afsr1_el1: ; .type read_afsr1_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100430 mrs x0, afsr1_el1
431 ret
432
433
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000434read_afsr1_el2: ; .type read_afsr1_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100435 mrs x0, afsr1_el2
436 ret
437
438
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000439read_afsr1_el3: ; .type read_afsr1_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100440 mrs x0, afsr1_el3
441 ret
442
443
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000444write_afsr1_el1: ; .type write_afsr1_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100445 msr afsr1_el1, x0
446 isb
447 ret
448
449
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000450write_afsr1_el2: ; .type write_afsr1_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100451 msr afsr1_el2, x0
452 isb
453 ret
454
455
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000456write_afsr1_el3: ; .type write_afsr1_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100457 msr afsr1_el3, x0
458 isb
459 ret
460
461
462 /* -----------------------------------------------------
463 * SCTLR accessors
464 * -----------------------------------------------------
465 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000466read_sctlr_el1: ; .type read_sctlr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100467 mrs x0, sctlr_el1
468 ret
469
470
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000471read_sctlr_el2: ; .type read_sctlr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100472 mrs x0, sctlr_el2
473 ret
474
475
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000476read_sctlr_el3: ; .type read_sctlr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100477 mrs x0, sctlr_el3
478 ret
479
480
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000481write_sctlr_el1: ; .type write_sctlr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100482 msr sctlr_el1, x0
483 dsb sy
484 isb
485 ret
486
487
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000488write_sctlr_el2: ; .type write_sctlr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100489 msr sctlr_el2, x0
490 dsb sy
491 isb
492 ret
493
494
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000495write_sctlr_el3: ; .type write_sctlr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100496 msr sctlr_el3, x0
497 dsb sy
498 isb
499 ret
500
501
502 /* -----------------------------------------------------
503 * ACTLR accessors
504 * -----------------------------------------------------
505 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000506read_actlr_el1: ; .type read_actlr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100507 mrs x0, actlr_el1
508 ret
509
510
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000511read_actlr_el2: ; .type read_actlr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100512 mrs x0, actlr_el2
513 ret
514
515
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000516read_actlr_el3: ; .type read_actlr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100517 mrs x0, actlr_el3
518 ret
519
520
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000521write_actlr_el1: ; .type write_actlr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100522 msr actlr_el1, x0
523 dsb sy
524 isb
525 ret
526
527
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000528write_actlr_el2: ; .type write_actlr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100529 msr actlr_el2, x0
530 dsb sy
531 isb
532 ret
533
534
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000535write_actlr_el3: ; .type write_actlr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100536 msr actlr_el3, x0
537 dsb sy
538 isb
539 ret
540
541
542 /* -----------------------------------------------------
543 * ESR accessors
544 * -----------------------------------------------------
545 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000546read_esr_el1: ; .type read_esr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100547 mrs x0, esr_el1
548 ret
549
550
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000551read_esr_el2: ; .type read_esr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100552 mrs x0, esr_el2
553 ret
554
555
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000556read_esr_el3: ; .type read_esr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100557 mrs x0, esr_el3
558 ret
559
560
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000561write_esr_el1: ; .type write_esr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100562 msr esr_el1, x0
563 dsb sy
564 isb
565 ret
566
567
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000568write_esr_el2: ; .type write_esr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100569 msr esr_el2, x0
570 dsb sy
571 isb
572 ret
573
574
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000575write_esr_el3: ; .type write_esr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100576 msr esr_el3, x0
577 dsb sy
578 isb
579 ret
580
581
582 /* -----------------------------------------------------
583 * TCR accessors
584 * -----------------------------------------------------
585 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000586read_tcr_el1: ; .type read_tcr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100587 mrs x0, tcr_el1
588 ret
589
590
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000591read_tcr_el2: ; .type read_tcr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100592 mrs x0, tcr_el2
593 ret
594
595
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000596read_tcr_el3: ; .type read_tcr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100597 mrs x0, tcr_el3
598 ret
599
Achin Gupta4f6ad662013-10-25 09:08:21 +0100600
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000601write_tcr_el1: ; .type write_tcr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100602 msr tcr_el1, x0
603 dsb sy
604 isb
605 ret
606
607
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000608write_tcr_el2: ; .type write_tcr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100609 msr tcr_el2, x0
610 dsb sy
611 isb
612 ret
613
614
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000615write_tcr_el3: ; .type write_tcr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100616 msr tcr_el3, x0
617 dsb sy
618 isb
619 ret
620
621
622 /* -----------------------------------------------------
623 * CPTR accessors
624 * -----------------------------------------------------
625 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000626read_cptr_el1: ; .type read_cptr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100627 b read_cptr_el1
628 ret
629
630
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000631read_cptr_el2: ; .type read_cptr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100632 mrs x0, cptr_el2
633 ret
634
635
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000636read_cptr_el3: ; .type read_cptr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100637 mrs x0, cptr_el3
638 ret
639
Achin Gupta4f6ad662013-10-25 09:08:21 +0100640
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000641write_cptr_el1: ; .type write_cptr_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100642 b write_cptr_el1
643
644
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000645write_cptr_el2: ; .type write_cptr_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100646 msr cptr_el2, x0
647 dsb sy
648 isb
649 ret
650
651
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000652write_cptr_el3: ; .type write_cptr_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100653 msr cptr_el3, x0
654 dsb sy
655 isb
656 ret
657
658
659 /* -----------------------------------------------------
660 * TTBR0 accessors
661 * -----------------------------------------------------
662 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000663read_ttbr0_el1: ; .type read_ttbr0_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100664 mrs x0, ttbr0_el1
665 ret
666
667
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000668read_ttbr0_el2: ; .type read_ttbr0_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100669 mrs x0, ttbr0_el2
670 ret
671
672
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000673read_ttbr0_el3: ; .type read_ttbr0_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100674 mrs x0, ttbr0_el3
675 ret
676
677
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000678write_ttbr0_el1: ; .type write_ttbr0_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100679 msr ttbr0_el1, x0
680 isb
681 ret
682
683
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000684write_ttbr0_el2: ; .type write_ttbr0_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100685 msr ttbr0_el2, x0
686 isb
687 ret
688
689
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000690write_ttbr0_el3: ; .type write_ttbr0_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100691 msr ttbr0_el3, x0
692 isb
693 ret
694
695
696 /* -----------------------------------------------------
697 * TTBR1 accessors
698 * -----------------------------------------------------
699 */
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000700read_ttbr1_el1: ; .type read_ttbr1_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100701 mrs x0, ttbr1_el1
702 ret
703
704
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000705read_ttbr1_el2: ; .type read_ttbr1_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100706 b read_ttbr1_el2
707
708
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000709read_ttbr1_el3: ; .type read_ttbr1_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100710 b read_ttbr1_el3
711
712
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000713write_ttbr1_el1: ; .type write_ttbr1_el1, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100714 msr ttbr1_el1, x0
715 isb
716 ret
717
718
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000719write_ttbr1_el2: ; .type write_ttbr1_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100720 b write_ttbr1_el2
721
722
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000723write_ttbr1_el3: ; .type write_ttbr1_el3, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100724 b write_ttbr1_el3
725
726
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000727read_hcr: ; .type read_hcr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100728 mrs x0, hcr_el2
729 ret
730
731
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000732write_hcr: ; .type write_hcr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100733 msr hcr_el2, x0
734 dsb sy
735 isb
736 ret
737
738
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000739read_cpacr: ; .type read_cpacr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100740 mrs x0, cpacr_el1
741 ret
742
743
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000744write_cpacr: ; .type write_cpacr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100745 msr cpacr_el1, x0
746 ret
747
748
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000749read_cntfrq_el0: ; .type read_cntfrq_el0, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100750 mrs x0, cntfrq_el0
751 ret
752
753
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000754write_cntfrq_el0: ; .type write_cntfrq_el0, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100755 msr cntfrq_el0, x0
756 ret
757
758
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000759read_cpuectlr: ; .type read_cpuectlr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100760 mrs x0, CPUECTLR_EL1
761 ret
762
763
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000764write_cpuectlr: ; .type write_cpuectlr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100765 msr CPUECTLR_EL1, x0
766 dsb sy
767 isb
768 ret
769
770
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000771read_cnthctl_el2: ; .type read_cnthctl_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100772 mrs x0, cnthctl_el2
773 ret
774
775
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000776write_cnthctl_el2: ; .type write_cnthctl_el2, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100777 msr cnthctl_el2, x0
778 ret
779
780
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000781read_cntfrq: ; .type read_cntfrq, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100782 mrs x0, cntfrq_el0
783 ret
784
785
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000786write_cntfrq: ; .type write_cntfrq, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100787 msr cntfrq_el0, x0
788 ret
789
790
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000791write_scr: ; .type write_scr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100792 msr scr_el3, x0
793 dsb sy
794 isb
795 ret
796
797
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000798read_scr: ; .type read_scr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100799 mrs x0, scr_el3
800 ret
801
802
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000803read_midr: ; .type read_midr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100804 mrs x0, midr_el1
805 ret
806
807
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000808read_mpidr: ; .type read_mpidr, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100809 mrs x0, mpidr_el1
810 ret
811
812
813#if SUPPORT_VFP
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000814enable_vfp: ; .type enable_vfp, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100815 mrs x0, cpacr_el1
816 orr x0, x0, #CPACR_VFP_BITS
817 msr cpacr_el1, x0
818 mrs x0, cptr_el3
819 mov x1, #AARCH64_CPTR_TFP
820 bic x0, x0, x1
821 msr cptr_el3, x0
822 ret
823
824
825 // int read_fpexc(void)
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000826read_fpexc: ; .type read_fpexc, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100827 b read_fpexc
828 ret
829
830
831 // void write_fpexc(int fpexc)
Jeenu Viswambharan3a4cae02014-01-16 17:30:39 +0000832write_fpexc: ; .type write_fpexc, %function
Achin Gupta4f6ad662013-10-25 09:08:21 +0100833 b write_fpexc
834 ret
835
836#endif