ia64/xen-unstable

view linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S @ 10703:8d501f39286c

[IA64] vDSO paravirtualization: paravirtualize vDSO

paravirtualize vdso areabased on Kevin's pointout and Dan's Idea.
introduce hyperprivop HYPERPRIVOP_RSM_BE and HYPERPRIVOP_GET_PSR.
and paravirtualize vdso area using them.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Mon Jul 24 13:43:35 2006 -0600 (2006-07-24)
parents 90329e7d6be5
children 147144f9ec51
line source
1 /*
2 * Support routines for Xen hypercalls
3 *
4 * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
5 */
7 #include <linux/config.h>
8 #include <asm/processor.h>
9 #include <asm/asmmacro.h>
11 /* To clear vpsr.ic, vpsr.i needs to be cleared first */
12 #define XEN_CLEAR_PSR_IC \
13 mov r14=1; \
14 movl r15=XSI_PSR_I_ADDR; \
15 movl r2=XSI_PSR_IC; \
16 ;; \
17 ld8 r15=[r15]; \
18 ld4 r3=[r2]; \
19 ;; \
20 ld1 r16=[r15]; \
21 ;; \
22 st1 [r15]=r14; \
23 st4 [r2]=r0; \
24 ;;
26 /* First restore vpsr.ic, and then vpsr.i */
27 #define XEN_RESTORE_PSR_IC \
28 st4 [r2]=r3; \
29 st1 [r15]=r16; \
30 ;;
32 GLOBAL_ENTRY(xen_get_ivr)
33 movl r8=running_on_xen;;
34 ld4 r8=[r8];;
35 cmp.eq p7,p0=r8,r0;;
36 (p7) mov r8=cr.ivr;;
37 (p7) br.ret.sptk.many rp
38 ;;
39 XEN_CLEAR_PSR_IC
40 ;;
41 XEN_HYPER_GET_IVR
42 ;;
43 XEN_RESTORE_PSR_IC
44 ;;
45 br.ret.sptk.many rp
46 ;;
47 END(xen_get_ivr)
49 GLOBAL_ENTRY(xen_get_tpr)
50 movl r8=running_on_xen;;
51 ld4 r8=[r8];;
52 cmp.eq p7,p0=r8,r0;;
53 (p7) mov r8=cr.tpr;;
54 (p7) br.ret.sptk.many rp
55 ;;
56 XEN_CLEAR_PSR_IC
57 ;;
58 XEN_HYPER_GET_TPR
59 ;;
60 XEN_RESTORE_PSR_IC
61 ;;
62 br.ret.sptk.many rp
63 ;;
64 END(xen_get_tpr)
66 GLOBAL_ENTRY(xen_set_tpr)
67 movl r8=running_on_xen;;
68 ld4 r8=[r8];;
69 cmp.eq p7,p0=r8,r0;;
70 (p7) mov cr.tpr=r32;;
71 (p7) br.ret.sptk.many rp
72 ;;
73 mov r8=r32
74 ;;
75 XEN_CLEAR_PSR_IC
76 ;;
77 XEN_HYPER_SET_TPR
78 ;;
79 XEN_RESTORE_PSR_IC
80 ;;
81 br.ret.sptk.many rp
82 ;;
83 END(xen_set_tpr)
85 GLOBAL_ENTRY(xen_eoi)
86 movl r8=running_on_xen;;
87 ld4 r8=[r8];;
88 cmp.eq p7,p0=r8,r0;;
89 (p7) mov cr.eoi=r0;;
90 (p7) br.ret.sptk.many rp
91 ;;
92 mov r8=r32
93 ;;
94 XEN_CLEAR_PSR_IC
95 ;;
96 XEN_HYPER_EOI
97 ;;
98 XEN_RESTORE_PSR_IC
99 ;;
100 br.ret.sptk.many rp
101 ;;
102 END(xen_eoi)
104 GLOBAL_ENTRY(xen_thash)
105 movl r8=running_on_xen;;
106 ld4 r8=[r8];;
107 cmp.eq p7,p0=r8,r0;;
108 (p7) thash r8=r32;;
109 (p7) br.ret.sptk.many rp
110 ;;
111 mov r8=r32
112 ;;
113 XEN_CLEAR_PSR_IC
114 ;;
115 XEN_HYPER_THASH
116 ;;
117 XEN_RESTORE_PSR_IC
118 ;;
119 br.ret.sptk.many rp
120 ;;
121 END(xen_thash)
123 GLOBAL_ENTRY(xen_set_itm)
124 movl r8=running_on_xen;;
125 ld4 r8=[r8];;
126 cmp.eq p7,p0=r8,r0;;
127 (p7) mov cr.itm=r32;;
128 (p7) br.ret.sptk.many rp
129 ;;
130 mov r8=r32
131 ;;
132 XEN_CLEAR_PSR_IC
133 ;;
134 XEN_HYPER_SET_ITM
135 ;;
136 XEN_RESTORE_PSR_IC
137 ;;
138 br.ret.sptk.many rp
139 ;;
140 END(xen_set_itm)
142 GLOBAL_ENTRY(xen_ptcga)
143 movl r8=running_on_xen;;
144 ld4 r8=[r8];;
145 cmp.eq p7,p0=r8,r0;;
146 (p7) ptc.ga r32,r33;;
147 (p7) br.ret.sptk.many rp
148 ;;
149 mov r8=r32
150 mov r9=r33
151 ;;
152 XEN_CLEAR_PSR_IC
153 ;;
154 XEN_HYPER_PTC_GA
155 ;;
156 XEN_RESTORE_PSR_IC
157 ;;
158 br.ret.sptk.many rp
159 ;;
160 END(xen_ptcga)
162 GLOBAL_ENTRY(xen_get_rr)
163 movl r8=running_on_xen;;
164 ld4 r8=[r8];;
165 cmp.eq p7,p0=r8,r0;;
166 (p7) mov r8=rr[r32];;
167 (p7) br.ret.sptk.many rp
168 ;;
169 mov r8=r32
170 ;;
171 XEN_CLEAR_PSR_IC
172 ;;
173 XEN_HYPER_GET_RR
174 ;;
175 XEN_RESTORE_PSR_IC
176 ;;
177 br.ret.sptk.many rp
178 ;;
179 END(xen_get_rr)
181 GLOBAL_ENTRY(xen_set_rr)
182 movl r8=running_on_xen;;
183 ld4 r8=[r8];;
184 cmp.eq p7,p0=r8,r0;;
185 (p7) mov rr[r32]=r33;;
186 (p7) br.ret.sptk.many rp
187 ;;
188 mov r8=r32
189 mov r9=r33
190 ;;
191 XEN_CLEAR_PSR_IC
192 ;;
193 XEN_HYPER_SET_RR
194 ;;
195 XEN_RESTORE_PSR_IC
196 ;;
197 br.ret.sptk.many rp
198 ;;
199 END(xen_set_rr)
201 GLOBAL_ENTRY(xen_set_kr)
202 movl r8=running_on_xen;;
203 ld4 r8=[r8];;
204 cmp.ne p7,p0=r8,r0;;
205 (p7) br.cond.spnt.few 1f;
206 ;;
207 cmp.eq p7,p0=r8,r0
208 adds r8=-1,r8;;
209 (p7) mov ar0=r9
210 (p7) br.ret.sptk.many rp;;
211 cmp.eq p7,p0=r8,r0
212 adds r8=-1,r8;;
213 (p7) mov ar1=r9
214 (p7) br.ret.sptk.many rp;;
215 cmp.eq p7,p0=r8,r0
216 adds r8=-1,r8;;
217 (p7) mov ar2=r9
218 (p7) br.ret.sptk.many rp;;
219 cmp.eq p7,p0=r8,r0
220 adds r8=-1,r8;;
221 (p7) mov ar3=r9
222 (p7) br.ret.sptk.many rp;;
223 cmp.eq p7,p0=r8,r0
224 adds r8=-1,r8;;
225 (p7) mov ar4=r9
226 (p7) br.ret.sptk.many rp;;
227 cmp.eq p7,p0=r8,r0
228 adds r8=-1,r8;;
229 (p7) mov ar5=r9
230 (p7) br.ret.sptk.many rp;;
231 cmp.eq p7,p0=r8,r0
232 adds r8=-1,r8;;
233 (p7) mov ar6=r9
234 (p7) br.ret.sptk.many rp;;
235 cmp.eq p7,p0=r8,r0
236 adds r8=-1,r8;;
237 (p7) mov ar7=r9
238 (p7) br.ret.sptk.many rp;;
240 1: mov r8=r32
241 mov r9=r33
242 ;;
243 XEN_CLEAR_PSR_IC
244 ;;
245 XEN_HYPER_SET_KR
246 ;;
247 XEN_RESTORE_PSR_IC
248 ;;
249 br.ret.sptk.many rp
250 END(xen_set_kr)
252 GLOBAL_ENTRY(xen_fc)
253 movl r8=running_on_xen;;
254 ld4 r8=[r8];;
255 cmp.eq p7,p0=r8,r0;;
256 (p7) fc r32;;
257 (p7) br.ret.sptk.many rp
258 ;;
259 mov r8=r32
260 ;;
261 XEN_CLEAR_PSR_IC
262 ;;
263 XEN_HYPER_FC
264 ;;
265 XEN_RESTORE_PSR_IC
266 ;;
267 br.ret.sptk.many rp
268 END(xen_fc)
270 GLOBAL_ENTRY(xen_get_cpuid)
271 movl r8=running_on_xen;;
272 ld4 r8=[r8];;
273 cmp.eq p7,p0=r8,r0;;
274 (p7) mov r8=cpuid[r32];;
275 (p7) br.ret.sptk.many rp
276 ;;
277 mov r8=r32
278 ;;
279 XEN_CLEAR_PSR_IC
280 ;;
281 XEN_HYPER_GET_CPUID
282 ;;
283 XEN_RESTORE_PSR_IC
284 ;;
285 br.ret.sptk.many rp
286 END(xen_get_cpuid)
288 GLOBAL_ENTRY(xen_get_pmd)
289 movl r8=running_on_xen;;
290 ld4 r8=[r8];;
291 cmp.eq p7,p0=r8,r0;;
292 (p7) mov r8=pmd[r32];;
293 (p7) br.ret.sptk.many rp
294 ;;
295 mov r8=r32
296 ;;
297 XEN_CLEAR_PSR_IC
298 ;;
299 XEN_HYPER_GET_PMD
300 ;;
301 XEN_RESTORE_PSR_IC
302 ;;
303 br.ret.sptk.many rp
304 END(xen_get_pmd)
306 #ifdef CONFIG_IA32_SUPPORT
307 GLOBAL_ENTRY(xen_get_eflag)
308 movl r8=running_on_xen;;
309 ld4 r8=[r8];;
310 cmp.eq p7,p0=r8,r0;;
311 (p7) mov r8=ar24;;
312 (p7) br.ret.sptk.many rp
313 ;;
314 mov r8=r32
315 ;;
316 XEN_CLEAR_PSR_IC
317 ;;
318 XEN_HYPER_GET_EFLAG
319 ;;
320 XEN_RESTORE_PSR_IC
321 ;;
322 br.ret.sptk.many rp
323 END(xen_get_eflag)
325 // some bits aren't set if pl!=0, see SDM vol1 3.1.8
326 GLOBAL_ENTRY(xen_set_eflag)
327 movl r8=running_on_xen;;
328 ld4 r8=[r8];;
329 cmp.eq p7,p0=r8,r0;;
330 (p7) mov ar24=r32
331 (p7) br.ret.sptk.many rp
332 ;;
333 mov r8=r32
334 ;;
335 XEN_CLEAR_PSR_IC
336 ;;
337 XEN_HYPER_SET_EFLAG
338 ;;
339 XEN_RESTORE_PSR_IC
340 ;;
341 br.ret.sptk.many rp
342 END(xen_set_eflag)
343 #endif
345 GLOBAL_ENTRY(xen_send_ipi)
346 mov r14=r32
347 mov r15=r33
348 mov r2=0x400
349 break 0x1000
350 ;;
351 br.ret.sptk.many rp
352 ;;
353 END(xen_send_ipi)
355 #ifdef CONFIG_XEN_IA64_VDSO_PARAVIRT
356 // Those are vdso specialized.
357 // In fsys mode, call, ret can't be used.
358 GLOBAL_ENTRY(xen_rsm_be_i)
359 ld8 r22=[r22]
360 ;;
361 st1 [r22]=r20
362 st4 [r23]=r0
363 XEN_HYPER_RSM_BE
364 st4 [r23]=r20
365 brl.cond.sptk .vdso_rsm_be_i_ret
366 ;;
367 END(xen_rsm_be_i)
369 GLOBAL_ENTRY(xen_get_psr)
370 mov r31=r8
371 mov r25=IA64_PSR_IC
372 st4 [r23]=r0
373 XEN_HYPER_GET_PSR
374 ;;
375 st4 [r23]=r20
376 or r29=r8,r25 // vpsr.ic was cleared for hyperprivop
377 mov r8=r31
378 brl.cond.sptk .vdso_get_psr_ret
379 ;;
380 END(xen_get_psr)
382 GLOBAL_ENTRY(xen_ssm_i_0)
383 st4 [r22]=r20
384 ld4 r25=[r24]
385 ;;
386 cmp.ne.unc p11,p0=r0, r25
387 ;;
388 (p11) st4 [r22]=r0
389 (p11) st4 [r23]=r0
390 (p11) XEN_HYPER_SSM_I
392 brl.cond.sptk .vdso_ssm_i_0_ret
393 ;;
394 END(xen_ssm_i_0)
396 GLOBAL_ENTRY(xen_ssm_i_1)
397 st4 [r22]=r20
398 ld4 r25=[r24]
399 ;;
400 cmp.ne.unc p11,p0=r0, r25
401 ;;
402 (p11) st4 [r22]=r0
403 (p11) st4 [r23]=r0
404 (p11) XEN_HYPER_SSM_I
405 ;;
406 brl.cond.sptk .vdso_ssm_i_1_ret
407 ;;
408 END(xen_ssm_i_1)
409 #endif