[IA64] pvops: define paravirtualized instructions for native.
[linux-2.6] / include / asm-ia64 / native / inst.h
1 /******************************************************************************
2  * include/asm-ia64/native/inst.h
3  *
4  * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5  *                    VA Linux Systems Japan K.K.
6  *
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.
11  *
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.
16  *
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
20  *
21  */
22
23 #ifdef CONFIG_PARAVIRT_GUEST_ASM_CLOBBER_CHECK
24 # define PARAVIRT_POISON        0xdeadbeefbaadf00d
25 # define CLOBBER(clob)                          \
26         ;;                                      \
27         movl clob = PARAVIRT_POISON;            \
28         ;;
29 #else
30 # define CLOBBER(clob)          /* nothing */
31 #endif
32
33 #define MOV_FROM_IFA(reg)       \
34         mov reg = cr.ifa
35
36 #define MOV_FROM_ITIR(reg)      \
37         mov reg = cr.itir
38
39 #define MOV_FROM_ISR(reg)       \
40         mov reg = cr.isr
41
42 #define MOV_FROM_IHA(reg)       \
43         mov reg = cr.iha
44
45 #define MOV_FROM_IPSR(pred, reg)        \
46 (pred)  mov reg = cr.ipsr
47
48 #define MOV_FROM_IIM(reg)       \
49         mov reg = cr.iim
50
51 #define MOV_FROM_IIP(reg)       \
52         mov reg = cr.iip
53
54 #define MOV_FROM_IVR(reg, clob) \
55         mov reg = cr.ivr        \
56         CLOBBER(clob)
57
58 #define MOV_FROM_PSR(pred, reg, clob)   \
59 (pred)  mov reg = psr                   \
60         CLOBBER(clob)
61
62 #define MOV_TO_IFA(reg, clob)   \
63         mov cr.ifa = reg        \
64         CLOBBER(clob)
65
66 #define MOV_TO_ITIR(pred, reg, clob)    \
67 (pred)  mov cr.itir = reg               \
68         CLOBBER(clob)
69
70 #define MOV_TO_IHA(pred, reg, clob)     \
71 (pred)  mov cr.iha = reg                \
72         CLOBBER(clob)
73
74 #define MOV_TO_IPSR(pred, reg, clob)            \
75 (pred)  mov cr.ipsr = reg                       \
76         CLOBBER(clob)
77
78 #define MOV_TO_IFS(pred, reg, clob)     \
79 (pred)  mov cr.ifs = reg                \
80         CLOBBER(clob)
81
82 #define MOV_TO_IIP(reg, clob)   \
83         mov cr.iip = reg        \
84         CLOBBER(clob)
85
86 #define MOV_TO_KR(kr, reg, clob0, clob1)        \
87         mov IA64_KR(kr) = reg                   \
88         CLOBBER(clob0)                          \
89         CLOBBER(clob1)
90
91 #define ITC_I(pred, reg, clob)  \
92 (pred)  itc.i reg               \
93         CLOBBER(clob)
94
95 #define ITC_D(pred, reg, clob)  \
96 (pred)  itc.d reg               \
97         CLOBBER(clob)
98
99 #define ITC_I_AND_D(pred_i, pred_d, reg, clob)  \
100 (pred_i) itc.i reg;                             \
101 (pred_d) itc.d reg                              \
102         CLOBBER(clob)
103
104 #define THASH(pred, reg0, reg1, clob)           \
105 (pred)  thash reg0 = reg1                       \
106         CLOBBER(clob)
107
108 #define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1)            \
109         ssm psr.ic | PSR_DEFAULT_BITS                                   \
110         CLOBBER(clob0)                                                  \
111         CLOBBER(clob1)                                                  \
112         ;;                                                              \
113         srlz.i /* guarantee that interruption collectin is on */        \
114         ;;
115
116 #define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1)     \
117         ssm psr.ic                              \
118         CLOBBER(clob0)                          \
119         CLOBBER(clob1)                          \
120         ;;                                      \
121         srlz.d
122
123 #define RSM_PSR_IC(clob)        \
124         rsm psr.ic              \
125         CLOBBER(clob)
126
127 #define SSM_PSR_I(pred, pred_clob, clob)        \
128 (pred)  ssm psr.i                               \
129         CLOBBER(clob)
130
131 #define RSM_PSR_I(pred, clob0, clob1)   \
132 (pred)  rsm psr.i                       \
133         CLOBBER(clob0)                  \
134         CLOBBER(clob1)
135
136 #define RSM_PSR_I_IC(clob0, clob1, clob2)       \
137         rsm psr.i | psr.ic                      \
138         CLOBBER(clob0)                          \
139         CLOBBER(clob1)                          \
140         CLOBBER(clob2)
141
142 #define RSM_PSR_DT              \
143         rsm psr.dt
144
145 #define SSM_PSR_DT_AND_SRLZ_I   \
146         ssm psr.dt              \
147         ;;                      \
148         srlz.i
149
150 #define BSW_0(clob0, clob1, clob2)      \
151         bsw.0                           \
152         CLOBBER(clob0)                  \
153         CLOBBER(clob1)                  \
154         CLOBBER(clob2)
155
156 #define BSW_1(clob0, clob1)     \
157         bsw.1                   \
158         CLOBBER(clob0)          \
159         CLOBBER(clob1)
160
161 #define COVER   \
162         cover
163
164 #define RFI     \
165         rfi