disasm_int.h revision 1.2 1 1.2 scole /* $NetBSD: disasm_int.h,v 1.2 2016/08/05 16:45:50 scole Exp $ */
2 1.1 cherry
3 1.1 cherry /*-
4 1.2 scole * Copyright (c) 2000-2006 Marcel Moolenaar
5 1.1 cherry * All rights reserved.
6 1.1 cherry *
7 1.1 cherry * Redistribution and use in source and binary forms, with or without
8 1.1 cherry * modification, are permitted provided that the following conditions
9 1.1 cherry * are met:
10 1.1 cherry *
11 1.1 cherry * 1. Redistributions of source code must retain the above copyright
12 1.1 cherry * notice, this list of conditions and the following disclaimer.
13 1.1 cherry * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 cherry * notice, this list of conditions and the following disclaimer in the
15 1.1 cherry * documentation and/or other materials provided with the distribution.
16 1.1 cherry *
17 1.1 cherry * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.1 cherry * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1 cherry * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1 cherry * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.1 cherry * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.1 cherry * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.1 cherry * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.1 cherry * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.1 cherry * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.1 cherry * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1 cherry *
28 1.2 scole * $FreeBSD: releng/10.1/sys/ia64/disasm/disasm_int.h 159916 2006-06-24 19:21:11Z marcel $
29 1.1 cherry */
30 1.1 cherry
31 1.1 cherry #ifndef _DISASM_INT_H_
32 1.1 cherry #define _DISASM_INT_H_
33 1.1 cherry
34 1.1 cherry #ifdef _DISASM_H_
35 1.1 cherry #error Include disasm_int.h before disasm.h
36 1.1 cherry #endif
37 1.1 cherry
38 1.1 cherry /*
39 1.1 cherry * Instruction bundle specifics.
40 1.1 cherry */
41 1.1 cherry #define TMPL_BITS 5
42 1.1 cherry #define SLOT_BITS 41
43 1.1 cherry #define SLOT_COUNT 3
44 1.1 cherry
45 1.1 cherry #define BUNDLE_SIZE (SLOT_COUNT * SLOT_BITS + TMPL_BITS)
46 1.1 cherry #define BUNDLE_BYTES ((BUNDLE_SIZE+7) >> 3)
47 1.1 cherry #define TMPL_MASK ((1 << TMPL_BITS) - 1)
48 1.1 cherry #define SLOT_MASK ((1ULL << SLOT_BITS) - 1ULL)
49 1.1 cherry #define TMPL(p) (*(const uint8_t*)(p) & TMPL_MASK)
50 1.1 cherry #define _U32(p,i) ((uint64_t)(((const uint32_t*)(p))[i]))
51 1.1 cherry #define _SLOT(p,i) (_U32(p,i) | (_U32(p,(i)+1)<<32))
52 1.1 cherry #define SLOT(p,i) ((_SLOT(p,i) >> (TMPL_BITS+((i)<<3)+(i))) & SLOT_MASK)
53 1.1 cherry
54 1.1 cherry /*
55 1.1 cherry * Instruction specifics
56 1.1 cherry */
57 1.1 cherry #define _FLD64(i,o,l) ((i >> o) & ((1LL << l) - 1LL))
58 1.1 cherry #define FIELD(i,o,l) ((uint32_t)_FLD64(i,o,l))
59 1.1 cherry #define OPCODE(i) FIELD(i, 37, 4)
60 1.1 cherry #define QP_BITS 6
61 1.1 cherry #define QP(i) FIELD(i, 0, QP_BITS)
62 1.1 cherry #define REG_BITS 7
63 1.1 cherry #define REG(i,r) FIELD(i, ((r) - 1) * REG_BITS + QP_BITS, REG_BITS)
64 1.1 cherry
65 1.1 cherry /*
66 1.1 cherry * Opcodes used internally as sentinels to denote either a lack of more
67 1.1 cherry * specific information or to preserve the additional state/information
68 1.1 cherry * we already have and need to pass around for later use.
69 1.1 cherry */
70 1.1 cherry #define ASM_ADDITIONAL_OPCODES \
71 1.1 cherry ASM_OP_INTERNAL_OPCODES, \
72 1.1 cherry ASM_OP_BR_CALL, ASM_OP_BR_CEXIT, ASM_OP_BR_CLOOP, \
73 1.1 cherry ASM_OP_BR_COND, ASM_OP_BR_CTOP, ASM_OP_BR_IA, ASM_OP_BR_RET, \
74 1.1 cherry ASM_OP_BR_WEXIT, ASM_OP_BR_WTOP, \
75 1.1 cherry ASM_OP_BREAK_B, ASM_OP_BREAK_F, ASM_OP_BREAK_I, ASM_OP_BREAK_M, \
76 1.1 cherry ASM_OP_BREAK_X, \
77 1.1 cherry ASM_OP_BRL_COND, ASM_OP_BRL_CALL, \
78 1.1 cherry ASM_OP_BRP_, ASM_OP_BRP_RET, \
79 1.1 cherry ASM_OP_BSW_0, ASM_OP_BSW_1, \
80 1.1 cherry ASM_OP_CHK_A_CLR, ASM_OP_CHK_A_NC, ASM_OP_CHK_S, \
81 1.1 cherry ASM_OP_CHK_S_I, ASM_OP_CHK_S_M, \
82 1.1 cherry ASM_OP_CLRRRB_, ASM_OP_CLRRRB_PR, \
83 1.1 cherry ASM_OP_CMP_EQ, ASM_OP_CMP_EQ_AND, ASM_OP_CMP_EQ_OR, \
84 1.1 cherry ASM_OP_CMP_EQ_OR_ANDCM, ASM_OP_CMP_EQ_UNC, ASM_OP_CMP_GE_AND, \
85 1.1 cherry ASM_OP_CMP_GE_OR, ASM_OP_CMP_GE_OR_ANDCM, ASM_OP_CMP_GT_AND, \
86 1.1 cherry ASM_OP_CMP_GT_OR, ASM_OP_CMP_GT_OR_ANDCM, ASM_OP_CMP_LE_AND, \
87 1.1 cherry ASM_OP_CMP_LE_OR, ASM_OP_CMP_LE_OR_ANDCM, ASM_OP_CMP_LT, \
88 1.1 cherry ASM_OP_CMP_LT_AND, ASM_OP_CMP_LT_OR, ASM_OP_CMP_LT_OR_ANDCM, \
89 1.1 cherry ASM_OP_CMP_LT_UNC, ASM_OP_CMP_LTU, ASM_OP_CMP_LTU_UNC, \
90 1.1 cherry ASM_OP_CMP_NE_AND, ASM_OP_CMP_NE_OR, ASM_OP_CMP_NE_OR_ANDCM, \
91 1.1 cherry ASM_OP_CMP4_EQ, ASM_OP_CMP4_EQ_AND, ASM_OP_CMP4_EQ_OR, \
92 1.1 cherry ASM_OP_CMP4_EQ_OR_ANDCM, ASM_OP_CMP4_EQ_UNC, ASM_OP_CMP4_GE_AND,\
93 1.1 cherry ASM_OP_CMP4_GE_OR, ASM_OP_CMP4_GE_OR_ANDCM, ASM_OP_CMP4_GT_AND, \
94 1.1 cherry ASM_OP_CMP4_GT_OR, ASM_OP_CMP4_GT_OR_ANDCM, ASM_OP_CMP4_LE_AND, \
95 1.1 cherry ASM_OP_CMP4_LE_OR, ASM_OP_CMP4_LE_OR_ANDCM, ASM_OP_CMP4_LT, \
96 1.1 cherry ASM_OP_CMP4_LT_AND, ASM_OP_CMP4_LT_OR, ASM_OP_CMP4_LT_OR_ANDCM, \
97 1.1 cherry ASM_OP_CMP4_LT_UNC, ASM_OP_CMP4_LTU, ASM_OP_CMP4_LTU_UNC, \
98 1.1 cherry ASM_OP_CMP4_NE_AND, ASM_OP_CMP4_NE_OR, ASM_OP_CMP4_NE_OR_ANDCM, \
99 1.1 cherry ASM_OP_CMP8XCHG16_ACQ, ASM_OP_CMP8XCHG16_REL, \
100 1.1 cherry ASM_OP_CMPXCHG1_ACQ, ASM_OP_CMPXCHG1_REL, \
101 1.1 cherry ASM_OP_CMPXCHG2_ACQ, ASM_OP_CMPXCHG2_REL, \
102 1.1 cherry ASM_OP_CMPXCHG4_ACQ, ASM_OP_CMPXCHG4_REL, \
103 1.1 cherry ASM_OP_CMPXCHG8_ACQ, ASM_OP_CMPXCHG8_REL, \
104 1.1 cherry ASM_OP_CZX1_L, ASM_OP_CZX1_R, \
105 1.1 cherry ASM_OP_CZX2_L, ASM_OP_CZX2_R, \
106 1.1 cherry ASM_OP_DEP_, ASM_OP_DEP_Z, \
107 1.1 cherry ASM_OP_FC_, ASM_OP_FC_I, \
108 1.1 cherry ASM_OP_FCLASS_M, \
109 1.1 cherry ASM_OP_FCVT_FX, ASM_OP_FCVT_FX_TRUNC, ASM_OP_FCVT_FXU, \
110 1.1 cherry ASM_OP_FCVT_FXU_TRUNC, ASM_OP_FCVT_XF, \
111 1.1 cherry ASM_OP_FETCHADD4_ACQ, ASM_OP_FETCHADD4_REL, \
112 1.1 cherry ASM_OP_FETCHADD8_ACQ, ASM_OP_FETCHADD8_REL, \
113 1.1 cherry ASM_OP_FMA_, ASM_OP_FMA_D, ASM_OP_FMA_S, \
114 1.1 cherry ASM_OP_FMERGE_NS, ASM_OP_FMERGE_S, ASM_OP_FMERGE_SE, \
115 1.1 cherry ASM_OP_FMIX_L, ASM_OP_FMIX_LR, ASM_OP_FMIX_R, \
116 1.1 cherry ASM_OP_FMS_, ASM_OP_FMS_D, ASM_OP_FMS_S, \
117 1.1 cherry ASM_OP_FNMA_, ASM_OP_FNMA_D, ASM_OP_FNMA_S, \
118 1.1 cherry ASM_OP_FPCMP_EQ, ASM_OP_FPCMP_LE, ASM_OP_FPCMP_LT, \
119 1.1 cherry ASM_OP_FPCMP_NEQ, ASM_OP_FPCMP_NLE, ASM_OP_FPCMP_NLT, \
120 1.1 cherry ASM_OP_FPCMP_ORD, ASM_OP_FPCMP_UNORD, \
121 1.1 cherry ASM_OP_FPCVT_FX, ASM_OP_FPCVT_FX_TRUNC, ASM_OP_FPCVT_FXU, \
122 1.1 cherry ASM_OP_FPCVT_FXU_TRUNC, \
123 1.1 cherry ASM_OP_FPMERGE_NS, ASM_OP_FPMERGE_S, ASM_OP_FPMERGE_SE, \
124 1.1 cherry ASM_OP_FSWAP_, ASM_OP_FSWAP_NL, ASM_OP_FSWAP_NR, \
125 1.1 cherry ASM_OP_FSXT_L, ASM_OP_FSXT_R, \
126 1.1 cherry ASM_OP_GETF_D, ASM_OP_GETF_EXP, ASM_OP_GETF_S, ASM_OP_GETF_SIG, \
127 1.2 scole ASM_OP_HINT_B, ASM_OP_HINT_F, ASM_OP_HINT_I, ASM_OP_HINT_M, \
128 1.2 scole ASM_OP_HINT_X, \
129 1.1 cherry ASM_OP_INVALA_, ASM_OP_INVALA_E, \
130 1.1 cherry ASM_OP_ITC_D, ASM_OP_ITC_I, \
131 1.1 cherry ASM_OP_ITR_D, ASM_OP_ITR_I, \
132 1.1 cherry ASM_OP_LD1_, ASM_OP_LD1_A, ASM_OP_LD1_ACQ, ASM_OP_LD1_BIAS, \
133 1.1 cherry ASM_OP_LD1_C_CLR, ASM_OP_LD1_C_CLR_ACQ, ASM_OP_LD1_C_NC, \
134 1.1 cherry ASM_OP_LD1_S, ASM_OP_LD1_SA, \
135 1.1 cherry ASM_OP_LD16_, ASM_OP_LD16_ACQ, \
136 1.1 cherry ASM_OP_LD2_, ASM_OP_LD2_A, ASM_OP_LD2_ACQ, ASM_OP_LD2_BIAS, \
137 1.1 cherry ASM_OP_LD2_C_CLR, ASM_OP_LD2_C_CLR_ACQ, ASM_OP_LD2_C_NC, \
138 1.1 cherry ASM_OP_LD2_S, ASM_OP_LD2_SA, \
139 1.1 cherry ASM_OP_LD4_, ASM_OP_LD4_A, ASM_OP_LD4_ACQ, ASM_OP_LD4_BIAS, \
140 1.1 cherry ASM_OP_LD4_C_CLR, ASM_OP_LD4_C_CLR_ACQ, ASM_OP_LD4_C_NC, \
141 1.1 cherry ASM_OP_LD4_S, ASM_OP_LD4_SA, \
142 1.1 cherry ASM_OP_LD8_, ASM_OP_LD8_A, ASM_OP_LD8_ACQ, ASM_OP_LD8_BIAS, \
143 1.1 cherry ASM_OP_LD8_C_CLR, ASM_OP_LD8_C_CLR_ACQ, ASM_OP_LD8_C_NC, \
144 1.1 cherry ASM_OP_LD8_FILL, ASM_OP_LD8_S, ASM_OP_LD8_SA, \
145 1.1 cherry ASM_OP_LDF_FILL, \
146 1.1 cherry ASM_OP_LDF8_, ASM_OP_LDF8_A, ASM_OP_LDF8_C_CLR, \
147 1.1 cherry ASM_OP_LDF8_C_NC, ASM_OP_LDF8_S, ASM_OP_LDF8_SA, \
148 1.1 cherry ASM_OP_LDFD_, ASM_OP_LDFD_A, ASM_OP_LDFD_C_CLR, \
149 1.1 cherry ASM_OP_LDFD_C_NC, ASM_OP_LDFD_S, ASM_OP_LDFD_SA, \
150 1.1 cherry ASM_OP_LDFE_, ASM_OP_LDFE_A, ASM_OP_LDFE_C_CLR, \
151 1.1 cherry ASM_OP_LDFE_C_NC, ASM_OP_LDFE_S, ASM_OP_LDFE_SA, \
152 1.1 cherry ASM_OP_LDFP8_, ASM_OP_LDFP8_A, ASM_OP_LDFP8_C_CLR, \
153 1.1 cherry ASM_OP_LDFP8_C_NC, ASM_OP_LDFP8_S, ASM_OP_LDFP8_SA, \
154 1.1 cherry ASM_OP_LDFPD_, ASM_OP_LDFPD_A, ASM_OP_LDFPD_C_CLR, \
155 1.1 cherry ASM_OP_LDFPD_C_NC, ASM_OP_LDFPD_S, ASM_OP_LDFPD_SA, \
156 1.1 cherry ASM_OP_LDFPS_, ASM_OP_LDFPS_A, ASM_OP_LDFPS_C_CLR, \
157 1.1 cherry ASM_OP_LDFPS_C_NC, ASM_OP_LDFPS_S, ASM_OP_LDFPS_SA, \
158 1.1 cherry ASM_OP_LDFS_, ASM_OP_LDFS_A, ASM_OP_LDFS_C_CLR, \
159 1.1 cherry ASM_OP_LDFS_C_NC, ASM_OP_LDFS_S, ASM_OP_LDFS_SA, \
160 1.1 cherry ASM_OP_LFETCH_, ASM_OP_LFETCH_EXCL, ASM_OP_LFETCH_FAULT, \
161 1.1 cherry ASM_OP_LFETCH_FAULT_EXCL, \
162 1.1 cherry ASM_OP_MF_, ASM_OP_MF_A, \
163 1.1 cherry ASM_OP_MIX1_L, ASM_OP_MIX1_R, \
164 1.1 cherry ASM_OP_MIX2_L, ASM_OP_MIX2_R, \
165 1.1 cherry ASM_OP_MIX4_L, ASM_OP_MIX4_R, \
166 1.1 cherry ASM_OP_MOV_, ASM_OP_MOV_CPUID, ASM_OP_MOV_DBR, ASM_OP_MOV_I, \
167 1.1 cherry ASM_OP_MOV_IBR, ASM_OP_MOV_IP, ASM_OP_MOV_M, ASM_OP_MOV_MSR, \
168 1.1 cherry ASM_OP_MOV_PKR, ASM_OP_MOV_PMC, ASM_OP_MOV_PMD, ASM_OP_MOV_PR, \
169 1.1 cherry ASM_OP_MOV_PSR, ASM_OP_MOV_PSR_L, ASM_OP_MOV_PSR_UM, \
170 1.1 cherry ASM_OP_MOV_RET, ASM_OP_MOV_RR, \
171 1.1 cherry ASM_OP_NOP_B, ASM_OP_NOP_F, ASM_OP_NOP_I, ASM_OP_NOP_M, \
172 1.1 cherry ASM_OP_NOP_X, \
173 1.1 cherry ASM_OP_PACK2_SSS, ASM_OP_PACK2_USS, \
174 1.1 cherry ASM_OP_PACK4_SSS, \
175 1.1 cherry ASM_OP_PADD1_, ASM_OP_PADD1_SSS, ASM_OP_PADD1_UUS, \
176 1.1 cherry ASM_OP_PADD1_UUU, \
177 1.1 cherry ASM_OP_PADD2_, ASM_OP_PADD2_SSS, ASM_OP_PADD2_UUS, \
178 1.1 cherry ASM_OP_PADD2_UUU, \
179 1.1 cherry ASM_OP_PAVG1_, ASM_OP_PAVG1_RAZ, \
180 1.1 cherry ASM_OP_PAVG2_, ASM_OP_PAVG2_RAZ, \
181 1.1 cherry ASM_OP_PCMP1_EQ, ASM_OP_PCMP1_GT, \
182 1.1 cherry ASM_OP_PCMP2_EQ, ASM_OP_PCMP2_GT, \
183 1.1 cherry ASM_OP_PCMP4_EQ, ASM_OP_PCMP4_GT, \
184 1.1 cherry ASM_OP_PMAX1_U, \
185 1.1 cherry ASM_OP_PMIN1_U, \
186 1.1 cherry ASM_OP_PMPY2_L, ASM_OP_PMPY2_R, \
187 1.1 cherry ASM_OP_PMPYSHR2_, ASM_OP_PMPYSHR2_U, \
188 1.1 cherry ASM_OP_PROBE_R, ASM_OP_PROBE_R_FAULT, ASM_OP_PROBE_RW_FAULT, \
189 1.1 cherry ASM_OP_PROBE_W, ASM_OP_PROBE_W_FAULT, \
190 1.1 cherry ASM_OP_PSHR2_, ASM_OP_PSHR2_U, \
191 1.1 cherry ASM_OP_PSHR4_, ASM_OP_PSHR4_U, \
192 1.1 cherry ASM_OP_PSUB1_, ASM_OP_PSUB1_SSS, ASM_OP_PSUB1_UUS, \
193 1.1 cherry ASM_OP_PSUB1_UUU, \
194 1.1 cherry ASM_OP_PSUB2_, ASM_OP_PSUB2_SSS, ASM_OP_PSUB2_UUS, \
195 1.1 cherry ASM_OP_PSUB2_UUU, \
196 1.1 cherry ASM_OP_PTC_E, ASM_OP_PTC_G, ASM_OP_PTC_GA, ASM_OP_PTC_L, \
197 1.1 cherry ASM_OP_PTR_D, ASM_OP_PTR_I, \
198 1.1 cherry ASM_OP_SETF_EXP, ASM_OP_SETF_D, ASM_OP_SETF_S, ASM_OP_SETF_SIG, \
199 1.1 cherry ASM_OP_SHR_, ASM_OP_SHR_U, \
200 1.1 cherry ASM_OP_SRLZ_D, ASM_OP_SRLZ_I, \
201 1.1 cherry ASM_OP_ST1_, ASM_OP_ST1_REL, \
202 1.1 cherry ASM_OP_ST16_, ASM_OP_ST16_REL, \
203 1.1 cherry ASM_OP_ST2_, ASM_OP_ST2_REL, \
204 1.1 cherry ASM_OP_ST4_, ASM_OP_ST4_REL, \
205 1.1 cherry ASM_OP_ST8_, ASM_OP_ST8_REL, ASM_OP_ST8_SPILL, \
206 1.1 cherry ASM_OP_STF_SPILL, \
207 1.1 cherry ASM_OP_SYNC_I, \
208 1.1 cherry ASM_OP_TBIT_NZ_AND, ASM_OP_TBIT_NZ_OR, ASM_OP_TBIT_NZ_OR_ANDCM, \
209 1.1 cherry ASM_OP_TBIT_Z, ASM_OP_TBIT_Z_AND, ASM_OP_TBIT_Z_OR, \
210 1.1 cherry ASM_OP_TBIT_Z_OR_ANDCM, ASM_OP_TBIT_Z_UNC, \
211 1.2 scole ASM_OP_TF_NZ_AND, ASM_OP_TF_NZ_OR, ASM_OP_TF_NZ_OR_ANDCM, \
212 1.2 scole ASM_OP_TF_Z, ASM_OP_TF_Z_AND, ASM_OP_TF_Z_OR, \
213 1.2 scole ASM_OP_TF_Z_OR_ANDCM, ASM_OP_TF_Z_UNC, \
214 1.1 cherry ASM_OP_TNAT_NZ_AND, ASM_OP_TNAT_NZ_OR, ASM_OP_TNAT_NZ_OR_ANDCM, \
215 1.1 cherry ASM_OP_TNAT_Z, ASM_OP_TNAT_Z_AND, ASM_OP_TNAT_Z_OR, \
216 1.1 cherry ASM_OP_TNAT_Z_OR_ANDCM, ASM_OP_TNAT_Z_UNC, \
217 1.1 cherry ASM_OP_UNPACK1_H, ASM_OP_UNPACK1_L, \
218 1.1 cherry ASM_OP_UNPACK2_H, ASM_OP_UNPACK2_L, \
219 1.1 cherry ASM_OP_UNPACK4_H, ASM_OP_UNPACK4_L, \
220 1.2 scole ASM_OP_VMSW_0, ASM_OP_VMSW_1, \
221 1.1 cherry ASM_OP_XMA_H, ASM_OP_XMA_HU, ASM_OP_XMA_L, \
222 1.1 cherry ASM_OP_NUMBER_OF_OPCODES
223 1.1 cherry
224 1.1 cherry #endif /* _DISASM_INT_H_ */
225