1 #ifndef _ASM_NATIVE_PVCHK_INST_H
2 #define _ASM_NATIVE_PVCHK_INST_H
4 /******************************************************************************
5 * arch/ia64/include/asm/native/pvchk_inst.h
6 * Checker for paravirtualizations of privileged operations.
8 * Copyright (C) 2005 Hewlett-Packard Co
9 * Dan Magenheimer <dan.magenheimer@hp.com>
11 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
12 * VA Linux Systems Japan K.K.
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 /**********************************************
31 * Instructions paravirtualized for correctness
32 **********************************************/
34 /* "fc" and "thash" are privilege-sensitive instructions, meaning they
35 * may have different semantics depending on whether they are executed
36 * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't
37 * be allowed to execute directly, lest incorrect semantics result.
40 #define fc .error "fc should not be used directly."
41 #define thash .error "thash should not be used directly."
43 /* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
44 * is not currently used (though it may be in a long-format VHPT system!)
45 * and the semantics of cover only change if psr.ic is off which is very
46 * rare (and currently non-existent outside of assembly code
48 #define ttag .error "ttag should not be used directly."
49 #define cover .error "cover should not be used directly."
51 /* There are also privilege-sensitive registers. These registers are
52 * readable at any privilege level but only writable at PL0.
54 #define cpuid .error "cpuid should not be used directly."
55 #define pmd .error "pmd should not be used directly."
62 /**********************************************
63 * Instructions paravirtualized for performance
64 **********************************************/
66 * Those instructions include '.' which can't be handled by cpp.
67 * or can't be handled by cpp easily.
68 * They are handled by sed instead of cpp.
78 * ssm psr.ic | PSR_DEFAULT_BITS
121 /*************************************************************
122 * define paravirtualized instrcution macros as nop to ingore.
123 * and check whether arguments are appropriate.
124 *************************************************************/
126 /* check whether reg is a regular register */
127 .macro is_rreg_in reg
136 #define IS_RREG_IN(reg) is_rreg_in reg ;
138 #define IS_RREG_OUT(reg) \
143 #define IS_RREG_CLOB(reg) IS_RREG_OUT(reg)
145 /* check whether pred is a predicate register */
146 #define IS_PRED_IN(pred) \
151 #define IS_PRED_OUT(pred) \
153 cmp.eq pred, p0 = r0, r0 \
156 #define IS_PRED_CLOB(pred) IS_PRED_OUT(pred)
159 #define DO_SAVE_MIN(__COVER, SAVE_IFS, EXTRA, WORKAROUND) \
161 #define MOV_FROM_IFA(reg) \
163 #define MOV_FROM_ITIR(reg) \
165 #define MOV_FROM_ISR(reg) \
167 #define MOV_FROM_IHA(reg) \
169 #define MOV_FROM_IPSR(pred, reg) \
172 #define MOV_FROM_IIM(reg) \
174 #define MOV_FROM_IIP(reg) \
176 #define MOV_FROM_IVR(reg, clob) \
179 #define MOV_FROM_PSR(pred, reg, clob) \
183 #define MOV_FROM_ITC(pred, pred_clob, reg, clob) \
185 IS_PRED_CLOB(pred_clob) \
188 #define MOV_TO_IFA(reg, clob) \
191 #define MOV_TO_ITIR(pred, reg, clob) \
195 #define MOV_TO_IHA(pred, reg, clob) \
199 #define MOV_TO_IPSR(pred, reg, clob) \
203 #define MOV_TO_IFS(pred, reg, clob) \
207 #define MOV_TO_IIP(reg, clob) \
210 #define MOV_TO_KR(kr, reg, clob0, clob1) \
212 IS_RREG_CLOB(clob0) \
214 #define ITC_I(pred, reg, clob) \
218 #define ITC_D(pred, reg, clob) \
222 #define ITC_I_AND_D(pred_i, pred_d, reg, clob) \
227 #define THASH(pred, reg0, reg1, clob) \
232 #define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1) \
233 IS_RREG_CLOB(clob0) \
235 #define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1) \
236 IS_RREG_CLOB(clob0) \
238 #define RSM_PSR_IC(clob) \
240 #define SSM_PSR_I(pred, pred_clob, clob) \
242 IS_PRED_CLOB(pred_clob) \
244 #define RSM_PSR_I(pred, clob0, clob1) \
246 IS_RREG_CLOB(clob0) \
248 #define RSM_PSR_I_IC(clob0, clob1, clob2) \
249 IS_RREG_CLOB(clob0) \
250 IS_RREG_CLOB(clob1) \
254 #define RSM_PSR_BE_I(clob0, clob1) \
255 IS_RREG_CLOB(clob0) \
257 #define SSM_PSR_DT_AND_SRLZ_I \
259 #define BSW_0(clob0, clob1, clob2) \
260 IS_RREG_CLOB(clob0) \
261 IS_RREG_CLOB(clob1) \
263 #define BSW_1(clob0, clob1) \
264 IS_RREG_CLOB(clob0) \
269 br.ret.sptk.many rp /* defining nop causes dependency error */
271 #endif /* _ASM_NATIVE_PVCHK_INST_H */