My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
macros.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 .macro save_context
24  stp x29, x30, [sp, #-16]!
25  stp x27, x28, [sp, #-16]!
26  stp x25, x26, [sp, #-16]!
27  stp x23, x24, [sp, #-16]!
28  stp x21, x22, [sp, #-16]!
29  stp x19, x20, [sp, #-16]!
30  stp x17, x18, [sp, #-16]!
31  stp x15, x16, [sp, #-16]!
32  stp x13, x14, [sp, #-16]!
33  stp x11, x12, [sp, #-16]!
34  stp x9, x10, [sp, #-16]!
35  stp x7, x8, [sp, #-16]!
36  stp x5, x6, [sp, #-16]!
37  stp x3, x4, [sp, #-16]!
38  stp x1, x2, [sp, #-16]!
39  stp x0, x0, [sp, #-16]! // FIXME : Storing to fix sp alignment
40 #ifdef __KERNEL_EL1__
41  mrs x1, elr_el1
42  mrs x0, spsr_el1
43  stp x0, x1, [sp, #-16]!
44 #endif
45 #ifdef __KERNEL_EL2__
46  mrs x1, elr_el2
47  mrs x0, spsr_el2
48  stp x0, x1, [sp, #-16]!
49 #endif
50 #ifdef __KERNEL_EL3__
51  mrs x0, ttbr1_el1
52  mrs x1, sctlr_el1
53  stp x0, x1, [sp, #-16]!
54  mrs x0, vbar_el1
55  mrs x1, ttbr0_el1
56  stp x0, x1, [sp, #-16]!
57  mrs x1, spsr_el1
58  mrs x0, elr_el1
59  stp x0, x1, [sp, #-16]!
60  mrs x1, sp_el1
61  mrs x0, sp_el0
62  stp x0, x1, [sp, #-16]!
63  mrs x1, elr_el3
64  mrs x0, spsr_el3
65  stp x0, x1, [sp, #-16]!
66 #endif
67  mov x0, sp
68 .endm
69 
70 .macro restore_context
71  mov sp, x0
72 #ifdef __KERNEL_EL3__
73  ldp x0, x1, [sp], #16
74  msr spsr_el3, x0
75  msr elr_el3, x1
76  ldp x0, x1, [sp], #16
77  msr sp_el0, x0
78  msr sp_el1, x1
79  ldp x0, x1, [sp], #16
80  msr elr_el1, x0
81  msr spsr_el1, x1
82  ldp x0, x1, [sp], #16
83  msr vbar_el1, x0
84  msr ttbr0_el1, x1
85  ldp x0, x1, [sp], #16
86  msr ttbr1_el1, x0
87  msr sctlr_el1, x1
88 #endif
89 #ifdef __KERNEL_EL2__
90  ldp x0, x1, [sp], #16
91  msr spsr_el2, x0
92  msr elr_el2, x1
93 #endif
94 #ifdef __KERNEL_EL1__
95  ldp x0, x1, [sp], #16
96  msr spsr_el1, x0
97  msr elr_el1, x1
98 #endif
99  ldp x1, x0, [sp], #16
100  ldp x1, x2, [sp], #16
101  ldp x3, x4, [sp], #16
102  ldp x5, x6, [sp], #16
103  ldp x7, x8, [sp], #16
104  ldp x9, x10, [sp], #16
105  ldp x11, x12, [sp], #16
106  ldp x13, x14, [sp], #16
107  ldp x15, x16, [sp], #16
108  ldp x17, x18, [sp], #16
109  ldp x19, x20, [sp], #16
110  ldp x21, x22, [sp], #16
111  ldp x23, x24, [sp], #16
112  ldp x25, x26, [sp], #16
113  ldp x27, x28, [sp], #16
114  ldp x29, x30, [sp], #16
115 .endm
116 
117 
118 /* TLB invalidate operations */
119 .macro TLBIALL
120 #if defined __KERNEL_EL1__
121  tlbi vmalle1is
122 #elif defined __KERNEL_EL2__
123  tlbi alle2is
124 #elif defined __KERNEL_EL3__
125  tlbi alle3is
126 #endif
127 .endm
128 
129 .macro SET_KERN_TTBR
130 #if defined __KERNEL_EL1__
131  bl set_ttbr1
132 #else
133  bl set_ttbr0
134 #endif
135 .endm
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp mov sp endm macro restore_context mov sp
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp x14
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp x16
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x8
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x6
Definition: macros.h:24
macro save_context stp!stp!stp x26
Definition: macros.h:24
macro save_context stp!stp!stp!stp x24
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp x19
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x0
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp x20
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp x21
Definition: macros.h:24
macro save_context stp!stp!stp!stp x23
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp x15
Definition: macros.h:24
macro save_context stp x29
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x7
Definition: macros.h:24
macro save_context stp x30
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x1
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp x13
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp x17
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x5
Definition: macros.h:24
macro save_context stp!stp!stp x25
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp x18
Definition: macros.h:24
macro save_context stp!stp x27
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x12
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x11
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp x22
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x4
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x3
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x10
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x9
Definition: macros.h:24
macro save_context stp!stp x28
Definition: macros.h:24
macro save_context stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp!stp x2
Definition: macros.h:24