1 /******************************************************************************
2 * arch/ia64/include/asm/xen/inst.h
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <asm/xen/privop.h>
25 #define ia64_ivt xen_ivt
26 #define DO_SAVE_MIN XEN_DO_SAVE_MIN
28 #define __paravirt_switch_to xen_switch_to
29 #define __paravirt_leave_syscall xen_leave_syscall
30 #define __paravirt_work_processed_syscall xen_work_processed_syscall
31 #define __paravirt_leave_kernel xen_leave_kernel
32 #define __paravirt_pending_syscall_end xen_work_pending_syscall_end
33 #define __paravirt_work_processed_syscall_target \
34 xen_work_processed_syscall
36 #define paravirt_fsyscall_table xen_fsyscall_table
37 #define paravirt_fsys_bubble_down xen_fsys_bubble_down
39 #define MOV_FROM_IFA(reg) \
44 #define MOV_FROM_ITIR(reg) \
45 movl reg = XSI_ITIR; \
49 #define MOV_FROM_ISR(reg) \
54 #define MOV_FROM_IHA(reg) \
59 #define MOV_FROM_IPSR(pred, reg) \
60 (pred) movl reg = XSI_IPSR; \
62 (pred) ld8 reg = [reg]
64 #define MOV_FROM_IIM(reg) \
69 #define MOV_FROM_IIP(reg) \
74 .macro __MOV_FROM_IVR reg
, clob
94 #define MOV_FROM_IVR(reg, clob) __MOV_FROM_IVR reg, clob
96 .macro __MOV_FROM_PSR pred
, reg
, clob
98 (\pred
) XEN_HYPER_GET_PSR
;
102 (\pred
) XEN_HYPER_GET_PSR
104 (\pred
) mov
\reg
= r8
108 (\pred
) mov \clob
= r8
109 (\pred
) XEN_HYPER_GET_PSR
111 (\pred
) mov
\reg
= r8
112 (\pred
) mov r8
= \clob
114 #define MOV_FROM_PSR(pred, reg, clob) __MOV_FROM_PSR pred, reg, clob
116 /* assuming ar.itc is read with interrupt disabled. */
117 #define MOV_FROM_ITC(pred, pred_clob, reg, clob) \
118 (pred) movl clob = XSI_ITC_OFFSET; \
120 (pred) ld8 clob = [clob]; \
121 (pred) mov reg = ar.itc; \
123 (pred) add reg = reg, clob; \
125 (pred) movl clob = XSI_ITC_LAST; \
127 (pred) ld8 clob = [clob]; \
129 (pred) cmp.geu.unc pred_clob, p0 = clob, reg; \
131 (pred_clob) add reg = 1, clob; \
133 (pred) movl clob = XSI_ITC_LAST; \
135 (pred) st8 [clob] = reg
138 #define MOV_TO_IFA(reg, clob) \
139 movl clob = XSI_IFA; \
143 #define MOV_TO_ITIR(pred, reg, clob) \
144 (pred) movl clob = XSI_ITIR; \
146 (pred) st8 [clob] = reg
148 #define MOV_TO_IHA(pred, reg, clob) \
149 (pred) movl clob = XSI_IHA; \
151 (pred) st8 [clob] = reg
153 #define MOV_TO_IPSR(pred, reg, clob) \
154 (pred) movl clob = XSI_IPSR; \
156 (pred) st8 [clob] = reg; \
159 #define MOV_TO_IFS(pred, reg, clob) \
160 (pred) movl clob = XSI_IFS; \
162 (pred) st8 [clob] = reg; \
165 #define MOV_TO_IIP(reg, clob) \
166 movl clob = XSI_IIP; \
170 .macro ____MOV_TO_KR kr
, reg
, clob0
, clob1
172 .error
"clob0 \clob0 must not be r9"
175 .error
"clob1 \clob1 must not be r8"
201 .macro __MOV_TO_KR kr
, reg
, clob0
, clob1
203 ____MOV_TO_KR \kr
, \reg
, \clob1
, \clob0
207 ____MOV_TO_KR \kr
, \reg
, \clob1
, \clob0
211 ____MOV_TO_KR \kr
, \reg
, \clob0
, \clob1
214 #define MOV_TO_KR(kr, reg, clob0, clob1) \
215 __MOV_TO_KR IA64_KR_ ## kr, reg, clob0, clob1
218 .macro __ITC_I pred
, reg
, clob
220 (\pred
) XEN_HYPER_ITC_I
224 (\pred
) mov r8
= \reg
226 (\pred
) XEN_HYPER_ITC_I
230 (\pred
) mov \clob
= r8
231 (\pred
) mov r8
= \reg
233 (\pred
) XEN_HYPER_ITC_I
235 (\pred
) mov r8
= \clob
238 #define ITC_I(pred, reg, clob) __ITC_I pred, reg, clob
240 .macro __ITC_D pred
, reg
, clob
242 (\pred
) XEN_HYPER_ITC_D
247 (\pred
) mov r8
= \reg
249 (\pred
) XEN_HYPER_ITC_D
254 (\pred
) mov \clob
= r8
255 (\pred
) mov r8
= \reg
257 (\pred
) XEN_HYPER_ITC_D
259 (\pred
) mov r8
= \clob
262 #define ITC_D(pred, reg, clob) __ITC_D pred, reg, clob
264 .macro __ITC_I_AND_D pred_i
, pred_d
, reg
, clob
266 (\pred_i
)XEN_HYPER_ITC_I
268 (\pred_d
)XEN_HYPER_ITC_D
275 (\pred_i
)XEN_HYPER_ITC_I
277 (\pred_d
)XEN_HYPER_ITC_D
285 (\pred_i
)XEN_HYPER_ITC_I
287 (\pred_d
)XEN_HYPER_ITC_D
292 #define ITC_I_AND_D(pred_i, pred_d, reg, clob) \
293 __ITC_I_AND_D pred_i, pred_d, reg, clob
295 .macro __THASH pred
, reg0
, reg1
, clob
297 (\pred
) mov r8
= \reg
1
298 (\pred
) XEN_HYPER_THASH
302 (\pred
) XEN_HYPER_THASH
304 (\pred
) mov
\reg
0 = r8
309 (\pred
) mov r8
= \reg
1
310 (\pred
) XEN_HYPER_THASH
312 (\pred
) mov
\reg
0 = r8
317 (\pred
) mov \clob
= r8
318 (\pred
) mov r8
= \reg
1
319 (\pred
) XEN_HYPER_THASH
321 (\pred
) mov
\reg
0 = r8
322 (\pred
) mov r8
= \clob
325 #define THASH(pred, reg0, reg1, clob) __THASH pred, reg0, reg1, clob
327 #define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1) \
329 movl clob1 = XSI_PSR_IC; \
331 st4 [clob1] = clob0 \
334 #define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1) \
338 movl clob0 = XSI_PSR_IC; \
342 #define RSM_PSR_IC(clob) \
343 movl clob = XSI_PSR_IC; \
348 /* pred will be clobbered */
349 #define MASK_TO_PEND_OFS (-1)
350 #define SSM_PSR_I(pred, pred_clob, clob) \
351 (pred) movl clob = XSI_PSR_I_ADDR \
353 (pred) ld8 clob = [clob] \
355 /* if (pred) vpsr.i = 1 */ \
356 /* if (pred) (vcpu->vcpu_info->evtchn_upcall_mask)=0 */ \
357 (pred) st1 [clob] = r0, MASK_TO_PEND_OFS \
359 /* if (vcpu->vcpu_info->evtchn_upcall_pending) */ \
360 (pred) ld1 clob = [clob] \
362 (pred) cmp.ne.unc pred_clob, p0 = clob, r0 \
364 (pred_clob)XEN_HYPER_SSM_I /* do areal ssm psr.i */
366 #define RSM_PSR_I(pred, clob0, clob1) \
367 movl clob0 = XSI_PSR_I_ADDR; \
370 ld8 clob0 = [clob0]; \
372 (pred) st1 [clob0] = clob1
374 #define RSM_PSR_I_IC(clob0, clob1, clob2) \
375 movl clob0 = XSI_PSR_I_ADDR; \
376 movl clob1 = XSI_PSR_IC; \
378 ld8 clob0 = [clob0]; \
381 /* note: clears both vpsr.i and vpsr.ic! */ \
382 st1 [clob0] = clob2; \
389 #define RSM_PSR_BE_I(clob0, clob1) \
390 RSM_PSR_I(p0, clob0, clob1); \
393 #define SSM_PSR_DT_AND_SRLZ_I \
396 #define BSW_0(clob0, clob1, clob2) \
398 /* r16-r31 all now hold bank1 values */ \
399 mov clob2 = ar.unat; \
400 movl clob0 = XSI_BANK1_R16; \
401 movl clob1 = XSI_BANK1_R16 + 8; \
403 .mem.offset 0, 0; st8.spill [clob0] = r16, 16; \
404 .mem.offset 8, 0; st8.spill [clob1] = r17, 16; \
406 .mem.offset 0, 0; st8.spill [clob0] = r18, 16; \
407 .mem.offset 8, 0; st8.spill [clob1] = r19, 16; \
409 .mem.offset 0, 0; st8.spill [clob0] = r20, 16; \
410 .mem.offset 8, 0; st8.spill [clob1] = r21, 16; \
412 .mem.offset 0, 0; st8.spill [clob0] = r22, 16; \
413 .mem.offset 8, 0; st8.spill [clob1] = r23, 16; \
415 .mem.offset 0, 0; st8.spill [clob0] = r24, 16; \
416 .mem.offset 8, 0; st8.spill [clob1] = r25, 16; \
418 .mem.offset 0, 0; st8.spill [clob0] = r26, 16; \
419 .mem.offset 8, 0; st8.spill [clob1] = r27, 16; \
421 .mem.offset 0, 0; st8.spill [clob0] = r28, 16; \
422 .mem.offset 8, 0; st8.spill [clob1] = r29, 16; \
424 .mem.offset 0, 0; st8.spill [clob0] = r30, 16; \
425 .mem.offset 8, 0; st8.spill [clob1] = r31, 16; \
427 mov clob1 = ar.unat; \
428 movl clob0 = XSI_B1NAT; \
430 st8 [clob0] = clob1; \
431 mov ar.unat = clob2; \
432 movl clob0 = XSI_BANKNUM; \
437 /* FIXME: THIS CODE IS NOT NaT SAFE! */
438 #define XEN_BSW_1(clob) \
439 mov clob = ar.unat; \
440 movl r30 = XSI_B1NAT; \
446 movl r30 = XSI_BANKNUM; \
449 movl r30 = XSI_BANK1_R16; \
450 movl r31 = XSI_BANK1_R16+8; \
452 ld8.fill r16 = [r30], 16; \
453 ld8.fill r17 = [r31], 16; \
455 ld8.fill r18 = [r30], 16; \
456 ld8.fill r19 = [r31], 16; \
458 ld8.fill r20 = [r30], 16; \
459 ld8.fill r21 = [r31], 16; \
461 ld8.fill r22 = [r30], 16; \
462 ld8.fill r23 = [r31], 16; \
464 ld8.fill r24 = [r30], 16; \
465 ld8.fill r25 = [r31], 16; \
467 ld8.fill r26 = [r30], 16; \
468 ld8.fill r27 = [r31], 16; \
470 ld8.fill r28 = [r30], 16; \
471 ld8.fill r29 = [r31], 16; \
473 ld8.fill r30 = [r30]; \
474 ld8.fill r31 = [r31]; \
478 #define BSW_1(clob0, clob1) XEN_BSW_1(clob1)