Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / native_client / src / trusted / validator_ragel / instruction_definitions / general_purpose_instructions.def
1 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 ################################################################################
5 # This file describes instructions from AMD64 Architecture Programmer's Manual
6 #                               Volume 3: General-Purpose and System Instruction
7 #                               Chapter 3: General-Purpose Instruction Reference
8 ################################################################################
9 # File format: see def_format.py
10 ######## ADC ###################################################################
11 # "adc" is not marked as nacl-amd64-zero-extends since borrows/carries should
12 # not be need when calculating an address.
13 adc I a, 0x14
14 adc I E, 0x80 /2, lock
15 adc Ib Ev, 0x83 /2, lock
16 adc G E, 0x10, lock
17 adc E G, 0x12
18 ######## ADD ###################################################################
19 add I a, 0x04, nacl-amd64-zero-extends
20 add I E, 0x80 /0, lock nacl-amd64-zero-extends
21 add Ib Ev, 0x83 /0, lock nacl-amd64-zero-extends
22 add G E, 0x00, lock nacl-amd64-zero-extends
23 add E G, 0x02, nacl-amd64-zero-extends
24 ######## AND ###################################################################
25 and I a, 0x24, nacl-amd64-zero-extends
26 and I E, 0x80 /4, lock nacl-amd64-zero-extends
27 and Ib Ev, 0x83 /4, lock nacl-amd64-zero-extends
28 and G E, 0x20, lock nacl-amd64-zero-extends
29 and E G, 0x22, nacl-amd64-zero-extends
30 ######## ANDN ##################################################################
31 andn Ey By Gy, 0xc4 RXB.02 W.src1.0.00 0xf2, CPUFeature_BMI1
32 ######## BEXTR #################################################################
33 bextr By Ey Gy, 0xc4 RXB.02 W.cntl.0.00 0xf7, CPUFeature_BMI1
34 bextr Id Ey Gy, 0x8f RXB.0A W.1111.0.00 0x10, CPUFeature_BMI1
35 ######## BLCFILL ###############################################################
36 # "blcfill" is not marked as nacl-amd64-zero-extends out of caution.  We assume
37 # that this instruction is used for bit manipulation rather than computing
38 # viable addresses.
39 blcfill Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /1, CPUFeature_TBM
40 ######## BLCI ##################################################################
41 # "blci" is not marked as nacl-amd64-zero-extends out of caution.  We assume
42 # that this instruction is used for bit manipulation rather than computing
43 # viable addresses.
44 blci Ey By, 0x8f RXB.09 W.dest.0.00 0x02 /6, CPUFeature_TBM
45 ######## BLCIC #################################################################
46 # "blcic" is not marked as nacl-amd64-zero-extends out of caution.  We assume
47 # that this instruction is used for bit manipulation rather than computing
48 # viable addresses.
49 blcic Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /5, CPUFeature_TBM
50 ######## BLCMSK ################################################################
51 # "blcmsk" is not marked as nacl-amd64-zero-extends out of caution.  We assume
52 # that this instruction is used for bit manipulation rather than computing
53 # viable addresses.
54 blcmsk Ey By, 0x8f RXB.09 W.dest.0.00 0x02 /1, CPUFeature_TBM
55 ######## BLCS ##################################################################
56 # "blcs" is not marked as nacl-amd64-zero-extends out of caution.  We assume
57 # that this instruction is used for bit manipulation rather than computing
58 # viable addresses.
59 blcs Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /3, CPUFeature_TBM
60 ######## BLSFILL ###############################################################
61 # "blsfill" is not marked as nacl-amd64-zero-extends out of caution.  We assume
62 # that this instruction is used for bit manipulation rather than computing
63 # viable addresses.
64 blsfill Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /2, CPUFeature_TBM
65 ######## BLSI ##################################################################
66 # "blsi" is not marked as nacl-amd64-zero-extends out of caution.  We assume
67 # that this instruction is used for bit manipulation rather than computing
68 # viable addresses.
69 blsi Ey By, 0xc4 RXB.02 W.dest.0.00 0xf3 /3, CPUFeature_BMI1
70 ######## BLSIC #################################################################
71 # "blsic" is not marked as nacl-amd64-zero-extends out of caution.  We assume
72 # that this instruction is used for bit manipulation rather than computing
73 # viable addresses.
74 blsic Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /6, CPUFeature_TBM
75 ######## BLSMSK ################################################################
76 # "blsmsk" is not marked as nacl-amd64-zero-extends out of caution.  We assume
77 # that this instruction is used for bit manipulation rather than computing
78 # viable addresses.
79 blsmsk Ey By, 0xc4 RXB.02 W.dest.0.00 0xf3 /2, CPUFeature_BMI1
80 ######## BLSR ##################################################################
81 # "blsr" is not marked as nacl-amd64-zero-extends out of caution.  We assume
82 # that this instruction is used for bit manipulation rather than computing
83 # viable addresses.
84 blsr Ey By, 0xc4 RXB.02 W.dest.0.00 0xf3 /1, CPUFeature_BMI1
85 ######## BSF ###################################################################
86 # "bsf" is not marked as nacl-amd64-zero-extends because it does not always
87 # writes to it's second operand:
88 #  http://code.google.com/p/nativeclient/issues/detail?id=2010
89 bsf Ev Gv, 0x0f 0xbc
90 ######## BSR ###################################################################
91 # "bsr" is not marked as nacl-amd64-zero-extends because it does not always
92 # writes to it's second operand:
93 #  http://code.google.com/p/nativeclient/issues/detail?id=2010
94 bsr Ev Gv, 0x0f 0xbd
95 ######## BSWAP #################################################################
96 # "bswap" is not marked as nacl-amd64-zero-extends because we don't really think
97 # that swapping the bottom bytes is a good thing to do to mask a memory
98 # reference.
99 bswap ry, 0x0f 0xc8
100 ######## BT ####################################################################
101 #   bt <register>, <memory>
102 # is unsafe in 64-bit mode, because <register> could be
103 # 64-bit.
104 #   bt <immediate>, <whatever>
105 # only uses few least significant bits of <immediate>, so it's safe.
106 # Moreover, it's necessary to test higher bits of 64-bit operands
107 # (which can't be done with test instruction), so it's the only form that is
108 # allowed.
109 bt Gv =Ev, 0x0f 0xa3, nacl-forbidden
110 bt Ib =Ev, 0x0f 0xba /4, nacl-ia32-forbidden
111 ######## BTC ###################################################################
112 # "btc" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
113 # this instruction is used for bit manipulation rather than computing viable
114 # addresses.
115 # Also, see comment for bt.
116 btc Gv Ev, 0x0f 0xbb, lock nacl-forbidden
117 btc Ib Ev, 0x0f 0xba /7, lock nacl-ia32-forbidden
118 ######## BTR ###################################################################
119 # "btr" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
120 # this instruction is used for bit manipulation rather than computing viable
121 # addresses.
122 # Also, see comment for bt.
123 btr Gv Ev, 0x0f 0xb3, lock nacl-forbidden
124 btr Ib Ev, 0x0f 0xba /6, lock nacl-ia32-forbidden
125 ######## BTS ###################################################################
126 # "bts" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
127 # this instruction is used for bit manipulation rather than computing viable
128 # addresses.
129 # Also, see comment for bt.
130 bts Gv Ev, 0x0f 0xab, lock nacl-forbidden
131 bts Ib Ev, 0x0f 0xba /5, lock nacl-ia32-forbidden
132 ######## CALL (Near) ###########################################################
133 call Jw, data16 0xe8, att-show-name-suffix-w nacl-forbidden
134 call Jd, 0xe8, ia32
135 call Jd, 0xe8, amd64 att-show-name-suffix-q nacl-amd64-modifiable
136 call Jd, data16 rexw 0xe8, amd64 att-show-name-suffix-q nacl-forbidden
137 # "call" does not require rex prefix and always uses 64bit addresses in x86-64
138 # mode unless data16 prefix is used.  We use simple solution: 16bit call is
139 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
140 # separately.
141 call Ew, data16 0xff /2, norexw att-show-name-suffix-w nacl-forbidden
142 call Ed, 0xff /2, ia32 nacl-forbidden
143 call Eq, 0xff /2, amd64 att-show-name-suffix-q nacl-forbidden
144 call Eq, data16 rexw 0xff /2, amd64 att-show-name-suffix-q nacl-forbidden
145 ######## CALL (Far) ############################################################
146 # "lcall" does not require rex prefix and always uses 64bit addresses in x86-64
147 # mode unless data16 prefix is used.  We use simple solution: 16bit call is
148 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
149 # separately.
150 lcall Mp, data16 0xff /3, norexw att-show-name-suffix-w nacl-forbidden
151 lcall Mp, 0xff /3, ia32 nacl-forbidden
152 lcall Mp, 0xff /3, amd64 att-show-name-suffix-q nacl-forbidden
153 lcall Mp, data16 rexw 0xff /3, amd64 att-show-name-suffix-q nacl-forbidden
154 ######## CBW/CWDE/CDQE #########################################################
155 cwtl, 0x98, norexw
156 cbtw, data16 0x98, norexw
157 cltq, data16 rexw 0x98, amd64 nacl-forbidden
158 cltq, rexw 0x98, amd64
159 ######## CWD/CDQ/CQO ###########################################################
160 cltd, 0x99, norexw
161 cwtd, data16 0x99, norexw
162 cqto, data16 rexw 0x99, amd64 nacl-forbidden
163 cqto, rexw 0x99, amd64
164 ######## CLC ###################################################################
165 clc, 0xf8
166 ######## CLD ###################################################################
167 cld, 0xfc
168 ######## CLFLUSH ###############################################################
169 # clflush disabled because it is unused and may potentially be unsafe.
170 # see: https://code.google.com/p/nativeclient/issues/detail?id=3944
171 clflush Mb, 0x0f 0xae /7, CPUFeature_CLFLUSH nacl-forbidden
172 ######## CMC ###################################################################
173 cmc, 0xf5
174 ######## CMOVCC ################################################################
175 # "cmovcc" instructions are not marked as nacl-amd64-zero-extends out of caution.
176 # AMD/Intel manual state that these instrucitons always zero extends 32 bit
177 # register results to 64 bits, and that this occurs even if the condition is
178 # false. However, we decided to be safe and omit these instructions anyway.
179 cmova Ev Gv, 0x0f 0x47, CPUFeature_CMOV
180 cmovae Ev Gv, 0x0f 0x43, CPUFeature_CMOV
181 cmovbe Ev Gv, 0x0f 0x46, CPUFeature_CMOV
182 cmovb Ev Gv, 0x0f 0x42, CPUFeature_CMOV
183 cmove Ev Gv, 0x0f 0x44, CPUFeature_CMOV
184 cmovg Ev Gv, 0x0f 0x4f, CPUFeature_CMOV
185 cmovge Ev Gv, 0x0f 0x4d, CPUFeature_CMOV
186 cmovle Ev Gv, 0x0f 0x4e, CPUFeature_CMOV
187 cmovl Ev Gv, 0x0f 0x4c, CPUFeature_CMOV
188 cmovne Ev Gv, 0x0f 0x45, CPUFeature_CMOV
189 cmovno Ev Gv, 0x0f 0x41, CPUFeature_CMOV
190 cmovnp Ev Gv, 0x0f 0x4b, CPUFeature_CMOV
191 cmovns Ev Gv, 0x0f 0x49, CPUFeature_CMOV
192 cmovo Ev Gv, 0x0f 0x40, CPUFeature_CMOV
193 cmovp Ev Gv, 0x0f 0x4a, CPUFeature_CMOV
194 cmovs Ev Gv, 0x0f 0x48, CPUFeature_CMOV
195 ######## CMP ###################################################################
196 cmp I =a, 0x3c
197 cmp I =E, 0x80 /7
198 cmp Ib =Ev, 0x83 /7
199 cmp G =E, 0x38
200 cmp E =G, 0x3a
201 ######## CMPS/CMPSB/CMPSW/CMPSD/CMPSQ ##########################################
202 cmps Y X, 0xa6, condrep nacl-amd64-forbidden
203 ######## CMPXCHG ###############################################################
204 # Textbook definition of "cmpxchg" as per AMD/Intel manuals looks like this:
205 #  cmpxchg G E, 0x0f 0xb0, lock
206 # For consistency with the production validators:
207 #  * treat both explicit arguments as read-write
208 # Note1: "cmpxchg" indeed writes to two arguments, but these areguments are
209 #  implicit %al/%ax/%eax/%rax and second explicit argument.  First explicit
210 #  argument is read-only.
211 # "cmpxchg" is not marked as nacl-amd64-zero-extends because it conditionally
212 # writes to different destinations.
213 cmpxchg &Gb Eb, 0x0f 0xb0, lock
214 cmpxchg &Gw Ew, data16 0x0f 0xb1, norexw lock
215 cmpxchg &Gd Ed, 0x0f 0xb1, norexw lock
216 cmpxchg &Gq Eq, rexw 0x0f 0xb1, amd64 lock
217 cmpxchg &Gq Eq, data16 rexw 0x0f 0xb1, amd64 lock nacl-forbidden
218 ######## CMPXCHG8B/CMPXCHG16B ##################################################
219 cmpxchg8b Mq, 0x0f 0xc7 /1, norexw lock CPUFeature_CX8
220 cmpxchg16b Mo, rexw 0x0f 0xc7 /1, amd64 lock CPUFeature_CX16
221 ######## CPUID #################################################################
222 # "cpuid" is not marked as nacl-amd64-zero-extends just because it shouldn't be.
223 cpuid, 0x0f 0xa2
224 ######## CRC32 #################################################################
225 # In principle, this instruction can be defined as
226 #   crc32b E Gy, 0xf2 0x0f 0x38 0xf0, CPUFeature_SSE42
227 # but first, it's somewhat counterintuitive how splitting can produce the
228 # following five variations, so it's better to make it explicit, and second,
229 # rules to determine what suffix instruction name is followed with, special
230 # treatment would be required (for compatibility with objdump).
231 # Note: crc32 Ew Gd is disallowed for consistency with old validator, see
232 #  https://code.google.com/p/nativeclient/issues/detail?id=3356
233 crc32b Eb Gd, 0xf2 0x0f 0x38 0xf0, norexw CPUFeature_SSE42
234 crc32b Eb Gq, rexw 0xf2 0x0f 0x38 0xf0, amd64 CPUFeature_SSE42
235 crc32w Ew Gd, data16 0xf2 0x0f 0x38 0xf1, norexw CPUFeature_SSE42 nacl-forbidden
236 crc32l Ed Gd, 0xf2 0x0f 0x38 0xf1, norexw CPUFeature_SSE42
237 crc32q Eq Gq, rexw 0xf2 0x0f 0x38 0xf1, amd64 CPUFeature_SSE42
238 ######## DEC ###################################################################
239 dec E, 0xfe /1, lock nacl-amd64-zero-extends
240 dec rz, 0x48, ia32
241 ######## DIV ###################################################################
242 # "div" is not marked as nacl-amd64-zero-extends because we never allowed it.
243 div =E, 0xf6 /6
244 ######## ENTER #################################################################
245 # Enter is safe in amd64 mode, but it's safety relies on minute details of
246 # implementation which can be changed in the future thus we prefer to disable
247 # it.  It's uncoditionally safe in ia32 mode as per the textbook definition in
248 # AMD/Intel manual but it does complex manipulations and is very rarely used
249 # (GCC, in particular, never uses it).  As a rule we don't allow complex and
250 # rarely used instructions such as "aaa" or "bound".  Disable it for now.
251 enter Iw =ib, 0xc8, ia32 nacl-forbidden
252 enter Iw =ib, 0xc8, amd64 att-show-name-suffix-q nacl-forbidden
253 ######## IDIV ##################################################################
254 # "idiv" is not marked as nacl-amd64-zero-extends because we never allowed it.
255 idiv =E, 0xf6 /7
256 ######## IMUL ##################################################################
257 imul =E, 0xf6 /5
258 imul Ev Gv, 0x0f 0xaf, nacl-amd64-zero-extends
259 imul Ib Ev Gv, 0x6b, nacl-amd64-zero-extends
260 imul Iz Ev Gv, 0x69, nacl-amd64-zero-extends
261 ######## IN ####################################################################
262 # "in" is not marked as nacl-amd64-zero-extends just because it shouldn't be.
263 in Ib ab, 0xe4, nacl-forbidden
264 in Ib az, 0xe5, nacl-forbidden
265 in ob ab, 0xec, nacl-forbidden
266 in oz az, 0xed, nacl-forbidden
267 ######## INC ###################################################################
268 inc E, 0xfe /0, lock nacl-amd64-zero-extends
269 inc rz, 0x40, ia32
270 ######## INS/INSB/INSW/INSD ####################################################
271 ins ob Yb, 0x6c, rep att-show-name-suffix-b nacl-forbidden
272 ins ow Yw, data16 0x6d, rep att-show-name-suffix-w nacl-forbidden
273 ins od Yd, 0x6d, rep att-show-name-suffix-l nacl-forbidden
274 ins od Yd, rexw 0x6d, amd64 rep att-show-name-suffix-l nacl-forbidden
275 ins od Yd, data16 rexw 0x6d, amd64 rep att-show-name-suffix-l nacl-forbidden
276 ######## INT ###################################################################
277 int =Ib, 0xcd, nacl-forbidden
278 ######## JCXZ/JECXZ/JRCXZ ######################################################
279 jecxz Jb, 0xe3, ia32 branch_hint nacl-forbidden
280 jrcxz Jb, 0xe3, amd64 branch_hint
281 ######## Jcc ###################################################################
282 ja Jb, 0x77, branch_hint
283 ja Jw, data16 0x0f 0x87, branch_hint nacl-forbidden
284 ja Jd, 0x0f 0x87, branch_hint
285 jae Jb, 0x73, branch_hint
286 jae Jw, data16 0x0f 0x83, branch_hint nacl-forbidden
287 jae Jd, 0x0f 0x83, branch_hint
288 jb Jb, 0x72, branch_hint
289 jb Jw, data16 0x0f 0x82, branch_hint nacl-forbidden
290 jb Jd, 0x0f 0x82, branch_hint
291 jbe Jb, 0x76, branch_hint
292 jbe Jw, data16 0x0f 0x86, branch_hint nacl-forbidden
293 jbe Jd, 0x0f 0x86, branch_hint
294 je Jb, 0x74, branch_hint
295 je Jw, data16 0x0f 0x84, branch_hint nacl-forbidden
296 je Jd, 0x0f 0x84, branch_hint
297 jg Jb, 0x7f, branch_hint
298 jg Jw, data16 0x0f 0x8f, branch_hint nacl-forbidden
299 jg Jd, 0x0f 0x8f, branch_hint
300 jge Jb, 0x7d, branch_hint
301 jge Jw, data16 0x0f 0x8d, branch_hint nacl-forbidden
302 jge Jd, 0x0f 0x8d, branch_hint
303 jl Jb, 0x7c, branch_hint
304 jl Jw, data16 0x0f 0x8c, branch_hint nacl-forbidden
305 jl Jd, 0x0f 0x8c, branch_hint
306 jle Jb, 0x7e, branch_hint
307 jle Jw, data16 0x0f 0x8e, branch_hint nacl-forbidden
308 jle Jd, 0x0f 0x8e, branch_hint
309 jne Jb, 0x75, branch_hint
310 jne Jw, data16 0x0f 0x85, branch_hint nacl-forbidden
311 jne Jd, 0x0f 0x85, branch_hint
312 jno Jb, 0x71, branch_hint
313 jno Jw, data16 0x0f 0x81, branch_hint nacl-forbidden
314 jno Jd, 0x0f 0x81, branch_hint
315 jnp Jb, 0x7b, branch_hint
316 jnp Jw, data16 0x0f 0x8b, branch_hint nacl-forbidden
317 jnp Jd, 0x0f 0x8b, branch_hint
318 jns Jb, 0x79, branch_hint
319 jns Jw, data16 0x0f 0x89, branch_hint nacl-forbidden
320 jns Jd, 0x0f 0x89, branch_hint
321 jo Jb, 0x70, branch_hint
322 jo Jw, data16 0x0f 0x80, branch_hint nacl-forbidden
323 jo Jd, 0x0f 0x80, branch_hint
324 jp Jb, 0x7a, branch_hint
325 jp Jw, data16 0x0f 0x8a, branch_hint nacl-forbidden
326 jp Jd, 0x0f 0x8a, branch_hint
327 js Jb, 0x78, branch_hint
328 js Jw, data16 0x0f 0x88, branch_hint nacl-forbidden
329 js Jd, 0x0f 0x88, branch_hint
330 ######## JMP (Near) ############################################################
331 jmp Jb, 0xeb
332 jmp Jw, data16 0xe9, norexw att-show-name-suffix-w nacl-forbidden
333 jmp Jd, 0xe9, ia32
334 jmp Jd, 0xe9, amd64 att-show-name-suffix-q
335 jmp Jd, data16 rexw 0xe9, amd64 att-show-name-suffix-q nacl-forbidden
336 # "jmp" does not require rex prefix and always uses 64bit addresses in x86-64
337 # mode unless data16 prefix is used.  We use simple solution: 16bit jump is
338 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
339 # separately.
340 jmp Ew, data16 0xff /4, norexw att-show-name-suffix-w nacl-forbidden
341 jmp Ed, 0xff /4, ia32 nacl-forbidden
342 jmp Eq, 0xff /4, amd64 att-show-name-suffix-q nacl-forbidden
343 jmp Eq, data16 rexw 0xff /4, amd64 att-show-name-suffix-q nacl-forbidden
344 ######## JMP (Far) #############################################################
345 # "ljmp" does not require rex prefix and always uses 64bit addresses in x86-64
346 # mode unless data16 prefix is used.  We use simple solution: 16bit jump is
347 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
348 # separately.
349 ljmp Mp, data16 0xff /5, norexw att-show-name-suffix-w nacl-forbidden
350 ljmp Mp, 0xff /5, ia32 nacl-forbidden
351 ljmp Mp, 0xff /5, amd64 att-show-name-suffix-q nacl-forbidden
352 ljmp Mp, data16 rexw 0xff /5, amd64 att-show-name-suffix-q nacl-forbidden
353 ######## LAHF ##################################################################
354 # LAHF is always available in 16bit/32bit mode, but not always in 64bit mode
355 lahf, 0x9f, ia32
356 lahf, 0x9f, amd64 CPUFeature_LAHF
357 ######## LDS/LES/LFS/LGS/LSS (AMD version) #####################################
358 # AMD manual says "executing LFS, LGS, or LSS with a 64-bit operand size only
359 # loads a 32-bit general purpose register and the specified segment register".
360 # lds Mp Gz, 0xc5, ia32 nacl-forbidden
361 # les Mp Gz, 0xc4, ia32 nacl-forbidden
362 # lfs Mp Gz, 0x0f 0xb4, nacl-forbidden
363 # lgs Mp Gz, 0x0f 0xb5, nacl-forbidden
364 # lss Mp Gz, 0x0f 0xb2, nacl-forbidden
365 ######## LDS/LES/LFS/LGS/LSS (Intel version) ###################################
366 # Intel manual says: "Using a REX prefix in the form of REX.W promotes operation
367 # to specify a source operand referencing an 80-bit pointer (16-bit selector,
368 # 64-bit offset) in memory".
369 lds Mp Gv, 0xc5, ia32 nacl-forbidden
370 les Mp Gv, 0xc4, ia32 nacl-forbidden
371 # "lfs", "lgs", and "lss" are not marked as nacl-amd64-zero-extends because
372 # segment addresses shouldn't be used.
373 lfs Mp Gv, 0x0f 0xb4, nacl-forbidden
374 lgs Mp Gv, 0x0f 0xb5, nacl-forbidden
375 lss Mp Gv, 0x0f 0xb2, nacl-forbidden
376 ######## LEA ###################################################################
377 lea 'Mv !Gv, 0x8d, no_memory_access nacl-amd64-zero-extends
378 ######## LEAVE #################################################################
379 leave, 0xc9, ia32
380 leave, 0xc9, amd64 att-show-name-suffix-q nacl-forbidden
381 ######## LFENCE ################################################################
382 lfence, 0x0f 0xae 0xe8, CPUFeature_SSE2
383 ######## LLWPCB ################################################################
384 llwpcb =Ry, 0x8f RXB.09 W.1111.0.00 0x12 /0, CPUFeature_LWP
385 ######## LODS/LODSB/LODSW/LODSD/LODSQ ##########################################
386 # Textbook definition of "lods[bwdq]" as per AMD/Intel manuals looks like this:
387 #  lods X a, 0xac, rep nacl-amd64-forbidden
388 # For consistency with the production validators, drop support for the "lods" in
389 #  ia32 mode.
390 # Note that the former 32- and 64-bit validators treat "lods" inconsistently:
391 #  http://code.google.com/p/nativeclient/issues/detail?id=2975
392 # It's "special" instruction in amd64 mode (and is accepted with "special"
393 #  sandboxing), but forbidden instruction in ia32 mode.
394 lods X a, 0xac, rep nacl-forbidden
395 ######## LOOP/LOOPE/LOOPNE/LOOPNZ/LOOPZ ########################################
396 # Manual is quite vague WRT usability of branch prediction prefixes combined
397 # with "loop/loope/loopne" instructions. Old optimization manual (from P4) says
398 # about them the following: "These hints take the form of prefixes to any type
399 # of branch instruction.  Branch hints are not guaranteed to have any effect,
400 # and their function may vary across implementations. On the Pentium 4
401 # processor, branch hints are active only for relative conditional branches."
402 # And today's manual says:
403 #   - Branch hints:
404 #     * 2EH - Branch not taken (used only with Jcc instructions)
405 #     * 3EH - Branch taken (used only with Jcc instructions)
406 # Since they never had any effect on the code execution their usability is
407 # quite limited.  We disable them for now.
408 loop Jb, 0xe2, nacl-ia32-forbidden
409 loop Jb, 0xe2, branch_hint nacl-forbidden
410 loope Jb, 0xe1, nacl-ia32-forbidden
411 loope Jb, 0xe1, branch_hint nacl-forbidden
412 loopne Jb, 0xe0, nacl-ia32-forbidden
413 loopne Jb, 0xe0, branch_hint nacl-forbidden
414 ######## LWPINS ################################################################
415 lwpins Id Ed =By, 0x8f RXB.0A W.src1.0.00 0x12 /0, CPUFeature_LWP
416 ######## LWPVAL ################################################################
417 lwpval Id Ed =By, 0x8f RXB.0A W.src1.0.00 0x12 /1, CPUFeature_LWP
418 ######## LZCNT #################################################################
419 # Textbook definition of "lzcnt" as per AMD/Intel manuals looks like this:
420 #   lzcnt Ev Gv, 0xf3 0x0f 0xbd, CPUFeature_LZCNT nacl-amd64-zero-extends
421 # "lzcnt" is not marked as nacl-amd64-zero-extends because it is unlikely to be
422 # useful for computing an address based on the number of leading zeros of a
423 # value.
424 # Also, since f3 opcode extension is counted as rep prefix, it is not allowed
425 # together with data16 prefix.
426 # See http://code.google.com/p/nativeclient/issues/detail?id=3076
427 lzcnt Ew Gw, data16 0xf3 0x0f 0xbd, norexw CPUFeature_LZCNT nacl-forbidden
428 lzcnt Ed Gd, 0xf3 0x0f 0xbd, norexw CPUFeature_LZCNT
429 lzcnt Eq Gq, rexw 0xf3 0x0f 0xbd, amd64 CPUFeature_LZCNT
430 lzcnt Eq Gq, data16 rexw 0xf3 0x0f 0xbd, amd64 CPUFeature_LZCNT nacl-forbidden
431 ######## MFENCE ################################################################
432 mfence, 0x0f 0xae 0xf0, CPUFeature_SSE2
433 ######## MOV ###################################################################
434 mov G !E, 0x88, nacl-amd64-modifiable nacl-amd64-zero-extends
435 mov E !G, 0x8a, nacl-amd64-modifiable nacl-amd64-zero-extends
436 mov Sw !Mw, 0x8c, nacl-forbidden
437 mov Sw !Rv, 0x8c, nacl-forbidden
438 mov Ew !Sw, 0x8e, nacl-forbidden
439 mov Ib !rb, 0xb0, nacl-amd64-modifiable nacl-amd64-zero-extends
440 mov Iv !rv, 0xb8, nacl-amd64-modifiable nacl-amd64-zero-extends
441 mov I !E, 0xc6 /0, nacl-amd64-modifiable nacl-amd64-zero-extends
442 mov O !a, 0xa0, ia32
443 mov a !O, 0xa2, ia32
444 movabs O !a, 0xa0, amd64 nacl-forbidden
445 movabs a !O, 0xa2, amd64 nacl-forbidden
446 ######## MOVBE #################################################################
447 movbe Mv Gv, 0x0f 0x38 0xf0, CPUFeature_MOVBE
448 movbe Gv Mv, 0x0f 0x38 0xf1, CPUFeature_MOVBE
449 ######## MOVD ##################################################################
450 # Textbook definition of "movd" as per AMD/Intel manuals looks like this:
451 #  movd Ey Vy, 0x66 0x0f 0x6e, CPUFeature_SSE2
452 #  movd Vy Ey, 0x66 0x0f 0x7e, CPUFeature_SSE2
453 #  movd Ey Py, 0x0f 0x6e, CPUFeature_MMX
454 #  movd Py Ey, 0x0f 0x7e, CPUFeature_MMX
455 # Objdump names 64bit version not "movd" but movq".  We describe 32bit version
456 #  and 64bit version separately.
457 movd Ed Vq, 0x66 0x0f 0x6e, norexw CPUFeature_SSE2
458 movd Vq Ed, 0x66 0x0f 0x7e, norexw CPUFeature_SSE2 nacl-amd64-zero-extends
459 movd Ed Pq, 0x0f 0x6e, norexw CPUFeature_MMX
460 movd Pq Ed, 0x0f 0x7e, norexw CPUFeature_MMX nacl-amd64-zero-extends
461 movq Eq Vq, 0x66 rexw 0x0f 0x6e, amd64 CPUFeature_SSE2
462 movq Vq Eq, 0x66 rexw 0x0f 0x7e, amd64 CPUFeature_SSE2
463 movq Eq Pq, rexw 0x0f 0x6e, amd64 CPUFeature_MMX
464 movq Pq Eq, rexw 0x0f 0x7e, amd64 CPUFeature_MMX
465 ######## MOVMSKPD ##############################################################
466 # Textbook definition of "movmskpd" as per AMD/Intel manuals looks like this:
467 #  movmskpd Upd Gd, 0x66 0x0f 0x50, CPUFeature_SSE2
468 # GNU as accepts this description, but objdump decodes last operand as "Gy".
469 # Technically it makes no difference: "movmskpd" clears everything except least
470 # significant two bits and this operation produces precisely idential output for
471 # "Gy" and "Gd" operands.  We use objdump's description.
472 movmskpd Upd Gy, 0x66 0x0f 0x50, CPUFeature_SSE2
473 ######## MOVMSKPS ##############################################################
474 # Textbook definition of "movmskps" as per AMD/Intel manuals looks like this:
475 #  movmskps Ups Gd, 0x0f 0x50, CPUFeature_SSE2
476 # GNU as accepts this description, but objdump decodes last operand as "Gy".
477 # Technically it makes no difference: "movmskps" clears everything except least
478 # significant four bits and this operation produces precisely idential output
479 # for "Gy" and "Gd" operands.  We use objdump's description.
480 movmskps Ups Gy, 0x0f 0x50, CPUFeature_SSE
481 ######## MOVNTI ################################################################
482 movnti Gy My, 0x0f 0xc3, CPUFeature_SSE2
483 ######## MOVS/MOVSB/MOVSW/MOVSD/MOVSQ ##########################################
484 movs X Y, 0xa4, rep nacl-amd64-forbidden
485 ######## MOVSX #################################################################
486 # Textbook definition of "movsx" as per AMD/Intel manuals looks like this:
487 #  movsx Eb Gv, 0x0f 0xbe
488 #  movsx Ew Gy, 0x0f 0xbf
489 # Objdump has different names for this instrustion: "movsbw", "movsbl", "movsbq",
490 # "movswl", "movswq" depending on operand size.  We describe 32bit versions and
491 # 64bit version separately.
492 movsbl Eb Gd, 0x0f 0xbe, norexw nacl-amd64-zero-extends
493 movsbq Eb Gq, rexw 0x0f 0xbe, amd64
494 movsbw Eb Gw, data16 0x0f 0xbe, norexw
495 movswl Ew Gd, 0x0f 0xbf, norexw nacl-amd64-zero-extends
496 movswq Ew Gq, rexw 0x0f 0xbf, amd64
497 movsww Ew Gw, data16 0x0f 0xbf, norexw
498 ######## MOVSXD ################################################################
499 movslq Ed Gv, 0x63, amd64 nacl-amd64-zero-extends
500 ######## MOVZX #################################################################
501 # Textbook definition of "movzx" as per AMD/Intel manuals looks like this:
502 #  movzx Eb Gv, 0x0f 0xb6
503 #  movzx Ew Gy, 0x0f 0xb7
504 # Objdump has different names for this instrustion: "movzbw", "movzbl", "movzbq",
505 # "movzwl", "movzwq" depending on operand size.  We describe 32bit versions and
506 # 64bit version separately.
507 movzbl Eb Gd, 0x0f 0xb6, norexw nacl-amd64-zero-extends
508 movzbq Eb Gq, rexw 0x0f 0xb6, amd64
509 movzbw Eb Gw, data16 0x0f 0xb6, norexw
510 movzwl Ew Gd, 0x0f 0xb7, norexw nacl-amd64-zero-extends
511 movzwq Ew Gq, rexw 0x0f 0xb7, amd64
512 movzww Ew Gw, data16 0x0f 0xb7, norexw
513 ######## MUL ###################################################################
514 # "mul" is not marked as nacl-amd64-zero-extends because we never allowed it.
515 mul =E, 0xf6 /4
516 ######## NEG ###################################################################
517 neg E, 0xf6 /3, lock nacl-amd64-zero-extends
518 ######## NOP ###################################################################
519 nop, 0x90, norex
520 nop, 0x40 0x90, amd64 norex
521 "rex.W nop", 0x48 0x90, amd64 norex
522 # Textbook definition of "nop" as per AMD/Intel manuals looks like this:
523 #  nop 'Ev, 0x0f 0x1f /0, no_memory_access
524 # For consistency with the production validators, drop support for the 16-bit
525 #  version of "nop".
526 nop 'Rw, data16 0x0f 0x1f /0,
527   no_memory_access nacl-forbidden
528 nop 'Mw, data16 0x0f 0x1f /0,
529   no_memory_access att-show-name-suffix-w nacl-forbidden
530 nop 'Rd, 0x0f 0x1f /0,
531   norexw no_memory_access
532 nop 'Md, 0x0f 0x1f /0,
533   norexw att-show-name-suffix-l no_memory_access
534 nop 'Rq, rexw 0x0f 0x1f /0,
535   amd64 no_memory_access
536 nop 'Mq, rexw 0x0f 0x1f /0,
537   amd64 att-show-name-suffix-q no_memory_access
538 nop 'Rq, data16 rexw 0x0f 0x1f /0,
539   amd64 no_memory_access nacl-forbidden
540 nop 'Mq, data16 rexw 0x0f 0x1f /0,
541   amd64 no_memory_access att-show-name-suffix-q nacl-forbidden
542 ######## NOT ###################################################################
543 not E, 0xf6 /2, lock nacl-amd64-zero-extends
544 ######## OR ####################################################################
545 or I a, 0x0c, nacl-amd64-zero-extends
546 or I E, 0x80 /1, lock nacl-amd64-zero-extends
547 or Ib Ev, 0x83 /1, lock nacl-amd64-zero-extends
548 or G E, 0x08, lock nacl-amd64-zero-extends
549 or E G, 0x0a, nacl-amd64-zero-extends
550 ######## OUT ###################################################################
551 out ab =Ib, 0xe6, nacl-forbidden
552 out az =Ib, 0xe7, nacl-forbidden
553 out ab =ob, 0xee, nacl-forbidden
554 out az =oz, 0xef, nacl-forbidden
555 ######## OUTS/OUTSB/OUTSW/OUTSD ################################################
556 outs Xb =ob, 0x6e, rep att-show-name-suffix-b nacl-forbidden
557 outs Xw =ow, data16 0x6f, rep att-show-name-suffix-w nacl-forbidden
558 outs Xd =od, 0x6f, rep att-show-name-suffix-l nacl-forbidden
559 outs Xd =od, rexw 0x6f, amd64 rep att-show-name-suffix-l nacl-forbidden
560 outs Xd =od, data16 rexw 0x6f, amd64 rep att-show-name-suffix-l nacl-forbidden
561 ######## PAUSE #################################################################
562 pause, 0xf3 0x90, norex
563 ######## POP ###################################################################
564 # "pop" does not require rex prefix and always uses 64bit addresses in x86-64
565 # mode unless data16 prefix is used.  We use simple solution: 16bit call is
566 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
567 # separately.
568 pop Rw, data16 0x8f /0
569 pop Mw, data16 0x8f /0, att-show-name-suffix-w
570 pop Rr, 0x8f /0, ia32
571 pop Mr, 0x8f /0, ia32 att-show-name-suffix-l
572 pop Rr, 0x8f /0, amd64
573 pop Mr, 0x8f /0, amd64 att-show-name-suffix-q
574 pop rw, data16 0x58
575 pop rr, 0x58
576 "pop %es", 0x07, ia32 nacl-forbidden
577 "pop %ss", 0x17, ia32 nacl-forbidden
578 "pop %ds", 0x1f, ia32 nacl-forbidden
579 "pop %fs", 0x0f 0xa1, ia32 nacl-forbidden
580 "pop %gs", 0x0f 0xa9, ia32 nacl-forbidden
581 "popq %fs", 0x0f 0xa1, amd64 nacl-forbidden
582 "popq %gs", 0x0f 0xa9, amd64 nacl-forbidden
583 ######## POPCNT ################################################################
584 # Textbook definition of "popcnt" as per AMD/Intel manuals looks like this:
585 #   popcnt Ev Gv, 0xf3 0x0f 0xb8, CPUFeature_POPCNT nacl-amd64-zero-extends
586 # "popcnt" is not marked as nacl-amd64-zero-extends because it is unlikely to be
587 # useful for computing an address based on the number of ones in a value.
588 # Also, since f3 opcode extension is counted as rep prefix, it is not allowed
589 # together with data16 prefix.
590 # See http://code.google.com/p/nativeclient/issues/detail?id=3076
591 popcnt Ew Gw, data16 0xf3 0x0f 0xb8, norexw CPUFeature_POPCNT nacl-forbidden
592 popcnt Ed Gd, 0xf3 0x0f 0xb8, norexw CPUFeature_POPCNT
593 popcnt Eq Gq, rexw 0xf3 0x0f 0xb8, amd64 CPUFeature_POPCNT
594 popcnt Eq Gq, data16 rexw 0xf3 0x0f 0xb8, amd64 CPUFeature_POPCNT nacl-forbidden
595 ######## POPF/POPFD/POPFQ ######################################################
596 popf, data16 0x9d, norexw att-show-name-suffix-w nacl-forbidden
597 popf, 0x9d, ia32 nacl-forbidden
598 popf, 0x9d, norexw amd64 att-show-name-suffix-q nacl-forbidden
599 popf, data16 rexw 0x9d, amd64 att-show-name-suffix-q nacl-forbidden
600 ######## PREFETCH/PREFETCHW /PREFETCHWT1#########################################
601 prefetch Mb, 0x0f 0x0d /0, CPUFeature_3DPRFTCH no_memory_access
602 prefetchw Mb, 0x0f 0x0d /1, CPUFeature_3DPRFTCH no_memory_access
603 # Note: that prefetchwt1 will have its own cpuid bit with AVX512.
604 # TODO(shyamsundarr): Add a seperate cpu feature bit for prefetchwt1
605 # if we ever consider enabling it (to match new processor CPUID bit for AVX512).
606 prefetchwt1 Mb, 0x0f 0x0d /2, CPUFeature_3DPRFTCH no_memory_access nacl-forbidden
607 # AMD manual desribes this opcode as "reserved" in one place (and clarifies that
608 # it's aliased to prefetch for the compatibility) and as "invalid" in another
609 # place.  It's textbook definition as per AMD manual looks like this:
610 #  prefetch Mb, 0x0f 0x0d /3, CPUFeature_3DPRFTCH no_memory_access
611 # For consistency with the production validators, drop support for this form of
612 # "prefetch" in ia32 mode but support in in amd64 mode.
613 # Note that the former 32- and 64-bit validators treat "prefetch" inconsistently:
614 #  http://code.google.com/p/nativeclient/issues/detail?id=2977
615 prefetch Mb, 0x0f 0x0d /3, CPUFeature_3DPRFTCH no_memory_access nacl-ia32-forbidden
616 prefetch Mb, 0x0f 0x0d /4, CPUFeature_3DPRFTCH no_memory_access nacl-forbidden
617 prefetch Mb, 0x0f 0x0d /5, CPUFeature_3DPRFTCH no_memory_access nacl-forbidden
618 prefetch Mb, 0x0f 0x0d /6, CPUFeature_3DPRFTCH no_memory_access nacl-forbidden
619 prefetch Mb, 0x0f 0x0d /7, CPUFeature_3DPRFTCH no_memory_access nacl-forbidden
620 ######## PREFETCHlevel #########################################################
621 prefetchnta Mb, 0x0f 0x18 /0, CPUFeature_SSE no_memory_access
622 prefetcht0 Mb, 0x0f 0x18 /1, CPUFeature_SSE no_memory_access
623 prefetcht1 Mb, 0x0f 0x18 /2, CPUFeature_SSE no_memory_access
624 prefetcht2 Mb, 0x0f 0x18 /3, CPUFeature_SSE no_memory_access
625 # AMD manual claims this opcode is "nop".  Intel manual says it's "reserved".
626 # Real silicon accepts it and seemingly doing nothing.
627 "nop/reserved" Mb, 0x0f 0x18 /4, CPUFeature_SSE no_memory_access nacl-forbidden
628 "nop/reserved" Mb, 0x0f 0x18 /5, CPUFeature_SSE no_memory_access nacl-forbidden
629 "nop/reserved" Mb, 0x0f 0x18 /6, CPUFeature_SSE no_memory_access nacl-forbidden
630 "nop/reserved" Mb, 0x0f 0x18 /7, CPUFeature_SSE no_memory_access nacl-forbidden
631 ######## PUSH ##################################################################
632 # "push" does not require rex prefix and always uses 64bit addresses in x86-64
633 # mode unless data16 prefix is used.  We use simple solution: 16bit call is
634 # declared as common for 32bit/64bit mode and 32bit/64bit versions are described
635 # separately.
636 push =Rw, data16 0xff /6
637 push =Mw, data16 0xff /6, att-show-name-suffix-w
638 push =Rr, 0xff /6, ia32
639 push =Mr, 0xff /6, ia32 att-show-name-suffix-l
640 push =Rr, 0xff /6, amd64
641 push =Mr, 0xff /6, amd64 att-show-name-suffix-q
642 push =rw, data16 0x50
643 push =rr, 0x50
644 push =Iw, data16 0x68, att-show-name-suffix-w
645 push =Id, 0x68, ia32
646 push =Id, 0x68, amd64 att-show-name-suffix-q
647 push =Id, data16 rexw 0x68, amd64 att-show-name-suffix-q nacl-forbidden
648 push =Ib, 0x6a, ia32
649 push =Ib, 0x6a, amd64 att-show-name-suffix-q
650 "push %es", 0x06, ia32 nacl-forbidden
651 "push %cs", 0x0e, ia32 nacl-forbidden
652 "push %ss", 0x16, ia32 nacl-forbidden
653 "push %ds", 0x1e, ia32 nacl-forbidden
654 "push %fs", 0x0f 0xa0, ia32 nacl-forbidden
655 "push %gs", 0x0f 0xa8, ia32 nacl-forbidden
656 "pushq %fs", 0x0f 0xa0, amd64 nacl-forbidden
657 "pushq %gs", 0x0f 0xa8, amd64 nacl-forbidden
658 ######## PUSHF/PUSHFD/PUSHFQ ###################################################
659 pushf, data16 0x9c, norexw att-show-name-suffix-w nacl-forbidden
660 pushf, 0x9c, ia32 nacl-forbidden
661 pushf, 0x9c, norexw amd64 att-show-name-suffix-q nacl-forbidden
662 pushf, data16 rexw 0x9c, amd64 att-show-name-suffix-q nacl-forbidden
663 ######## RCL ###################################################################
664 # "rcl" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
665 # this instruction is used for bit manipulation rather than computing viable
666 # addresses.
667 rcl E, 0xd0 /2
668 rcl cb E, 0xd2 /2
669 rcl Ib E, 0xc0 /2
670 ######## RCR ###################################################################
671 # "rcr" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
672 # this instruction is used for bit manipulation rather than computing viable
673 # addresses.
674 rcr E, 0xd0 /3
675 rcr cb E, 0xd2 /3
676 rcr Ib E, 0xc0 /3
677 ######## RET (Near) ############################################################
678 ret, 0xc3, rep ia32 nacl-forbidden
679 ret, 0xc3, rep amd64 att-show-name-suffix-q nacl-forbidden
680 ret =Iw, 0xc2, ia32 nacl-forbidden
681 ret =Iw, 0xc2, amd64 att-show-name-suffix-q nacl-forbidden
682 ######## RET (Far) #############################################################
683 lret, 0xcb, norexw nacl-forbidden
684 lret =Iw, 0xca, norexw nacl-forbidden
685 lretq, rexw 0xcb, amd64 nacl-forbidden
686 lretq =Iw, rexw 0xca, amd64 nacl-forbidden
687 ######## ROL ###################################################################
688 # "rol" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
689 # this instruction is used for bit manipulation rather than computing viable
690 # addresses.
691 rol E, 0xd0 /0
692 rol cb E, 0xd2 /0
693 rol Ib E, 0xc0 /0
694 ######## ROR ###################################################################
695 # "ror" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
696 # this instruction is used for bit manipulation rather than computing viable
697 # addresses.
698 ror Ib E, 0xc0 /1
699 ror E, 0xd0 /1
700 ror cb E, 0xd2 /1
701 ######## SAHF ##################################################################
702 # SAHF is always awailable in 16bit/32bit mode, but not always in 64bit mode
703 sahf, 0x9e, ia32
704 sahf, 0x9e, amd64 CPUFeature_LAHF
705 ######## SAL ###################################################################
706 # AMD manual claims this opcode works identically to shl.  Intel manual
707 # says it's reserved.  Objdump does not like it.
708 # sal E, 0xd0 /6
709 # sal cb E, 0xd2 /6
710 # sal Ib E, 0xc0 /6
711 ######## SAL/SHL ###############################################################
712 # "sal"/"shl" is not marked as nacl-amd64-zero-extends out of caution.  We
713 # assume that this instruction is used for bit manipulation rather than
714 # computing viable addresses.
715 shl E, 0xd0 /4
716 shl cb E, 0xd2 /4
717 shl Ib E, 0xc0 /4
718 ######## SAR ###################################################################
719 # "sar" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
720 # this instruction is used for bit manipulation rather than computing viable
721 # addresses.
722 sar Ib E, 0xc0 /7
723 sar E, 0xd0 /7
724 sar cb E, 0xd2 /7
725 ######## SBB ###################################################################
726 # "sbb" is not marked as nacl-amd64-zero-extends since borrows/carries should
727 # not be need when calculating an address.
728 sbb I a, 0x1c
729 sbb I E, 0x80 /3, lock
730 sbb Ib Ev, 0x83 /3, lock
731 sbb G E, 0x18, lock
732 sbb E G, 0x1a
733 ######## SCAS/SCASB/SCASW/SCASD/SCASQ ##########################################
734 scas Y a, 0xae, condrep nacl-amd64-forbidden
735 ######## SETcc #################################################################
736 seta Eb, 0x0f 0x97, CPUFeature_CMOV
737 setae Eb, 0x0f 0x93, CPUFeature_CMOV
738 setbe Eb, 0x0f 0x96, CPUFeature_CMOV
739 setb Eb, 0x0f 0x92, CPUFeature_CMOV
740 sete Eb, 0x0f 0x94, CPUFeature_CMOV
741 setg Eb, 0x0f 0x9f, CPUFeature_CMOV
742 setge Eb, 0x0f 0x9d, CPUFeature_CMOV
743 setle Eb, 0x0f 0x9e, CPUFeature_CMOV
744 setl Eb, 0x0f 0x9c, CPUFeature_CMOV
745 setne Eb, 0x0f 0x95, CPUFeature_CMOV
746 setno Eb, 0x0f 0x91, CPUFeature_CMOV
747 setnp Eb, 0x0f 0x9b, CPUFeature_CMOV
748 setns Eb, 0x0f 0x99, CPUFeature_CMOV
749 seto Eb, 0x0f 0x90, CPUFeature_CMOV
750 setp Eb, 0x0f 0x9a, CPUFeature_CMOV
751 sets Eb, 0x0f 0x98, CPUFeature_CMOV
752 ######## SFENCE ################################################################
753 sfence, 0x0f 0xae 0xf8, CPUFeature_EMMXSSE
754 ######## SHLD ##################################################################
755 # "shld" is not marked as nacl-amd64-zero-extends out of caution.  We assume
756 # that this instruction is used for bit manipulation rather than computing
757 # viable addresses.
758 shld Ib Gv Ev, 0x0f 0xa4
759 shld cb Gv Ev, 0x0f 0xa5
760 ######## SHR ###################################################################
761 # "shr" is not marked as nacl-amd64-zero-extends out of caution.  We assume that
762 # this instruction is used for bit manipulation rather than computing viable
763 # addresses.
764 shr E, 0xd0 /5
765 shr cb E, 0xd2 /5
766 shr Ib E, 0xc0 /5
767 ######## SHRD ##################################################################
768 # "shrd" is not marked as nacl-amd64-zero-extends out of caution.  We assume
769 # that this instruction is used for bit manipulation rather than computing
770 # viable addresses.
771 shrd Ib Gv Ev, 0x0f 0xac
772 shrd cb Gv Ev, 0x0f 0xad
773 ######## SLWPCB ################################################################
774 slwpcb Ry, 0x8f RXB.09 W.1111.0.00 0x12 /1, CPUFeature_LWP
775 ######## STC ###################################################################
776 stc, 0xf9
777 ######## STD ###################################################################
778 std, 0xfd
779 ######## STOS/STOSB/STOSW/STOSD/STOSQ ##########################################
780 stos a Y, 0xaa, rep nacl-amd64-forbidden
781 ######## SUB ###################################################################
782 sub I a, 0x2c, nacl-amd64-zero-extends
783 sub I E, 0x80 /5, lock nacl-amd64-zero-extends
784 sub Ib Ev, 0x83 /5, lock nacl-amd64-zero-extends
785 sub G E, 0x28, lock nacl-amd64-zero-extends
786 sub E G, 0x2a, nacl-amd64-zero-extends
787 ######## T1MSKC ################################################################
788 t1mskc Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /7, CPUFeature_TBM
789 ######## TEST ##################################################################
790 test I =a, 0xa8
791 test I =E, 0xf6 /0
792 # AMD manual claims this opcode works identically to "/0".  Intel manual
793 # says it's reserved.  Objdump does not like it.
794 # test I =E, 0xf6 /1
795 test G =E, 0x84
796 ######## TZCNT #################################################################
797 # Textbook definition of "tzcnt" as per AMD/Intel manuals looks like this:
798 #   tzcnt Ev Gv, 0xf3 0x0f 0xbc, CPUFeature_TZCNT nacl-amd64-zero-extends
799 # "tzcnt" is not marked as nacl-amd64-zero-extends because it is unlikely to be
800 # useful for computing an address based on the number of trailing zeros of a
801 # value.
802 # We mark tzcnt specially to allow it independently from CPUID
803 # See http://code.google.com/p/nativeclient/issues/detail?id=2869
804 # Also, since f3 opcode extension is counted as rep prefix, it is not allowed
805 # together with data16 prefix.
806 # See http://code.google.com/p/nativeclient/issues/detail?id=3076
807 tzcnt Ew Gw, data16 0xf3 0x0f 0xbc, norexw CPUFeature_TZCNT nacl-forbidden
808 tzcnt Ed Gd, 0xf3 0x0f 0xbc, norexw CPUFeature_TZCNT
809 tzcnt Eq Gq, rexw 0xf3 0x0f 0xbc, amd64 CPUFeature_TZCNT
810 tzcnt Eq Gq, data16 rexw 0xf3 0x0f 0xbc, amd64 CPUFeature_TZCNT nacl-forbidden
811 ######## TZMSK #################################################################
812 tzmsk Ey By, 0x8f RXB.09 W.dest.0.00 0x01 /4, CPUFeature_TBM
813 ######## XADD ##################################################################
814 # Textbook definition of "xadd" as per AMD/Intel manuals looks like this:
815 #  xadd &G E, 0x0f 0xc0, lock nacl-amd64-zero-extends
816 # Don't consider xadd with memory zero-extending.
817 #  See http://code.google.com/p/nativeclient/issues/detail?id=3077
818 xadd &Gb Eb, 0x0f 0xc0, lock
819 xadd &Gw Ew, data16 0x0f 0xc1, norexw lock
820 xadd &Gd Rd, 0x0f 0xc1, norexw nacl-amd64-zero-extends
821 xadd &Gd Md, 0x0f 0xc1, norexw lock
822 xadd &Gq Eq, rexw 0x0f 0xc1, lock amd64
823 xadd &Gq Eq, data16 rexw 0x0f 0xc1, lock amd64 nacl-forbidden
824 ######## XCHG ##################################################################
825 # For consistency with prod. validator, don't consider exchange with memory
826 # zero-extending.
827 # See http://code.google.com/p/nativeclient/issues/detail?id=3071
828 xchg &av rv, 0x90, nacl-amd64-zero-extends
829 xchg &G R, 0x86, nacl-amd64-zero-extends
830 xchg &G M, 0x86, lock
831 ######## XLAT ##################################################################
832 xlat xb, 0xd7, nacl-forbidden
833 ######## XOR ###################################################################
834 xor I a, 0x34, nacl-amd64-zero-extends
835 xor I E, 0x80 /6, lock nacl-amd64-zero-extends
836 xor Ib Ev, 0x83 /6, lock nacl-amd64-zero-extends
837 xor G E, 0x30, lock nacl-amd64-zero-extends
838 xor E G, 0x32, nacl-amd64-zero-extends
839 ################################################################################