xref: /optee_os/core/arch/arm/kernel/vfp_a64.S (revision 983d02116743476904b68d52ca432d0f79c38c43)
1/*
2 * Copyright (c) 2015, Linaro Limited
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <asm.S>
29
30	.section .text.vfp_asm
31
32/* void vfp_save_extension_regs(struct vfp_reg regs[VFP_NUM_REGS]); */
33FUNC vfp_save_extension_regs , :
34	stp	q0, q1, [x0, #16 * 0]
35	stp	q2, q3, [x0, #16 * 2]
36	stp	q4, q5, [x0, #16 * 4]
37	stp	q6, q7, [x0, #16 * 6]
38	stp	q8, q9, [x0, #16 * 8]
39	stp	q10, q11, [x0, #16 * 10]
40	stp	q12, q13, [x0, #16 * 12]
41	stp	q14, q15, [x0, #16 * 14]
42	stp	q16, q17, [x0, #16 * 16]
43	stp	q18, q19, [x0, #16 * 18]
44	stp	q20, q21, [x0, #16 * 20]
45	stp	q22, q23, [x0, #16 * 22]
46	stp	q24, q25, [x0, #16 * 24]
47	stp	q26, q27, [x0, #16 * 26]
48	stp	q28, q29, [x0, #16 * 28]
49	stp	q30, q31, [x0, #16 * 30]
50	ret
51END_FUNC vfp_save_extension_regs
52
53/* void vfp_restore_extension_regs(struct vfp_reg regs[VFP_NUM_REGS]); */
54FUNC vfp_restore_extension_regs , :
55	ldp	q0, q1, [x0, #16 * 0]
56	ldp	q2, q3, [x0, #16 * 2]
57	ldp	q4, q5, [x0, #16 * 4]
58	ldp	q6, q7, [x0, #16 * 6]
59	ldp	q8, q9, [x0, #16 * 8]
60	ldp	q10, q11, [x0, #16 * 10]
61	ldp	q12, q13, [x0, #16 * 12]
62	ldp	q14, q15, [x0, #16 * 14]
63	ldp	q16, q17, [x0, #16 * 16]
64	ldp	q18, q19, [x0, #16 * 18]
65	ldp	q20, q21, [x0, #16 * 20]
66	ldp	q22, q23, [x0, #16 * 22]
67	ldp	q24, q25, [x0, #16 * 24]
68	ldp	q26, q27, [x0, #16 * 26]
69	ldp	q28, q29, [x0, #16 * 28]
70	ldp	q30, q31, [x0, #16 * 30]
71	ret
72END_FUNC vfp_restore_extension_regs
73