Debian Codegraph @

internal/opcodesxml/opcodesxml.go

raw symbols SCIP
1 // Package opcodesxml is a reader for the Opcodes XML database.
2 package opcodesxml
3
4 import (
5 "encoding/xml"
6 "io"
7 "os"
8 )
9
10 // Read reads Opcodes XML format.
11 func Read(r io.Reader) (*InstructionSet, error) {
12 d := xml.NewDecoder(r)
13 is := &InstructionSet{}
14 if err := d.Decode(is); err != nil {
15 return nil, err
16 }
17 return is, nil
18 }
19
20 // ReadFile reads the given Opcodes XML file.
21 func ReadFile(filename string) (*InstructionSet, error) {
22 f, err := os.Open(filename)
23 if err != nil {
24 return nil, err
25 }
26 defer f.Close()
27
28 return Read(f)
29 }
30
31 // InstructionSet is entire x86-64 instruction set.
32 type InstructionSet struct {
33 Name string `xml:"name,attr"`
34 Instructions []Instruction `xml:"Instruction"`
35 }
36
37 // Instruction represents one x86 mnemonic and its forms.
38 //
39 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L7-L14
40 //
41 // """Instruction is defined by its mnemonic name (in Intel-style assembly).
42 //
43 // An instruction may have multiple forms, that mainly differ by operand types.
44 //
45 // :ivar name: instruction name in Intel-style assembly (PeachPy, NASM and YASM assemblers).
46 // :ivar summary: a summary description of the instruction name.
47 // :ivar forms: a list of :class:`InstructionForm` objects representing the instruction forms.
48 // """
49 type Instruction struct {
50 Name string `xml:"name,attr"`
51 Summary string `xml:"summary,attr"`
52 Forms []Form `xml:"InstructionForm"`
53 }
54
55 // Form represents one possible collection of operands an instruction may take.
56 //
57 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L29-L85
58 //
59 // """Instruction form is a combination of mnemonic name and operand types.
60 //
61 // An instruction form may have multiple possible encodings.
62 //
63 // :ivar name: instruction name in PeachPy, NASM and YASM assemblers.
64 // :ivar gas_name: instruction form name in GNU assembler (gas).
65 // :ivar go_name: instruction form name in Go/Plan 9 assembler (8a).
66 //
67 // None means instruction is not supported in Go/Plan 9 assembler.
68 //
69 // :ivar mmx_mode: MMX technology state required or forced by this instruction. Possible values are:
70 //
71 // "FPU"
72 // Instruction requires the MMX technology state to be clear.
73 //
74 // "MMX"
75 // Instruction causes transition to MMX technology state.
76 //
77 // None
78 // Instruction neither affects nor cares about the MMX technology state.
79 //
80 // :ivar xmm_mode: XMM registers state accessed by this instruction. Possible values are:
81 //
82 // "SSE"
83 // Instruction accesses XMM registers in legacy SSE mode.
84 //
85 // "AVX"
86 // Instruction accesses XMM registers in AVX mode.
87 //
88 // None
89 // Instruction does not affect XMM registers and does not change XMM registers access mode.
90 //
91 // :ivar cancelling_inputs: indicates that the instruction form has not dependency on the values of input operands
92 // when they refer to the same register. E.g. **VPXOR xmm1, xmm0, xmm0** does not depend on *xmm0*.
93 //
94 // Instruction forms with cancelling inputs have only two input operands, which have the same register type.
95 //
96 // :ivar nacl_version: indicates the earliest Pepper API version where validator supports this instruction.
97 //
98 // Possible values are integers >= 33 or None. Pepper 33 is the earliest version for which information on
99 // supported instructions is available; if instruction forms supported before Pepper 33 would have
100 // nacl_version == 33. None means instruction is either not yet supported by Native Client validator, or
101 // is forbidden in Native Client SFI model.
102 //
103 // :ivar nacl_zero_extends_outputs: indicates that Native Client validator recognizes that the instruction zeroes
104 // the upper 32 bits of the output registers.
105 //
106 // In x86-64 Native Client SFI model this means that the subsequent instruction can use registers written by
107 // this instruction for memory addressing.
108 //
109 // :ivar operands: a list of :class:`Operand` objects representing the instruction operands.
110 // :ivar implicit_inputs: a set of register names that are implicitly read by this instruction.
111 // :ivar implicit_outputs: a set of register names that are implicitly written by this instruction.
112 // :ivar isa_extensions: a list of :class:`ISAExtension` objects that represent the ISA extensions required to execute
113 // the instruction.
114 // :ivar encodings: a list of :class:`Encoding` objects representing the possible encodings for this instruction.
115 // """
116 type Form struct {
117 GASName string `xml:"gas-name,attr"`
118 GoName string `xml:"go-name,attr"`
119 MMXMode string `xml:"mmx-mode,attr"`
120 XMMMode string `xml:"xmm-mode,attr"`
121 CancellingInputs bool `xml:"cancelling-inputs,attr"`
122 Operands []Operand `xml:"Operand"`
123 ImplicitOperands []ImplicitOperand `xml:"ImplicitOperand"`
124 ISA []ISA `xml:"ISA"`
125 Encoding Encoding `xml:"Encoding"`
126 }
127
128 // Operand describes an accepted operand type and the read/write action the instruction will perform.
129 //
130 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L114-L338
131 //
132 // """An explicit instruction operand.
133 //
134 // :ivar type: the type of the instruction operand. Possible values are:
135 //
136 // "1"
137 // The constant value `1`.
138 //
139 // "3"
140 // The constant value `3`.
141 //
142 // "al"
143 // The al register.
144 //
145 // "ax"
146 // The ax register.
147 //
148 // "eax"
149 // The eax register.
150 //
151 // "rax"
152 // The rax register.
153 //
154 // "cl"
155 // The cl register.
156 //
157 // "xmm0"
158 // The xmm0 register.
159 //
160 // "rel8"
161 // An 8-bit signed offset relative to the address of instruction end.
162 //
163 // "rel32"
164 // A 32-bit signed offset relative to the address of instruction end.
165 //
166 // "imm4"
167 // A 4-bit immediate value.
168 //
169 // "imm8"
170 // An 8-bit immediate value.
171 //
172 // "imm16"
173 // A 16-bit immediate value.
174 //
175 // "imm32"
176 // A 32-bit immediate value.
177 //
178 // "imm64"
179 // A 64-bit immediate value.
180 //
181 // "r8"
182 // An 8-bit general-purpose register (al, bl, cl, dl, sil, dil, bpl, spl, r8b-r15b).
183 //
184 // "r16"
185 // A 16-bit general-purpose register (ax, bx, cx, dx, si, di, bp, sp, r8w-r15w).
186 //
187 // "r32"
188 // A 32-bit general-purpose register (eax, ebx, ecx, edx, esi, edi, ebp, esp, r8d-r15d).
189 //
190 // "r64"
191 // A 64-bit general-purpose register (rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8-r15).
192 //
193 // "mm"
194 // A 64-bit MMX SIMD register (mm0-mm7).
195 //
196 // "xmm"
197 // A 128-bit XMM SIMD register (xmm0-xmm31).
198 //
199 // "xmm{k}"
200 // A 128-bit XMM SIMD register (xmm0-xmm31), optionally merge-masked by an AVX-512 mask register (k1-k7).
201 //
202 // "xmm{k}{z}"
203 // A 128-bit XMM SIMD register (xmm0-xmm31), optionally masked by an AVX-512 mask register (k1-k7).
204 //
205 // "ymm"
206 // A 256-bit YMM SIMD register (ymm0-ymm31).
207 //
208 // "ymm{k}"
209 // A 256-bit YMM SIMD register (ymm0-ymm31), optionally merge-masked by an AVX-512 mask register (k1-k7).
210 //
211 // "ymm{k}{z}"
212 // A 256-bit YMM SIMD register (ymm0-ymm31), optionally masked by an AVX-512 mask register (k1-k7).
213 //
214 // "zmm"
215 // A 512-bit ZMM SIMD register (zmm0-zmm31).
216 //
217 // "zmm{k}"
218 // A 512-bit ZMM SIMD register (zmm0-zmm31), optionally merge-masked by an AVX-512 mask register (k1-k7).
219 //
220 // "zmm{k}{z}"
221 // A 512-bit ZMM SIMD register (zmm0-zmm31), optionally masked by an AVX-512 mask register (k1-k7).
222 //
223 // "k"
224 // An AVX-512 mask register (k0-k7).
225 //
226 // "k{k}"
227 // An AVX-512 mask register (k0-k7), optionally merge-masked by an AVX-512 mask register (k1-k7).
228 //
229 // "m"
230 // A memory operand of any size.
231 //
232 // "m8"
233 // An 8-bit memory operand.
234 //
235 // "m16"
236 // A 16-bit memory operand.
237 //
238 // "m16{k}{z}"
239 // A 16-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
240 //
241 // "m32"
242 // A 32-bit memory operand.
243 //
244 // "m32{k}"
245 // A 32-bit memory operand, optionally merge-masked by an AVX-512 mask register (k1-k7).
246 //
247 // "m32{k}{z}"
248 // A 32-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
249 //
250 // "m64"
251 // A 64-bit memory operand.
252 //
253 // "m64{k}"
254 // A 64-bit memory operand, optionally merge-masked by an AVX-512 mask register (k1-k7).
255 //
256 // "m64{k}{z}"
257 // A 64-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
258 //
259 // "m80"
260 // An 80-bit memory operand.
261 //
262 // "m128"
263 // A 128-bit memory operand.
264 //
265 // "m128{k}{z}"
266 // A 128-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
267 //
268 // "m256"
269 // A 256-bit memory operand.
270 //
271 // "m256{k}{z}"
272 // A 256-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
273 //
274 // "m512"
275 // A 512-bit memory operand.
276 //
277 // "m512{k}{z}"
278 // A 512-bit memory operand, optionally masked by an AVX-512 mask register (k1-k7).
279 //
280 // "m64/m32bcst"
281 // A 64-bit memory operand or a 32-bit memory operand broadcasted to 64 bits {1to2}.
282 //
283 // "m128/m32bcst"
284 // A 128-bit memory operand or a 32-bit memory operand broadcasted to 128 bits {1to4}.
285 //
286 // "m256/m32bcst"
287 // A 256-bit memory operand or a 32-bit memory operand broadcasted to 256 bits {1to8}.
288 //
289 // "m512/m32bcst"
290 // A 512-bit memory operand or a 32-bit memory operand broadcasted to 512 bits {1to16}.
291 //
292 // "m128/m64bcst"
293 // A 128-bit memory operand or a 64-bit memory operand broadcasted to 128 bits {1to2}.
294 //
295 // "m256/m64bcst"
296 // A 256-bit memory operand or a 64-bit memory operand broadcasted to 256 bits {1to4}.
297 //
298 // "m512/m64bcst"
299 // A 512-bit memory operand or a 64-bit memory operand broadcasted to 512 bits {1to8}.
300 //
301 // "vm32x"
302 // A vector of memory addresses using VSIB with 32-bit indices in XMM register.
303 //
304 // "vm32x{k}"
305 // A vector of memory addresses using VSIB with 32-bit indices in XMM register merge-masked by an AVX-512 mask
306 // register (k1-k7).
307 //
308 // "vm32y"
309 // A vector of memory addresses using VSIB with 32-bit indices in YMM register.
310 //
311 // "vm32y{k}"
312 // A vector of memory addresses using VSIB with 32-bit indices in YMM register merge-masked by an AVX-512 mask
313 // register (k1-k7).
314 //
315 // "vm32z"
316 // A vector of memory addresses using VSIB with 32-bit indices in ZMM register.
317 //
318 // "vm32z{k}"
319 // A vector of memory addresses using VSIB with 32-bit indices in ZMM register merge-masked by an AVX-512 mask
320 // register (k1-k7).
321 //
322 // "vm64x"
323 // A vector of memory addresses using VSIB with 64-bit indices in XMM register.
324 //
325 // "vm64x{k}"
326 // A vector of memory addresses using VSIB with 64-bit indices in XMM register merge-masked by an AVX-512 mask
327 // register (k1-k7).
328 //
329 // "vm64y"
330 // A vector of memory addresses using VSIB with 64-bit indices in YMM register.
331 //
332 // "vm64y{k}"
333 // A vector of memory addresses using VSIB with 64-bit indices in YMM register merge-masked by an AVX-512 mask
334 // register (k1-k7).
335 //
336 // "vm64z"
337 // A vector of memory addresses using VSIB with 64-bit indices in ZMM register.
338 //
339 // "vm64z{k}"
340 // A vector of memory addresses using VSIB with 64-bit indices in ZMM register merge-masked by an AVX-512 mask
341 // register (k1-k7).
342 //
343 // "{sae}"
344 // Suppress-all-exceptions modifier. This operand is optional and can be omitted.
345 //
346 // "{er}"
347 // Embedded rounding control. This operand is optional and can be omitted.
348 //
349 // :ivar is_input: indicates if the instruction reads the variable specified by this operand.
350 // :ivar is_output: indicates if the instruction writes the variable specified by this operand.
351 // :ivar extended_size: for immediate operands the size of the value in bytes after size-extension.
352 //
353 // The extended size affects which operand values can be encoded. E.g. a signed imm8 operand would normally \
354 // encode values in the [-128, 127] range. But if it is extended to 4 bytes, it can also encode values in \
355 // [2**32 - 128, 2**32 - 1] range.
356 // """
357 type Operand struct {
358 Type string `xml:"type,attr"`
359 Input bool `xml:"input,attr"`
360 Output bool `xml:"output,attr"`
361 }
362
363 // ImplicitOperand represents the implicit action of an instruction on a register.
364 type ImplicitOperand struct {
365 ID string `xml:"id,attr"`
366 Input bool `xml:"input,attr"`
367 Output bool `xml:"output,attr"`
368 }
369
370 // ISA is the name of an instruction set extension an instruction form belongs to.
371 //
372 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L430-L487
373 //
374 // """An extension to x86-64 instruction set.
375 //
376 // :ivar name: name of the ISA extension. Possible values are:
377 //
378 // - "RDTSC" := The `RDTSC` instruction.
379 // - "RDTSCP" := The `RDTSCP` instruction.
380 // - "CPUID" := The `CPUID` instruction.
381 // - "FEMMS" := The `FEMMS` instruction.
382 // - "MOVBE" := The `MOVBE` instruction.
383 // - "POPCNT" := The `POPCNT` instruction.
384 // - "LZCNT" := The `LZCNT` instruction.
385 // - "PCLMULQDQ" := The `PCLMULQDQ` instruction.
386 // - "RDRAND" := The `RDRAND` instruction.
387 // - "RDSEED" := The `RDSEED` instruction.
388 // - "CLFLUSH" := The `CLFLUSH` instruction.
389 // - "CLFLUSHOPT" := The `CLFLUSHOPT` instruction.
390 // - "CLWB" := The `CLWB` instruction.
391 // - "CLZERO" := The `CLZERO` instruction.
392 // - "PREFETCH" := The `PREFETCH` instruction (3dnow! Prefetch).
393 // - "PREFETCHW" := The `PREFETCHW` instruction (3dnow! Prefetch/Intel PRFCHW).
394 // - "PREFETCHWT1" := The `PREFETCHWT1` instruction.
395 // - "MONITOR" := The `MONITOR` and `MWAIT` instructions.
396 // - "MONITORX" := The `MONITORX` and `MWAITX` instructions.
397 // - "CMOV" := Conditional MOVe instructions.
398 // - "MMX" := MultiMedia eXtension.
399 // - "MMX+" := AMD MMX+ extension / Integer SSE (Intel).
400 // - "3dnow!" := AMD 3dnow! extension.
401 // - "3dnow+!" := AMD 3dnow!+ extension.
402 // - "SSE" := Streaming SIMD Extension.
403 // - "SSE2" := Streaming SIMD Extension 2.
404 // - "SSE3" := Streaming SIMD Extension 3.
405 // - "SSSE3" := Supplemental Streaming SIMD Extension 3.
406 // - "SSE4.1" := Streaming SIMD Extension 4.1.
407 // - "SSE4.2" := Streaming SIMD Extension 4.2.
408 // - "SSE4A" := Streaming SIMD Extension 4a.
409 // - "AVX" := Advanced Vector eXtension.
410 // - "AVX2" := Advanced Vector eXtension 2.
411 // - "AVX512F" := AVX-512 Foundation instructions.
412 // - "AVX512BW" := AVX-512 Byte and Word instructions.
413 // - "AVX512DQ" := AVX-512 Doubleword and Quadword instructions.
414 // - "AVX512VL" := AVX-512 Vector Length extension (EVEX-encoded XMM/YMM operations).
415 // - "AVX512PF" := AVX-512 Prefetch instructions.
416 // - "AVX512ER" := AVX-512 Exponential and Reciprocal instructions.
417 // - "AVX512CD" := AVX-512 Conflict Detection instructions.
418 // - "AVX512VBMI" := AVX-512 Vector Bit Manipulation instructions.
419 // - "AVX512IFMA" := AVX-512 Integer 52-bit Multiply-Accumulate instructions.
420 // - "AVX512VPOPCNTDQ" := AVX-512 Vector Population Count instructions.
421 // - "XOP" := eXtended OPerations extension.
422 // - "F16C" := Half-Precision (F16) Conversion instructions.
423 // - "FMA3" := Fused Multiply-Add instructions (3-operand).
424 // - "FMA4" := Fused Multiply-Add instructions (4-operand).
425 // - "BMI" := Bit Manipulation Instructions.
426 // - "BMI2" := Bit Manipulation Instructions 2.
427 // - "TBM" := Trailing Bit Manipulation instructions.
428 // - "ADX" := The `ADCX` and `ADOX` instructions.
429 // - "AES" := `AES` instruction set.
430 // - "SHA" := `SHA` instruction set.
431 // """
432 type ISA struct {
433 ID string `xml:"id,attr"`
434 }
435
436 // Encoding describes the instruction form binary representation.
437 type Encoding struct {
438 REX *REX `xml:"REX"`
439 VEX *VEX `xml:"VEX"`
440 EVEX *EVEX `xml:"EVEX"`
441 }
442
443 // REX specifies the REX encoding of an instruction form.
444 //
445 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L541-L574
446 //
447 // """REX prefix.
448 //
449 // Encoding may have only one REX prefix and if present, it immediately precedes the opcode.
450 //
451 // :ivar is_mandatory: indicates whether the REX prefix must be encoded even if no extended registers are used.
452 //
453 // REX is mandatory for most 64-bit instructions (encoded with REX.W = 1) and instructions that operate on the \
454 // extended set of 8-bit registers (to indicate access to dil/sil/bpl/spl as opposed to ah/bh/ch/dh which use the \
455 // same ModR/M).
456 //
457 // :ivar W: the REX.W bit. Possible values are 0, 1, and None.
458 //
459 // None indicates that the bit is ignored.
460 //
461 // :ivar R: the REX.R bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
462 //
463 // The value None indicates that this bit is ignored. \
464 // If R is a reference to an instruction operand, the operand is of register type and REX.R bit specifies the \
465 // high bit (bit 3) of the register number.
466 //
467 // :ivar B: the REX.B bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
468 //
469 // The value None indicates that this bit is ignored. \
470 // If R is a reference to an instruction operand, the operand can be of register or memory type. If the operand \
471 // is of register type, the REX.R bit specifies the high bit (bit 3) of the register number, and the REX.X bit is \
472 // ignored. If the operand is of memory type, the REX.R bit specifies the high bit (bit 3) of the base register \
473 // number, and the X instance variable refers to the same operand.
474 //
475 // :ivar X: the REX.X bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
476 //
477 // The value None indicates that this bit is ignored. \
478 // If X is a reference to an instruction operand, the operand is of memory type and the REX.X bit specifies the \
479 // high bit (bit 3) of the index register number, and the B instance variable refers to the same operand.
480 // """
481 type REX struct {
482 Mandatory bool `xml:"mandatory,attr"`
483 W uint `xml:"W,attr"`
484 R string `xml:"R,attr"`
485 X string `xml:"X,attr"`
486 B string `xml:"B,attr"`
487 }
488
489 // VEX specifies the VEX encoding of an instruction form.
490 //
491 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L606-L691
492 //
493 // """VEX or XOP prefix.
494 //
495 // VEX and XOP prefixes use the same format and differ only by leading byte.
496 // The `type` property helps to differentiate between the two prefix types.
497 //
498 // Encoding may have only one VEX prefix and if present, it immediately precedes the opcode, and no other prefix is \
499 // allowed.
500 //
501 // :ivar type: the type of the leading byte for VEX encoding. Possible values are:
502 //
503 // "VEX"
504 // The VEX prefix (0xC4 or 0xC5) is used.
505 //
506 // "XOP"
507 // The XOP prefix (0x8F) is used.
508 //
509 // :ivar mmmmm: the VEX m-mmmm (implied leading opcode bytes) field. In AMD documentation this field is called map_select. Possible values are:
510 //
511 // 0b00001
512 // Implies 0x0F leading opcode byte.
513 //
514 // 0b00010
515 // Implies 0x0F 0x38 leading opcode bytes.
516 //
517 // 0b00011
518 // Implies 0x0F 0x3A leading opcode bytes.
519 //
520 // 0b01000
521 // This value does not have opcode byte interpretation. Only XOP instructions use this value.
522 //
523 // 0b01001
524 // This value does not have opcode byte interpretation. Only XOP and TBM instructions use this value.
525 //
526 // 0b01010
527 // This value does not have opcode byte interpretation. Only TBM instructions use this value.
528 //
529 // Only VEX prefix with m-mmmm equal to 0b00001 could be encoded in two bytes.
530 //
531 // :ivar pp: the VEX pp (implied legacy prefix) field. Possible values are:
532 //
533 // 0b00
534 // No implied prefix.
535 //
536 // 0b01
537 // Implied 0x66 prefix.
538 //
539 // 0b10
540 // Implied 0xF3 prefix.
541 //
542 // 0b11
543 // Implied 0xF2 prefix.
544 //
545 // :ivar W: the VEX.W bit. Possible values are 0, 1, and None.
546 //
547 // None indicates that the bit is ignored.
548 //
549 // :ivar L: the VEX.L bit. Possible values are 0, 1, and None.
550 //
551 // None indicates that the bit is ignored.
552 //
553 // :ivar R: the VEX.R bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
554 //
555 // The value None indicates that this bit is ignored. \
556 // If R is a reference to an instruction operand, the operand is of register type and VEX.R bit specifies the \
557 // high bit (bit 3) of the register number.
558 //
559 // :ivar B: the VEX.B bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
560 //
561 // The value None indicates that this bit is ignored. \
562 // If R is a reference to an instruction operand, the operand can be of register or memory type. If the operand is \
563 // of register type, the VEX.R bit specifies the high bit (bit 3) of the register number, and the VEX.X bit is \
564 // ignored. If the operand is of memory type, the VEX.R bit specifies the high bit (bit 3) of the base register \
565 // number, and the X instance variable refers to the same operand.
566 //
567 // :ivar X: the VEX.X bit. Possible values are 0, 1, None, or a reference to one of the instruction operands.
568 //
569 // The value None indicates that this bit is ignored. \
570 // If X is a reference to an instruction operand, the operand is of memory type and the VEX.X bit specifies the \
571 // high bit (bit 3) of the index register number, and the B instance variable refers to the same operand.
572 //
573 // :ivar vvvv: the VEX vvvv field. Possible values are 0b0000 or a reference to one of the instruction operands.
574 //
575 // The value 0b0000 indicates that this field is not used. \
576 // If vvvv is a reference to an instruction operand, the operand is of register type and VEX.vvvv field specifies \
577 // its number.
578 // """
579 type VEX struct {
580 Type string `xml:"type,attr"`
581 W *uint `xml:"W,attr"`
582 L uint `xml:"L,attr"`
583 M5 string `xml:"m-mmmm,attr"`
584 PP string `xml:"pp,attr"`
585 R string `xml:"R,attr"`
586 X string `xml:"X,attr"`
587 B string `xml:"B,attr"`
588 V4 string `xml:"vvvv,attr"`
589 }
590
591 // EVEX specifies the EVEX encoding of an instruction form.
592 //
593 // Reference: https://github.com/Maratyszcza/Opcodes/blob/6e2b0cd9f1403ecaf164dea7019dd54db5aea252/opcodes/x86_64.py#L731-L845
594 //
595 // """EVEX prefix.
596 //
597 // Encoding may have only one EVEX prefix and if present, it immediately precedes the opcode, and no other prefix is \
598 // allowed.
599 //
600 // :ivar mm: the EVEX mm (compressed legacy escape) field. Identical to two low bits of VEX.m-mmmm field. Possible \
601 // values are:
602 //
603 // 0b01
604 // Implies 0x0F leading opcode byte.
605 //
606 // 0b10
607 // Implies 0x0F 0x38 leading opcode bytes.
608 //
609 // 0b11
610 // Implies 0x0F 0x3A leading opcode bytes.
611 //
612 // :ivar pp: the EVEX pp (compressed legacy prefix) field. Possible values are:
613 //
614 // 0b00
615 // No implied prefix.
616 //
617 // 0b01
618 // Implied 0x66 prefix.
619 //
620 // 0b10
621 // Implied 0xF3 prefix.
622 //
623 // 0b11
624 // Implied 0xF2 prefix.
625 //
626 // :ivar W: the EVEX.W bit. Possible values are 0, 1, and None.
627 //
628 // None indicates that the bit is ignored.
629 //
630 // :ivar LL: the EVEX.L'L bits. Specify either vector length for the operation, or explicit rounding control \
631 // (in which case operation is 512 bits wide). Possible values:
632 //
633 // None
634 // Indicates that the EVEX.L'L field is ignored.
635 //
636 // 0b00
637 // 128-bits wide operation.
638 //
639 // 0b01
640 // 256-bits wide operation.
641 //
642 // 0b10
643 // 512-bits wide operation.
644 //
645 // Reference to the last instruction operand
646 // EVEX.L'L are interpreted as rounding control and set to the value specified by the operand. If the rounding
647 // control operand is omitted, EVEX.L'L is set to 0b10 (embedded rounding control is only supported for 512-bit
648 // wide operations).
649 //
650 // :ivar RR: the EVEX.R'R bits. Possible values are None, or a reference to an register-type instruction operand.
651 //
652 // None indicates that the field is ignored.
653 // The R' bit specifies bit 4 of the register number and the R bit specifies bit 3 of the register number.
654 //
655 // :ivar B: the EVEX.B bit. Possible values are None, or a reference to one of the instruction operands.
656 //
657 // None indicates that this bit is ignored. \
658 // If R is a reference to an instruction operand, the operand can be of register or memory type. If the operand is\
659 // of register type, the EVEX.R bit specifies the high bit (bit 3) of the register number, and the EVEX.X bit is \
660 // ignored. If the operand is of memory type, the EVEX.R bit specifies the high bit (bit 3) of the base register \
661 // number, and the X instance variable refers to the same operand.
662 //
663 // :ivar X: the EVEX.X bit. Possible values are None, or a reference to one of the instruction operands.
664 //
665 // The value None indicates that this bit is ignored. \
666 // If X is a reference to an instruction operand, the operand is of memory type and the EVEX.X bit specifies the \
667 // high bit (bit 3) of the index register number, and the B instance variable refers to the same operand.
668 //
669 // :ivar vvvv: the EVEX vvvv field. Possible values are 0b0000 or a reference to one of the instruction operands.
670 //
671 // The value 0b0000 indicates that this field is not used. \
672 // If vvvv is a reference to an instruction operand, the operand is of register type and EVEX.vvvv field \
673 // specifies the register number.
674 //
675 // :ivar V: the EVEX V field. Possible values are 0, or a reference to one of the instruction operands.
676 //
677 // The value 0 indicates that this field is not used (EVEX.vvvv is not used or encodes a general-purpose register).
678 //
679 // :ivar b: the EVEX b (broadcast/rounding control/suppress all exceptions context) bit. Possible values are 0 or a \
680 // reference to one of the instruction operands.
681 //
682 // The value 0 indicates that this field is not used. \
683 // If b is a reference to an instruction operand, the operand can be a memory operand with optional broadcasting, \
684 // an optional rounding specification, or an optional Suppress-all-exceptions specification. \
685 // If b is a reference to a memory operand, EVEX.b encodes whether broadcasting is used to the operand. \
686 // If b is a reference to a optional rounding control specification, EVEX.b encodes whether explicit rounding \
687 // control is used. \
688 // If b is a reference to a suppress-all-exceptions specification, EVEX.b encodes whether suppress-all-exceptions \
689 // is enabled.
690 //
691 // :ivar aaa: the EVEX aaa (embedded opmask register specifier) field. Possible values are 0 or a reference to one of \
692 // the instruction operands.
693 //
694 // The value 0 indicates that this field is not used. \
695 // If aaa is a reference to an instruction operand, the operand supports register mask, and EVEX.aaa encodes the \
696 // mask register.
697 //
698 // :ivar z: the EVEX z bit. Possible values are None, 0 or a reference to one of the instruction operands.
699 //
700 // None indicates that the bit is ignored. \
701 // The value 0 indicates that the bit is not used. \
702 // If z is a reference to an instruction operand, the operand supports zero-masking with register mask, and \
703 // EVEX.z indicates whether zero-masking is used.
704 //
705 // :ivar disp8xN: the N value used for encoding compressed 8-bit displacement. Possible values are powers of 2 in \
706 // [1, 64] range or None.
707 //
708 // None indicates that this instruction form does not use displacement (the form has no memory operands).
709 // """
710 type EVEX struct {
711 M2 string `xml:"mm,attr"`
712 PP string `xml:"pp,attr"`
713 W *uint `xml:"W,attr"`
714 LL string `xml:"LL,attr"`
715 V4 string `xml:"vvvv,attr"`
716 V string `xml:"V,attr"`
717 RR string `xml:"RR,attr"`
718 B string `xml:"B,attr"`
719 X string `xml:"X,attr"`
720 Bsml string `xml:"b,attr"`
721 A3 string `xml:"aaa,attr"`
722 Z string `xml:"Z,attr"`
723 Disp8xN string `xml:"disp8xN,attr"`
724 }