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 MOV_FROM_IFA(reg) \
41 #define MOV_FROM_ITIR(reg) \
42 movl reg = XSI_ITIR; \
46 #define MOV_FROM_ISR(reg) \
51 #define MOV_FROM_IHA(reg) \
56 #define MOV_FROM_IPSR(pred, reg) \
57 (pred) movl reg = XSI_IPSR; \
59 (pred) ld8 reg = [reg]
61 #define MOV_FROM_IIM(reg) \
66 #define MOV_FROM_IIP(reg) \
71 .macro __MOV_FROM_IVR reg, clob
91 #define MOV_FROM_IVR(reg, clob) __MOV_FROM_IVR reg, clob
93 .macro __MOV_FROM_PSR pred, reg, clob
95 (\pred) XEN_HYPER_GET_PSR;
99 (\pred) XEN_HYPER_GET_PSR
101 (\pred) mov \reg = r8
105 (\pred) mov \clob = r8
106 (\pred) XEN_HYPER_GET_PSR
108 (\pred) mov \reg = r8
109 (\pred) mov r8 = \clob
111 #define MOV_FROM_PSR(pred, reg, clob) __MOV_FROM_PSR pred, reg, clob
114 #define MOV_TO_IFA(reg, clob) \
115 movl clob = XSI_IFA; \
119 #define MOV_TO_ITIR(pred, reg, clob) \
120 (pred) movl clob = XSI_ITIR; \
122 (pred) st8 [clob] = reg
124 #define MOV_TO_IHA(pred, reg, clob) \
125 (pred) movl clob = XSI_IHA; \
127 (pred) st8 [clob] = reg
129 #define MOV_TO_IPSR(pred, reg, clob) \
130 (pred) movl clob = XSI_IPSR; \
132 (pred) st8 [clob] = reg; \
135 #define MOV_TO_IFS(pred, reg, clob) \
136 (pred) movl clob = XSI_IFS; \
138 (pred) st8 [clob] = reg; \
141 #define MOV_TO_IIP(reg, clob) \
142 movl clob = XSI_IIP; \
146 .macro ____MOV_TO_KR kr, reg, clob0, clob1
148 .error "clob0 \clob0 must not be r9"
151 .error "clob1 \clob1 must not be r8"
177 .macro __MOV_TO_KR kr, reg, clob0, clob1
179 ____MOV_TO_KR \kr, \reg, \clob1, \clob0
183 ____MOV_TO_KR \kr, \reg, \clob1, \clob0
187 ____MOV_TO_KR \kr, \reg, \clob0, \clob1
190 #define MOV_TO_KR(kr, reg, clob0, clob1) \
191 __MOV_TO_KR IA64_KR_ ## kr, reg, clob0, clob1
194 .macro __ITC_I pred, reg, clob
196 (\pred) XEN_HYPER_ITC_I
200 (\pred) mov r8 = \reg
202 (\pred) XEN_HYPER_ITC_I
206 (\pred) mov \clob = r8
207 (\pred) mov r8 = \reg
209 (\pred) XEN_HYPER_ITC_I
211 (\pred) mov r8 = \clob
214 #define ITC_I(pred, reg, clob) __ITC_I pred, reg, clob
216 .macro __ITC_D pred, reg, clob
218 (\pred) XEN_HYPER_ITC_D
223 (\pred) mov r8 = \reg
225 (\pred) XEN_HYPER_ITC_D
230 (\pred) mov \clob = r8
231 (\pred) mov r8 = \reg
233 (\pred) XEN_HYPER_ITC_D
235 (\pred) mov r8 = \clob
238 #define ITC_D(pred, reg, clob) __ITC_D pred, reg, clob
240 .macro __ITC_I_AND_D pred_i, pred_d, reg, clob
242 (\pred_i)XEN_HYPER_ITC_I
244 (\pred_d)XEN_HYPER_ITC_D
251 (\pred_i)XEN_HYPER_ITC_I
253 (\pred_d)XEN_HYPER_ITC_D
261 (\pred_i)XEN_HYPER_ITC_I
263 (\pred_d)XEN_HYPER_ITC_D
268 #define ITC_I_AND_D(pred_i, pred_d, reg, clob) \
269 __ITC_I_AND_D pred_i, pred_d, reg, clob
271 .macro __THASH pred, reg0, reg1, clob
273 (\pred) mov r8 = \reg1
274 (\pred) XEN_HYPER_THASH
278 (\pred) XEN_HYPER_THASH
280 (\pred) mov \reg0 = r8
285 (\pred) mov r8 = \reg1
286 (\pred) XEN_HYPER_THASH
288 (\pred) mov \reg0 = r8
293 (\pred) mov \clob = r8
294 (\pred) mov r8 = \reg1
295 (\pred) XEN_HYPER_THASH
297 (\pred) mov \reg0 = r8
298 (\pred) mov r8 = \clob
301 #define THASH(pred, reg0, reg1, clob) __THASH pred, reg0, reg1, clob
303 #define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1) \
305 movl clob1 = XSI_PSR_IC; \
307 st4 [clob1] = clob0 \
310 #define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1) \
314 movl clob0 = XSI_PSR_IC; \
318 #define RSM_PSR_IC(clob) \
319 movl clob = XSI_PSR_IC; \
324 /* pred will be clobbered */
325 #define MASK_TO_PEND_OFS (-1)
326 #define SSM_PSR_I(pred, pred_clob, clob) \
327 (pred) movl clob = XSI_PSR_I_ADDR \
329 (pred) ld8 clob = [clob] \
331 /* if (pred) vpsr.i = 1 */ \
332 /* if (pred) (vcpu->vcpu_info->evtchn_upcall_mask)=0 */ \
333 (pred) st1 [clob] = r0, MASK_TO_PEND_OFS \
335 /* if (vcpu->vcpu_info->evtchn_upcall_pending) */ \
336 (pred) ld1 clob = [clob] \
338 (pred) cmp.ne.unc pred_clob, p0 = clob, r0 \
340 (pred_clob)XEN_HYPER_SSM_I /* do areal ssm psr.i */
342 #define RSM_PSR_I(pred, clob0, clob1) \
343 movl clob0 = XSI_PSR_I_ADDR; \
346 ld8 clob0 = [clob0]; \
348 (pred) st1 [clob0] = clob1
350 #define RSM_PSR_I_IC(clob0, clob1, clob2) \
351 movl clob0 = XSI_PSR_I_ADDR; \
352 movl clob1 = XSI_PSR_IC; \
354 ld8 clob0 = [clob0]; \
357 /* note: clears both vpsr.i and vpsr.ic! */ \
358 st1 [clob0] = clob2; \
365 #define SSM_PSR_DT_AND_SRLZ_I \
368 #define BSW_0(clob0, clob1, clob2) \
370 /* r16-r31 all now hold bank1 values */ \
371 mov clob2 = ar.unat; \
372 movl clob0 = XSI_BANK1_R16; \
373 movl clob1 = XSI_BANK1_R16 + 8; \
375 .mem.offset 0, 0; st8.spill [clob0] = r16, 16; \
376 .mem.offset 8, 0; st8.spill [clob1] = r17, 16; \
378 .mem.offset 0, 0; st8.spill [clob0] = r18, 16; \
379 .mem.offset 8, 0; st8.spill [clob1] = r19, 16; \
381 .mem.offset 0, 0; st8.spill [clob0] = r20, 16; \
382 .mem.offset 8, 0; st8.spill [clob1] = r21, 16; \
384 .mem.offset 0, 0; st8.spill [clob0] = r22, 16; \
385 .mem.offset 8, 0; st8.spill [clob1] = r23, 16; \
387 .mem.offset 0, 0; st8.spill [clob0] = r24, 16; \
388 .mem.offset 8, 0; st8.spill [clob1] = r25, 16; \
390 .mem.offset 0, 0; st8.spill [clob0] = r26, 16; \
391 .mem.offset 8, 0; st8.spill [clob1] = r27, 16; \
393 .mem.offset 0, 0; st8.spill [clob0] = r28, 16; \
394 .mem.offset 8, 0; st8.spill [clob1] = r29, 16; \
396 .mem.offset 0, 0; st8.spill [clob0] = r30, 16; \
397 .mem.offset 8, 0; st8.spill [clob1] = r31, 16; \
399 mov clob1 = ar.unat; \
400 movl clob0 = XSI_B1NAT; \
402 st8 [clob0] = clob1; \
403 mov ar.unat = clob2; \
404 movl clob0 = XSI_BANKNUM; \
409 /* FIXME: THIS CODE IS NOT NaT SAFE! */
410 #define XEN_BSW_1(clob) \
411 mov clob = ar.unat; \
412 movl r30 = XSI_B1NAT; \
418 movl r30 = XSI_BANKNUM; \
421 movl r30 = XSI_BANK1_R16; \
422 movl r31 = XSI_BANK1_R16+8; \
424 ld8.fill r16 = [r30], 16; \
425 ld8.fill r17 = [r31], 16; \
427 ld8.fill r18 = [r30], 16; \
428 ld8.fill r19 = [r31], 16; \
430 ld8.fill r20 = [r30], 16; \
431 ld8.fill r21 = [r31], 16; \
433 ld8.fill r22 = [r30], 16; \
434 ld8.fill r23 = [r31], 16; \
436 ld8.fill r24 = [r30], 16; \
437 ld8.fill r25 = [r31], 16; \
439 ld8.fill r26 = [r30], 16; \
440 ld8.fill r27 = [r31], 16; \
442 ld8.fill r28 = [r30], 16; \
443 ld8.fill r29 = [r31], 16; \
445 ld8.fill r30 = [r30]; \
446 ld8.fill r31 = [r31]; \
450 #define BSW_1(clob0, clob1) XEN_BSW_1(clob1)