package core:rexcode/isa/x86
Overview
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
rexcode · Brendan Punsky (dotbmp@github), original author
Index
Types (74)
- Addr_Size
- BND
- Broadcast
- CREG
- Clobber
Clobber_… (4)
- DREG
- Decode_Entry
- Decode_Index
- Decoder_State
- Encode_Run
- Encoding
- Encoding_Flags
- Error
- Error_Code
- Escape
- Form_Recipe
- GPR16
- GPR32
- GPR64
- GPR8
- GPR8H
- Instruction
- Instruction_Flags
- Instruction_Info
- KREG
Label_… (4)
- MM
- Mem128
- Mem16
- Mem256
- Mem32
- Mem512
- Mem64
- Mem8
- Mem80
- Memory
- Mnemonic
- Mnemonic_Alias
- ModRM_Info
- Mode
- Operand
Operand_… (5)
- Print_Options
- Print_Result
- Recipe_Flags
- Register
- Relocation
- Relocation_Type
- Rep
- SIB_Info
- SREG
- ST
- Side_Effect
- Side_Effects
- Token
- Token_Kind
VEX_… (4)
- XMM
- YMM
- ZMM
Constants (238)
Listed one per row under Constants.
Variables (21)
Procedures (8570)
Listed one per row under Procedures.
Procedure Groups (1860)
Listed one per row under Procedures.
Types
Addr_Size ¶
Addr_Size :: enum u8 { DEFAULT, // whatever the mode/prefix selects; the form does not care A16, // 16-bit addressing (CX) A32, // 32-bit addressing (ECX) A64, // 64-bit addressing (RCX); long mode only }
The ADDRESS size a form requires -- a different axis from operand size (66h / REX.W), selected by 67h against the mode's default: 64-bit in long mode and 32-bit under 67h; 32-bit in protected mode and 16-bit under 67h.
Almost every instruction is DEFAULT (it works at whatever address size is in
effect). It matters where address size picks the MNEMONIC: 0xE3 is JRCXZ,
JECXZ or JCXZ purely by which counter register it tests, and nothing else in
the encoding says which. Modelling that as REX.W (which does not affect
address size at all) made 48 E3 cb the encoding of JRCXZ, where the correct
one is a bare E3 cb, and left the decoder unable to tell the three apart.
Related Procedures With Parameters
Broadcast ¶
Broadcast :: enum u8 { NONE = 0, // No broadcast (full vector load) B1TO2 = 1, // Broadcast 1 element to 2 (64-bit element to 128-bit vector) B1TO4 = 2, // Broadcast 1 element to 4 (32-bit to 128-bit, or 64-bit to 256-bit) B1TO8 = 3, // Broadcast 1 element to 8 (32-bit to 256-bit, or 64-bit to 512-bit) B1TO16 = 4, // Broadcast 1 element to 16 (32-bit to 512-bit) }
EVEX broadcast mode values for Operand_Flags.broadcast Used for EVEX instructions to broadcast a scalar element to all lanes
CREG ¶
CREG :: enum u8 { CR0 = 0, CR2 = 2, CR3 = 3, CR4 = 4, CR8 = 8, }
Control registers (non-contiguous: CR0, CR2, CR3, CR4, CR8)
Related Procedures With Parameters
- emit_mov_cr_r64
- emit_mov_r64_cr
- inst_mov_cr_r64
- inst_mov_r64_cr
- op_creg
- emit_mov (procedure groups)
- inst_mov (procedure groups)
Clobber ¶
Clobber :: struct { written: Operand_Set, read: Operand_Set, implicit_wr: Clobber_Regs, implicit_rd: Clobber_Regs, flags_wr: Clobber_Flags, flags_undef: Clobber_Flags, flags_rd: Clobber_Flags, writes_mem: bool, reads_mem: bool, side_effects: Side_Effects, }
Clobber_Flag ¶
Clobber_Flag :: enum u8 { CF, PF, AF, ZF, SF, OF, DF, IF, TF, }
Clobber_Flags ¶
Clobber_Flags :: distinct bit_set[Clobber_Flag; u16]
Clobber_Reg ¶
Clobber_Reg :: enum u8 { RAX, RBX, RCX, RDX, RSI, RDI, RSP, RBP, R11, XMM0, VECTOR, MXCSR, FPU_ST, FPU_SW, }
Clobber_Regs ¶
Clobber_Regs :: distinct bit_set[Clobber_Reg; u16]
DREG ¶
DREG :: enum u8 { DR0, DR1, DR2, DR3, DR6, DR7, }
Debug registers
Related Procedures With Parameters
- emit_mov_dr_r64
- emit_mov_r64_dr
- inst_mov_dr_r64
- inst_mov_r64_dr
- op_dreg
- emit_mov (procedure groups)
- inst_mov (procedure groups)
Decode_Entry ¶
Decode_Entry :: struct { esc: Escape, prefix: u8, opcode: u8, ext: u8, mnemonic: Mnemonic, ops: [4]Operand_Type, enc: [4]Operand_Encoding, flags: Encoding_Flags, }
Information needed to decode an instruction given its opcode bytes.
Related Procedures With Returns
Decode_Index ¶
(start, count) into a *_DECODE_ENTRIES array. Index tables are stored flat:
a logical [4][256] is loaded as [1024]; address with didx.
Decoder_State ¶
Decoder_State :: struct { data: []u8, // Input bytes position: int, // Current position mode: Mode, // Decoded prefix state rex: u8, prefix_66: bool, prefix_f2: bool, prefix_f3: bool, prefix_67: bool, // Address size override segment: Register, has_lock: bool, opcode_reg: u8, // VEX/EVEX state vex_type: VEX_Type, vex_r: bool, // VEX.R (inverted) vex_x: bool, // VEX.X (inverted) vex_b: bool, // VEX.B (inverted) vex_w: bool, // VEX.W vex_l: u8, // VEX.L (0, 1, or 2 for EVEX) vex_vvvv: u8, // VEX.vvvv register vex_pp: u8, // VEX.pp (implied prefix) vex_mmmmm: u8, // EVEX specific evex_r2: bool, // EVEX.R' evex_v2: bool, // EVEX.V' evex_z: bool, // EVEX.z (zeroing) evex_b: bool, // EVEX.b (broadcast/rc/sae) evex_aaa: u8, }
Related Procedures With Parameters
Encode_Run ¶
Companion run index: ENCODE_RUNS[mnemonic] -> contiguous run in ENCODE_FORMS.
Encoding ¶
Encoding :: struct #packed { mnemonic: Mnemonic, // 2 bytes ops: [4]Operand_Type, // 4 bytes - operand types enc: [4]Operand_Encoding, // 4 bytes - operand encodings opcode: u8, // 1 byte - primary opcode byte ext: u8, // 1 byte - ModR/M reg extension (/0-/7) or secondary opcode flags: Encoding_Flags, }
Related Procedures With Parameters
Encoding_Flags ¶
Encoding_Flags :: distinct bit_field u32 { esc: Escape | 2, prefix: u8 | 2, vex_type: VEX_Type | 2, vex_w: VEX_W | 2, vex_l: VEX_L | 2, default_64: bool | 1, force_rex_w: bool | 1, opsize_16: bool | 1, no_rex: bool | 1, lock_ok: bool | 1, rep_ok: bool | 1, modrm_reg_ext: bool | 1, mode_32_only: bool | 1, addr_size: Addr_Size | 2, explicit_count: u8 | 3, has_implicit: bool | 1, op_count: u8 | 3, needs_modrm: bool | 1, }
Error_Code ¶
Error_Code :: rexcode_isa.Error_Code
Escape ¶
Escape :: enum u8 { NONE, // single-byte opcode _0F, // 0F xx _0F38, // 0F 38 xx _0F3A, // 0F 3A xx }
Form_Recipe ¶
Form_Recipe :: struct { prefix: u8, // mandatory legacy prefix emitted before REX (0 = none) opcode: [3]u8, // escape + opcode: [op] / [0F,op] / [0F,38,op] / [0F,3A,op] opcode_len: u8, // 1..3 ext: u8, // ModR/M reg ext digit (when reg_from_ext) or /digit source rm_op: i8, // user operand index -> ModR/M r/m field (-1 = none) reg_op: i8, // user operand index -> ModR/M reg field (-1 = none) opr_op: i8, // user operand index -> +rb opcode register (-1 = none) imm_op: i8, // user operand index -> immediate (-1 = none) imm_size: u8, // 1/2/4/8 when imm_op >= 0 flags: Recipe_Flags, }
GPR16 ¶
GPR16 :: enum u8 { AX, CX, DX, BX, SP, BP, SI, DI, R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W, }
GPR32 ¶
GPR32 :: enum u8 { EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D, }
GPR64 ¶
GPR64 :: enum u8 { RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15, }
GPR8 ¶
GPR8 :: enum u8 { AL, CL, DL, BL, SPL, BPL, SIL, DIL, R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B, }
GPR8H ¶
GPR8H :: enum u8 { AH = 4, CH = 5, DH = 6, BH = 7, }
Legacy high-byte registers (AH, CH, DH, BH) - no REX allowed with these Hardware numbers 4-7 (not 0-3) because they share encoding space with SPL/BPL/SIL/DIL
Instruction ¶
Instruction :: struct #packed { ops: [4]Operand `fmt:"v,operand_count`, // 48 bytes mnemonic: Mnemonic, // 2 bytes operand_count: u8, // 1 byte flags: Instruction_Flags, // 1 byte length: u8, // 1 byte (filled by decoder, used for iteration) enc_hint: u16, // 2 bytes (pre-matched form, +1 biased; 0 = none) _: [9]u8, }
Related Procedures With Parameters
Instruction_Flags ¶
Instruction_Flags :: distinct bit_field u8 { lock: bool | 1, rep: Rep | 2, segment: u8 | 3, addr32: bool | 1, data16: bool | 1, }
Instruction flags for prefixes and modifiers
Instruction_Info ¶
Instruction_Info :: struct { offset: u32, // Prefix info rex: u8, // REX byte (0 if none) has_lock: bool, rep: Rep, // Rep prefix (uses same enum as Instruction_Flags) segment: Register, // VEX/EVEX info vex_type: VEX_Type, vex_l: VEX_L, vex_w: VEX_W, evex_b: bool, // EVEX broadcast evex_z: bool, // EVEX zeroing opmask: u8, }
Instruction_Info captures extra metadata produced during decoding that isn't part of the core Instruction struct. For batch decoding, this is stored in a parallel array at the same index as the corresponding Instruction.
Label_Map ¶
Label_Map :: rexcode_isa.Label_Map
Label_Names ¶
Label_Names :: map[rexcode_isa.Label_Offset]string
Label_Offset ¶
Label_Offset :: rexcode_isa.Label_Offset
MM ¶
MM :: enum u8 { MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, }
Related Procedures With Parameters
- emit_movd_m32_mm
- emit_movd_mm_m32
- emit_movd_mm_r32
- emit_movd_r32_mm
- emit_movq_m64_mm
- emit_movq_mm_m64
- emit_movq_mm_mm
- emit_pshufw_mm_m64_imm8
- emit_pshufw_mm_mm_imm8
- inst_movd_m32_mm
- inst_movd_mm_m32
- inst_movd_mm_r32
- inst_movd_r32_mm
- inst_movq_m64_mm
- inst_movq_mm_m64
- inst_movq_mm_mm
- inst_pshufw_mm_m64_imm8
- inst_pshufw_mm_mm_imm8
- op_mm
- emit_movd (procedure groups)
- emit_movq (procedure groups)
- emit_pshufw (procedure groups)
- inst_movd (procedure groups)
- inst_movq (procedure groups)
- inst_pshufw (procedure groups)
Mem80 ¶
Mem80 :: struct { mem: Memory, }
Related Procedures With Parameters
- emit_fbld_m80
- emit_fbstp_m80
- emit_fld_m80
- emit_fstp_m80
- inst_fbld_m80
- inst_fbstp_m80
- inst_fld_m80
- inst_fstp_m80
- emit_fld (procedure groups)
- emit_fstp (procedure groups)
- inst_fld (procedure groups)
- inst_fstp (procedure groups)
Memory ¶
Memory :: distinct bit_field u64 { base_hw: u8 | 5, base_ext: bool | 1, index_hw: u8 | 5, index_ext: bool | 1, scale_enc: u8 | 2, disp: i32 | 32, segment: u8 | 3, addr_size_override: bool | 1, base_class: u8 | 5, index_class: u8 | 5, disp_is_label: bool | 1, }
Related Procedures With Returns
Mnemonic ¶
Mnemonic :: enum u16 { INVALID = 0, // ------------------------------------------------------------------------- // SECTION: 4.1 Data Transfer Instructions // ------------------------------------------------------------------------- MOV, MOVABS, MOVZX, MOVSX, MOVSXD, XCHG, PUSH, POP, LEA, // ------------------------------------------------------------------------- // SECTION: 4.2 Arithmetic Instructions // ------------------------------------------------------------------------- ADD, ADC, SUB, SBB, MUL, IMUL, DIV, IDIV, INC, DEC, NEG, CMP, // ------------------------------------------------------------------------- // SECTION: 4.3 Logical Instructions // ------------------------------------------------------------------------- AND, OR, XOR, NOT, TEST, // ------------------------------------------------------------------------- // SECTION: 4.4 Shift and Rotate Instructions // ------------------------------------------------------------------------- SHL, SHR, SAR, SAL, ROL, ROR, RCL, RCR, SHLD, SHRD, // ------------------------------------------------------------------------- // SECTION: 4.5 Bit Operations // ------------------------------------------------------------------------- BT, BTS, BTR, BTC, BSF, BSR, POPCNT, LZCNT, TZCNT, // ------------------------------------------------------------------------- // SECTION: 4.6 Control Flow Instructions // ------------------------------------------------------------------------- JMP, JA, JAE, JB, JBE, JC, JE, JZ, JG, JGE, JL, JLE, JNA, JNAE, JNB, JNBE, JNC, JNE, JNZ, JNG, JNGE, JNL, JNLE, JNO, JNP, JNS, JO, JP, JPE, JPO, JS, JCXZ, JECXZ, JRCXZ, LOOP, LOOPE, LOOPNE, CALL, RET, IRET, IRETD, IRETQ, INT, INT3, INTO, SYSCALL, SYSRET, SYSENTER, SYSEXIT, // ------------------------------------------------------------------------- // SECTION: 4.7 Conditional Set Instructions (SETcc) // ------------------------------------------------------------------------- SETA, SETAE, SETB, SETBE, SETC, SETE, SETG, SETGE, SETL, SETLE, SETNA, SETNAE, SETNB, SETNBE, SETNC, SETNE, SETNG, SETNGE, SETNL, SETNLE, SETNO, SETNP, SETNS, SETNZ, SETO, SETP, SETPE, SETPO, SETS, SETZ, // ------------------------------------------------------------------------- // SECTION: 4.8 Conditional Move Instructions (CMOVcc) // ------------------------------------------------------------------------- CMOVA, CMOVAE, CMOVB, CMOVBE, CMOVC, CMOVE, CMOVG, CMOVGE, CMOVL, CMOVLE, CMOVNA, CMOVNAE, CMOVNB, CMOVNBE, CMOVNC, CMOVNE, CMOVNG, CMOVNGE, CMOVNL, CMOVNLE, CMOVNO, CMOVNP, CMOVNS, CMOVNZ, CMOVO, CMOVP, CMOVPE, CMOVPO, CMOVS, CMOVZ, // ------------------------------------------------------------------------- // SECTION: 4.9 STring Operations // ------------------------------------------------------------------------- MOVS, MOVSB, MOVSW, MOVSD, MOVSQ, CMPS, CMPSB, CMPSW, CMPSD, CMPSQ, SCAS, SCASB, SCASW, SCASD, SCASQ, LODS, LODSB, LODSW, LODSD, LODSQ, STOS, STOSB, STOSW, STOSD, STOSQ, // ------------------------------------------------------------------------- // SECTION: 4.10 Flag Operations // ------------------------------------------------------------------------- CLC, STC, CMC, CLD, STD, CLI, STI, LAHF, SAHF, PUSHF, PUSHFD, PUSHFQ, POPF, POPFD, POPFQ, // ------------------------------------------------------------------------- // SECTION: 4.11 Miscellaneous Instructions // ------------------------------------------------------------------------- NOP, HLT, WAIT, LOCK, UD0, UD1, UD2, CPUID, RDTSC, RDTSCP, RDPMC, XGETBV, XSETBV, // ------------------------------------------------------------------------- // SECTION: 4.12 Conversion Instructions // ------------------------------------------------------------------------- CBW, CWDE, CDQE, CWD, CDQ, CQO, // ------------------------------------------------------------------------- // SECTION: 4.13 BMI1/BMI2 Instructions // ------------------------------------------------------------------------- ANDN, BEXTR, BLSI, BLSMSK, BLSR, BZHI, PDEP, PEXT, RORX, SARX, SHLX, SHRX, MULX, // ------------------------------------------------------------------------- // SECTION: 4.14 ADX Instructions // ------------------------------------------------------------------------- ADCX, ADOX, // ------------------------------------------------------------------------- // SECTION: 4.15 SSE Instructions // ------------------------------------------------------------------------- MOVAPS, MOVUPS, MOVAPD, MOVUPD, MOVSS, MOVDQA, MOVDQU, MOVQ, MOVD, MOVLPS, MOVHPS, MOVLPD, MOVHPD, MOVLHPS, MOVHLPS, MOVMSKPS, MOVMSKPD, MOVNTPS, MOVNTPD, MOVNTDQ, MOVNTDQA, ADDPS, ADDPD, ADDSS, ADDSD, SUBPS, SUBPD, SUBSS, SUBSD, MULPS, MULPD, MULSS, MULSD, DIVPS, DIVPD, DIVSS, DIVSD, SQRTPS, SQRTPD, SQRTSS, SQRTSD, RCPPS, RCPSS, RSQRTPS, RSQRTSS, MAXPS, MAXPD, MAXSS, MAXSD, MINPS, MINPD, MINSS, MINSD, ANDPS, ANDPD, ANDNPS, ANDNPD, ORPS, ORPD, XORPS, XORPD, CMPPS, CMPPD, CMPSS, COMISS, COMISD, UCOMISS, UCOMISD, SHUFPS, SHUFPD, UNPCKLPS, UNPCKHPS, UNPCKLPD, UNPCKHPD, CVTPS2PD, CVTPD2PS, CVTSS2SD, CVTSD2SS, CVTPS2DQ, CVTPD2DQ, CVTDQ2PS, CVTDQ2PD, CVTSS2SI, CVTSD2SI, CVTSI2SS, CVTSI2SD, CVTTPS2DQ, CVTTPD2DQ, CVTTSS2SI, CVTTSD2SI, // ------------------------------------------------------------------------- // SECTION: 4.16 SSE2 Integer Instructions // ------------------------------------------------------------------------- PADDB, PADDW, PADDD, PADDQ, PSUBB, PSUBW, PSUBD, PSUBQ, PADDSB, PADDSW, PADDUSB, PADDUSW, PSUBSB, PSUBSW, PSUBUSB, PSUBUSW, PMULLW, PMULHW, PMULHUW, PMULUDQ, PMADDWD, PAND, PANDN, POR, PXOR, PSLLW, PSLLD, PSLLQ, PSRLW, PSRLD, PSRLQ, PSRAW, PSRAD, PCMPEQB, PCMPEQW, PCMPEQD, PCMPGTB, PCMPGTW, PCMPGTD, PACKSSWB, PACKSSDW, PACKUSWB, PUNPCKLBW, PUNPCKLWD, PUNPCKLDQ, PUNPCKLQDQ, PUNPCKHBW, PUNPCKHWD, PUNPCKHDQ, PUNPCKHQDQ, PSHUFD, PSHUFHW, PSHUFLW, PSHUFW, PEXTRW, PINSRW, PMOVMSKB, PAVGB, PAVGW, PMAXUB, PMAXSW, PMINUB, PMINSW, PSADBW, MASKMOVDQU, LFENCE, SFENCE, MFENCE, PAUSE, CLFLUSH, // ------------------------------------------------------------------------- // SECTION: 4.17 SSE3/SSSE3 Instructions // ------------------------------------------------------------------------- ADDSUBPS, ADDSUBPD, HADDPS, HADDPD, HSUBPS, HSUBPD, MOVDDUP, MOVSLDUP, MOVSHDUP, LDDQU, PSHUFB, PHADDW, PHADDD, PHADDSW, PHSUBW, PHSUBD, PHSUBSW, PMADDUBSW, PMULHRSW, PSIGNB, PSIGNW, PSIGND, PABSB, PABSW, PABSD, PALIGNR, // ------------------------------------------------------------------------- // SECTION: 4.18 SSE4.1/SSE4.2 Instructions // ------------------------------------------------------------------------- BLENDPS, BLENDPD, BLENDVPS, BLENDVPD, PBLENDW, PBLENDVB, DPPS, DPPD, EXTRACTPS, INSERTPS, MPSADBW, PACKUSDW, PEXTRB, PEXTRD, PEXTRQ, PHMINPOSUW, PINSRB, PINSRD, PINSRQ, PMAXSB, PMAXSD, PMAXUW, PMAXUD, PMINSB, PMINSD, PMINUW, PMINUD, PMOVSXBW, PMOVSXBD, PMOVSXBQ, PMOVSXWD, PMOVSXWQ, PMOVSXDQ, PMOVZXBW, PMOVZXBD, PMOVZXBQ, PMOVZXWD, PMOVZXWQ, PMOVZXDQ, PMULDQ, PMULLD, PTEST, ROUNDPS, ROUNDPD, ROUNDSS, ROUNDSD, PCMPEQQ, CRC32, PCMPESTRI, PCMPESTRM, PCMPISTRI, PCMPISTRM, PCMPGTQ, // ------------------------------------------------------------------------- // SECTION: 4.19 AES-NI and SHA Instructions // ------------------------------------------------------------------------- PCLMULQDQ, AESDEC, AESDECLAST, AESENC, AESENCLAST, AESIMC, AESKEYGENASSIST, SHA1MSG1, SHA1MSG2, SHA1NEXTE, SHA1RNDS4, SHA256MSG1, SHA256MSG2, SHA256RNDS2, // ------------------------------------------------------------------------- // SECTION: 4.20 AVX Instructions // ------------------------------------------------------------------------- VADDPS, VADDPD, VADDSS, VADDSD, VSUBPS, VSUBPD, VSUBSS, VSUBSD, VMULPS, VMULPD, VMULSS, VMULSD, VDIVPS, VDIVPD, VDIVSS, VDIVSD, VSQRTPS, VSQRTPD, VSQRTSS, VSQRTSD, VRCPPS, VRCPSS, VRSQRTPS, VRSQRTSS, VMAXPS, VMAXPD, VMAXSS, VMAXSD, VMINPS, VMINPD, VMINSS, VMINSD, VANDPS, VANDPD, VANDNPS, VANDNPD, VORPS, VORPD, VXORPS, VXORPD, VCMPPS, VCMPPD, VCMPSS, VCMPSD, VCOMISS, VCOMISD, VUCOMISS, VUCOMISD, VSHUFPS, VSHUFPD, VUNPCKLPS, VUNPCKHPS, VUNPCKLPD, VUNPCKHPD, VBLENDPS, VBLENDPD, VBLENDVPS, VBLENDVPD, VDPPS, VDPPD, VROUNDPS, VROUNDPD, VROUNDSS, VROUNDSD, VEXTRACTPS, VINSERTPS, VMOVAPS, VMOVUPS, VMOVAPD, VMOVUPD, VMOVSS, VMOVSD, VMOVDQA, VMOVDQU, VMOVQ, VMOVD, VMOVLPS, VMOVHPS, VMOVLPD, VMOVHPD, VMOVLHPS, VMOVHLPS, VMOVMSKPS, VMOVMSKPD, VMOVNTPS, VMOVNTPD, VMOVNTDQ, VMOVNTDQA, VADDSUBPS, VADDSUBPD, VHADDPS, VHADDPD, VHSUBPS, VHSUBPD, VLDDQU, VMOVDDUP, VMOVSLDUP, VMOVSHDUP, VPCMPESTRI, VPCMPESTRM, VPCMPISTRI, VPCMPISTRM, VPBROADCASTB, VPBROADCASTW, VPBROADCASTD, VPBROADCASTQ, VCVTPS2PD, VCVTPD2PS, VCVTSS2SD, VCVTSD2SS, VCVTPS2DQ, VCVTPD2DQ, VCVTDQ2PS, VCVTDQ2PD, VCVTSS2SI, VCVTSD2SI, VCVTSI2SS, VCVTSI2SD, VCVTTPS2DQ, VCVTTPD2DQ, VCVTTSS2SI, VCVTTSD2SI, VPADDB, VPADDW, VPADDD, VPADDQ, VPSUBB, VPSUBW, VPSUBD, VPSUBQ, VPMULLW, VPMULHW, VPMULHUW, VPMULUDQ, VPMADDWD, VPAND, VPANDN, VPOR, VPXOR, VPSLLW, VPSLLD, VPSLLQ, VPSRLW, VPSRLD, VPSRLQ, VPSRAW, VPSRAD, VPCMPEQB, VPCMPEQW, VPCMPEQD, VPCMPEQQ, VPCMPGTB, VPCMPGTW, VPCMPGTD, VPCMPGTQ, VPACKSSWB, VPACKSSDW, VPACKUSWB, VPACKUSDW, VPUNPCKLBW, VPUNPCKLWD, VPUNPCKLDQ, VPUNPCKLQDQ, VPUNPCKHBW, VPUNPCKHWD, VPUNPCKHDQ, VPUNPCKHQDQ, VPSHUFD, VPSHUFHW, VPSHUFLW, VPEXTRB, VPEXTRW, VPEXTRD, VPEXTRQ, VPINSRB, VPINSRW, VPINSRD, VPINSRQ, VPMOVMSKB, VPTEST, VPSHUFB, VPHADDW, VPHADDD, VPHADDSW, VPHSUBW, VPHSUBD, VPHSUBSW, VPMADDUBSW, VPMULHRSW, VPSIGNB, VPSIGNW, VPSIGND, VPABSB, VPABSW, VPABSD, VPALIGNR, VPBLENDW, VPBLENDVB, VMPSADBW, VPHMINPOSUW, VPMAXSB, VPMAXSD, VPMAXUW, VPMAXUD, VPMINSB, VPMINSD, VPMINUW, VPMINUD, VPMOVSXBW, VPMOVSXBD, VPMOVSXBQ, VPMOVSXWD, VPMOVSXWQ, VPMOVSXDQ, VPMOVZXBW, VPMOVZXBD, VPMOVZXBQ, VPMOVZXWD, VPMOVZXWQ, VPMOVZXDQ, VPMULDQ, VPMULLD, VMASKMOVDQU, VPCLMULQDQ, VAESDEC, VAESDECLAST, VAESENC, VAESENCLAST, VAESIMC, VAESKEYGENASSIST, VBROADCASTSS, VBROADCASTSD, VBROADCASTF128, VEXTRACTF128, VINSERTF128, VPERM2F128, VMASKMOVPS, VMASKMOVPD, VTESTPS, VTESTPD, VZEROALL, VZEROUPPER, // ------------------------------------------------------------------------- // SECTION: 4.21 AVX2 Instructions // ------------------------------------------------------------------------- VBROADCASTI128, VEXTRACTI128, VINSERTI128, VPERM2I128, VPERMD, VPERMPS, VPERMQ, VPERMPD, VPBLENDD, VPSLLVD, VPSLLVQ, VPSRLVD, VPSRLVQ, VPSRAVD, VPMASKMOVD, VPMASKMOVQ, VGATHERDPS, VGATHERDPD, VGATHERQPS, VGATHERQPD, VPGATHERDD, VPGATHERDQ, VPGATHERQD, VPGATHERQQ, // ------------------------------------------------------------------------- // SECTION: 4.22 FMA Instructions // ------------------------------------------------------------------------- VFMADD132PS, VFMADD213PS, VFMADD231PS, VFMADD132PD, VFMADD213PD, VFMADD231PD, VFMADD132SS, VFMADD213SS, VFMADD231SS, VFMADD132SD, VFMADD213SD, VFMADD231SD, VFMSUB132PS, VFMSUB213PS, VFMSUB231PS, VFMSUB132PD, VFMSUB213PD, VFMSUB231PD, VFMSUB132SS, VFMSUB213SS, VFMSUB231SS, VFMSUB132SD, VFMSUB213SD, VFMSUB231SD, VFNMADD132PS, VFNMADD213PS, VFNMADD231PS, VFNMADD132PD, VFNMADD213PD, VFNMADD231PD, VFNMADD132SS, VFNMADD213SS, VFNMADD231SS, VFNMADD132SD, VFNMADD213SD, VFNMADD231SD, VFNMSUB132PS, VFNMSUB213PS, VFNMSUB231PS, VFNMSUB132PD, VFNMSUB213PD, VFNMSUB231PD, VFNMSUB132SS, VFNMSUB213SS, VFNMSUB231SS, VFNMSUB132SD, VFNMSUB213SD, VFNMSUB231SD, VFMADDSUB132PS, VFMADDSUB213PS, VFMADDSUB231PS, VFMADDSUB132PD, VFMADDSUB213PD, VFMADDSUB231PD, VFMSUBADD132PS, VFMSUBADD213PS, VFMSUBADD231PS, VFMSUBADD132PD, VFMSUBADD213PD, VFMSUBADD231PD, VCVTPH2PS, VCVTPS2PH, // ------------------------------------------------------------------------- // SECTION: 4.23 AVX-512 Instructions // ------------------------------------------------------------------------- VMOVDQA32, VMOVDQA64, VMOVDQU8, VMOVDQU16, VMOVDQU32, VMOVDQU64, VPBLENDMB, VPBLENDMW, VPBLENDMD, VPBLENDMQ, VBLENDMPS, VBLENDMPD, VPCMPB, VPCMPUB, VPCMPW, VPCMPUW, VPCMPD, VPCMPUD, VPCMPQ, VPCMPUQ, VPTESTMB, VPTESTMW, VPTESTMD, VPTESTMQ, VPTESTNMB, VPTESTNMW, VPTESTNMD, VPTESTNMQ, VPCOMPRESSD, VPCOMPRESSQ, VCOMPRESSPS, VCOMPRESSPD, VPEXPANDD, VPEXPANDQ, VEXPANDPS, VEXPANDPD, VPCONFLICTD, VPCONFLICTQ, VPLZCNTD, VPLZCNTQ, VPERMI2B, VPERMI2W, VPERMI2D, VPERMI2Q, VPERMI2PS, VPERMI2PD, VPERMT2B, VPERMT2W, VPERMT2D, VPERMT2Q, VPERMT2PS, VPERMT2PD, VPERMB, VPERMW, VPMOVB2M, VPMOVW2M, VPMOVD2M, VPMOVQ2M, VPMOVM2B, VPMOVM2W, VPMOVM2D, VPMOVM2Q, VPMOVQB, VPMOVSQB, VPMOVUSQB, VPMOVQW, VPMOVSQW, VPMOVUSQW, VPMOVQD, VPMOVSQD, VPMOVUSQD, VPMOVDB, VPMOVSDB, VPMOVUSDB, VPMOVDW, VPMOVSDW, VPMOVUSDW, VPMOVWB, VPMOVSWB, VPMOVUSWB, VPROLD, VPROLQ, VPROLVD, VPROLVQ, VPRORD, VPRORQ, VPRORVD, VPRORVQ, VPSCATTERDD, VPSCATTERDQ, VPSCATTERQD, VPSCATTERQQ, VSCATTERDPS, VSCATTERDPD, VSCATTERQPS, VSCATTERQPD, VPSRAVQ, VPSRAVW, VPSLLVW, VPSRLVW, VRANGEPS, VRANGEPD, VRANGESS, VRANGESD, VREDUCEPS, VREDUCEPD, VREDUCESS, VREDUCESD, VRNDSCALEPS, VRNDSCALEPD, VRNDSCALESS, VRNDSCALESD, VRSQRT14PS, VRSQRT14PD, VRSQRT14SS, VRSQRT14SD, VRCP14PS, VRCP14PD, VRCP14SS, VRCP14SD, VSCALEFPS, VSCALEFPD, VSCALEFSS, VSCALEFSD, VGETEXPPS, VGETEXPPD, VGETEXPSS, VGETEXPSD, VGETMANTPS, VGETMANTPD, VGETMANTSS, VGETMANTSD, VFIXUPIMMPS, VFIXUPIMMPD, VFIXUPIMMSS, VFIXUPIMMSD, VFPCLASSPS, VFPCLASSPD, VFPCLASSSS, VFPCLASSSD, VALIGNQ, VALIGND, VDBPSADBW, VPTERNLOGD, VPTERNLOGQ, VPDPWSSD, VPMULTISHIFTQB, KADDW, KADDB, KADDQ, KADDD, KANDW, KANDB, KANDQ, KANDD, KANDNW, KANDNB, KANDNQ, KANDND, KMOVW, KMOVB, KMOVQ, KMOVD, KNOTW, KNOTB, KNOTQ, KNOTD, KORW, KORB, KORQ, KORD, KORTESTW, KORTESTB, KORTESTQ, KORTESTD, KSHIFTLW, KSHIFTLB, KSHIFTLQ, KSHIFTLD, KSHIFTRW, KSHIFTRB, KSHIFTRQ, KSHIFTRD, KTESTW, KTESTB, KTESTQ, KTESTD, KUNPCKBW, KUNPCKWD, KUNPCKDQ, KXNORW, KXNORB, KXNORQ, KXNORD, KXORW, KXORB, KXORQ, KXORD, // ------------------------------------------------------------------------- // SECTION: 4.24 x87 FPU Instructions // ------------------------------------------------------------------------- FADD, FADDP, FIADD, FSUB, FSUBP, FISUB, FSUBR, FSUBRP, FISUBR, FMUL, FMULP, FIMUL, FDIV, FDIVP, FIDIV, FDIVR, FDIVRP, FIDIVR, FSQRT, FABS, FCHS, FPREM, FPREM1, FRNDINT, FSCALE, FXTRACT, FXAM, FLD, FILD, FBLD, FST, FSTP, FIST, FISTP, FISTTP, FBSTP, FXCH, FCMOVB, FCMOVE, FCMOVBE, FCMOVU, FCMOVNB, FCMOVNE, FCMOVNBE, FCMOVNU, FCOM, FCOMP, FCOMPP, FICOM, FICOMP, FCOMI, FCOMIP, FUCOMI, FUCOMIP, FUCOM, FUCOMP, FUCOMPP, FTST, FLDZ, FLD1, FLDPI, FLDL2T, FLDL2E, FLDLG2, FLDLN2, FSIN, FCOS, FSINCOS, FPTAN, FPATAN, F2XM1, FYL2X, FYL2XP1, FINIT, FNINIT, FINCSTP, FDECSTP, FFREE, FFREEP, FNOP, FWAIT, FCLEX, FNCLEX, FSTCW, FNSTCW, FLDCW, FSTENV, FNSTENV, FLDENV, FSAVE, FNSAVE, FRSTOR, FSTSW, FNSTSW, FXSAVE, FXSAVE64, FXRSTOR, FXRSTOR64, // ------------------------------------------------------------------------- // SECTION: 4.25 System Instructions // ------------------------------------------------------------------------- LGDT, SGDT, LIDT, SIDT, LLDT, SLDT, LTR, STR, LMSW, SMSW, CLTS, ARPL, LAR, LSL, VERR, VERW, INVD, WBINVD, INVLPG, INVPCID, RSM, RDMSR, WRMSR, // ------------------------------------------------------------------------- // SECTION: 4.26 VMX Instructions // ------------------------------------------------------------------------- VMCALL, VMLAUNCH, VMRESUME, VMXOFF, VMXON, VMCLEAR, VMPTRLD, VMPTRST, VMREAD, VMWRITE, VMFUNC, INVEPT, INVVPID, // ------------------------------------------------------------------------- // SECTION: 4.27 Miscellaneous Extensions // ------------------------------------------------------------------------- ENCLS, ENCLU, ENCLV, RDPKRU, WRPKRU, INCSSPD, INCSSPQ, RDSSPD, RDSSPQ, SAVEPREVSSP, RSTORSSP, WRSSD, WRSSQ, WRUSSD, WRUSSQ, SETSSBSY, CLRSSBSY, ENDBR64, ENDBR32, XSAVE, XSAVE64, XRSTOR, XRSTOR64, XSAVEOPT, XSAVEOPT64, XSAVEC, XSAVEC64, XSAVES, XSAVES64, XRSTORS, XRSTORS64, PREFETCHT0, PREFETCHT1, PREFETCHT2, PREFETCHNTA, PREFETCHW, CLFLUSHOPT, CLWB, CLDEMOTE, BSWAP, CMPXCHG, CMPXCHG8B, CMPXCHG16B, XADD, BOUND, ENTER, LEAVE, XLAT, XLATB, MOVBE, RDRAND, RDSEED, // ------------------------------------------------------------------------- // SECTION: 4.28 Additional System / GPR Instructions // ------------------------------------------------------------------------- SWAPGS, MONITOR, MWAIT, CLAC, STAC, RDFSBASE, RDGSBASE, WRFSBASE, WRGSBASE, PTWRITE, RDPID, WBNOINVD, SERIALIZE, PREFETCH, IN, OUT, // ------------------------------------------------------------------------- // SECTION: 4.29 WAITPKG Instructions // ------------------------------------------------------------------------- TPAUSE, UMONITOR, UMWAIT, // ------------------------------------------------------------------------- // SECTION: 4.30 Direct Store / Enqueue Store Instructions // ------------------------------------------------------------------------- MOVDIRI, MOVDIR64B, ENQCMD, ENQCMDS, // ------------------------------------------------------------------------- // SECTION: 4.31 Remote Atomic Operations (RAO-INT) // ------------------------------------------------------------------------- AADD, AAND, AOR, AXOR, // ------------------------------------------------------------------------- // SECTION: 4.32 Restricted Transactional Memory (RTM) // ------------------------------------------------------------------------- XEND, XTEST, // ------------------------------------------------------------------------- // SECTION: 4.33 AMD SVM (Secure Virtual Machine) Instructions // ------------------------------------------------------------------------- VMRUN, VMMCALL, VMLOAD, VMSAVE, STGI, CLGI, SKINIT, INVLPGA, INVLPGB, TLBSYNC, // ------------------------------------------------------------------------- // SECTION: 4.34 AMD SEV-SNP Instructions // ------------------------------------------------------------------------- PVALIDATE, RMPADJUST, RMPUPDATE, PSMASH, // ------------------------------------------------------------------------- // SECTION: 4.35 AMD Miscellaneous Instructions // ------------------------------------------------------------------------- CLZERO, MONITORX, MWAITX, RDPRU, MCOMMIT, }
Related Procedures With Parameters
- canonical_mnemonic
- emit_i
- emit_m
- emit_mi
- emit_mr
- emit_mri
- emit_none
- emit_r
- emit_rel
- emit_rel_offset
- emit_ri
- emit_rm
- emit_rmi
- emit_rr
- emit_rri
- emit_rrm
- emit_rrr
- emit_rrrr
- inst_i
- inst_m
- inst_m_i
- inst_m_r
- inst_m_r_i
- inst_none
- inst_r
- inst_r_i
- inst_r_m
- inst_r_m_i
- inst_r_m_r
- inst_r_r
- inst_r_r_i
- inst_r_r_m
- inst_r_r_m_i
- inst_r_r_m_r
- inst_r_r_r
- inst_r_r_r_i
- inst_r_r_r_r
- inst_rel
- inst_rel_offset
- is_mnemonic_alias
- mnemonic_to_string
ModRM_Info ¶
Precomputed extraction of mod, reg, rm fields from a ModR/M byte.
Related Procedures With Parameters
Mode ¶
Mode :: enum u8 { _64, // long mode (x86-64), default _32, // protected mode (i386 / IA-32) _16, // real mode -- declared but not yet implemented; see comment above }
SECTION: 6.0b CPU mode ¶
x86 has two encoding modes this package fully handles: 64-bit long mode (the default) and 32-bit protected mode (i386 / IA-32). The mode is passed to encode/decode and gates a handful of divergent rules:
- Opcodes 0x40-0x4F are REX prefixes in _64, short-form INC/DEC in _32.
- ModRM.mod=00, rm=101 (no SIB) is [RIP+disp32] in _64, [disp32] in _32.
- Memory base/index registers are 64-bit in _64, 32-bit in _32.
- REX is illegal in _32; SPL/BPL/SIL/DIL and R8-R15 don't exist there.
- default_64 (PUSH/POP/CALL implicit 64-bit operand size) applies only in _64.
- 64-bit-only operand types (R64/RM64/IMM64) are unreachable in _32.
_16 (16-bit real mode) is declared so callers can refer to it
symbolically, but encode/decode panic if it is actually passed --
real-mode ModRM addressing uses a completely different model
([BX+SI], [BP+DI], [SI], etc., no SIB byte, 16-bit
displacements) and needs a separate addressing path. Adding it later:
- Implement a 16-bit ModRM decode table parallel to MODRM_TABLE.
- Branch in decode_memory_operand on state.mode == ._16 to use it.
- Mirror in the encoder (separate ModRM/SIB emission path).
- Reject any 32-bit or 64-bit operand-type matches in ._16.
- Add a default_16 / mode_16_only flag mirror of default_64 / mode_32_only for the few opcodes that exist only in real mode.
Related Procedures With Parameters
Operand ¶
Operand :: struct #packed { using _: struct #raw_union { reg: Register, // for Register kind mem: Memory, // for Memory kind (packed) immediate: i64, // for Immediate kind relative: i64, }, kind: Operand_Kind, size: u8, // operand size in bytes (1, 2, 4, 8, 16, 32, 64) flags: Operand_Flags, }
The unified Operand type
Related Procedures With Parameters
Related Procedures With Returns
- decode_implicit_operand
- decode_memory_operand
- decode_single_operand
- decode_single_operand_vex
- op_bnd
- op_creg
- op_dreg
- op_gpr16
- op_gpr32
- op_gpr64
- op_gpr8
- op_gpr8h
- op_imm
- op_imm16
- op_imm32
- op_imm64
- op_imm8
- op_imm_label
- op_kreg
- op_label
- op_mem
- op_mem_from_parts
- op_mm
- op_reg
- op_rel32
- op_rel8
- op_sreg
- op_st
- op_xmm
- op_ymm
- op_zmm
Operand_Encoding ¶
Operand_Encoding :: enum u8 { NONE, // ModR/M based MR, // operand in ModR/M r/m field (register or memory) REG, // operand in ModR/M reg field // VEX/EVEX specific VVVV, // operand in VEX.vvvv // Opcode-embedded OP_R, // register encoded in low 3 bits of opcode (+rb, +rw, +rd, +ro) // Immediate IB, // immediate byte following instruction IW, // immediate word following instruction ID, // immediate dword following instruction IQ, // immediate qword following instruction // Implicit IMPL, // implicit operand (not encoded) // Special IS4, // high 4 bits of 8-bit immediate (for some AVX) // EVEX AAA, // opmask in EVEX.aaa }
Related Procedures With Parameters
Operand_Kind ¶
Operand_Kind :: enum u8 { NONE, REGISTER, MEMORY, IMMEDIATE, RELATIVE, // PC-relative target (label or raw offset) }
Operand_Type ¶
Operand_Type :: enum u8 { NONE, // GPR by size R8, // 8-bit register R16, // 16-bit register R32, // 32-bit register R64, // 64-bit register // GPR or memory RM8, // r/m8 RM16, // r/m16 RM32, // r/m32 RM64, // r/m64 // Memory only (for LEA, etc.) M, // any memory M8, // memory 8-bit M16, // memory 16-bit M32, // memory 32-bit M64, // memory 64-bit M80, // memory 80-bit (x87) M128, // memory 128-bit M256, // memory 256-bit M512, // memory 512-bit // Immediates IMM8, // 8-bit immediate IMM16, // 16-bit immediate IMM32, // 32-bit immediate IMM64, // 64-bit immediate (only for MOV r64, imm64) // Sign-extended immediates IMM8SX, // 8-bit sign-extended to operand size // Relative offsets REL8, // 8-bit relative REL32, // 32-bit relative // Fixed registers (implicit) AL_IMPL, // implicit AL AX_IMPL, // implicit AX EAX_IMPL, // implicit EAX RAX_IMPL, // implicit RAX CL_IMPL, // implicit CL (for shifts) DX_IMPL, // implicit DX (for IN/OUT) ONE_IMPL, // implicit 1 (for shifts) // Segment registers SREG, // segment register // Control/debug registers CR, // control register DR, // debug register // Vector registers XMM, // XMM register YMM, // YMM register ZMM, // ZMM register // Vector register or memory XMM_M32, // xmm or m32 XMM_M64, // xmm or m64 XMM_M128, // xmm or m128 YMM_M256, // ymm or m256 ZMM_M512, // zmm or m512 // MMX MM, // MMX register MM_M64, // MMX or m64 // x87 FPU ST0_IMPL, // implicit ST(0) STI, // ST(i) register // Implicit XMM0 (for BLENDV, SHA256RNDS2) XMM0_IMPL, // implicit XMM0 // Opmask K, // opmask register K_M8, // opmask or m8 K_M16, // opmask or m16 K_M32, // opmask or m32 K_M64, // opmask or m64 // Special MOFFS8, // memory offset 8-bit (MOV AL, moffs) MOFFS16, // memory offset 16-bit MOFFS32, // memory offset 32-bit MOFFS64, // memory offset 64-bit // Far pointers PTR16_16, // 16:16 far pointer PTR16_32, // 16:32 far pointer PTR16_64, // 16:64 far pointer M16_16, // memory 16:16 M16_32, // memory 16:32 M16_64, // memory 16:64 }
Operand type descriptors for instruction definitions
Related Procedures With Parameters
Print_Options ¶
Print_Options :: rexcode_isa.Print_Options
Related Procedures With Parameters
Related Constants
Print_Result ¶
Print_Result :: rexcode_isa.Print_Result
Register ¶
Register :: distinct u16
Register encoding: 0b_0000_CCCC_EEEN_NNNN NNNNN = hardware register number (0-31) E = needs REX/VEX .B/.R/.X extension (hw num >= 8) EE = needs EVEX for regs 16-31 CCCC = register class
Related Procedures With Parameters
- emit_mr
- emit_mri
- emit_r
- emit_ri
- emit_rm
- emit_rmi
- emit_rr
- emit_rri
- emit_rrm
- emit_rrr
- emit_rrrr
- inst_m_r
- inst_m_r_i
- inst_r
- inst_r_i
- inst_r_m
- inst_r_m_i
- inst_r_m_r
- inst_r_r
- inst_r_r_i
- inst_r_r_m
- inst_r_r_m_i
- inst_r_r_m_r
- inst_r_r_r
- inst_r_r_r_i
- inst_r_r_r_r
- mem_base_disp
- mem_base_index
- mem_base_index_disp
- mem_base_only
- mem_make
- op_mem_from_parts
- op_reg
- reg_class
- reg_hw
- reg_is_gpr
- reg_is_high_byte
- reg_is_vector
- reg_needs_evex
- reg_needs_rex
- reg_needs_rex_ext
- reg_size
- register_name
Related Procedures With Returns
Related Constants
- AH
- AL
- AX
- BH
- BL
- BND0
- BND1
- BND2
- BND3
- BP
- BPL
- BX
- CH
- CL
- CR0
- CR2
- CR3
- CR4
- CR8
- CS
- CX
- DH
- DI
- DIL
- DL
- DR0
- DR1
- DR2
- DR3
- DR6
- DR7
- DS
- DX
- EAX
- EBP
- EBX
- ECX
- EDI
- EDX
- ES
- ESI
- ESP
- FS
- GS
- K0
- K1
- K2
- K3
- K4
- K5
- K6
- K7
- MM0
- MM1
- MM2
- MM3
- MM4
- MM5
- MM6
- MM7
- NONE
- R10
- R10B
- R10D
- R10W
- R11
- R11B
- R11D
- R11W
- R12
- R12B
- R12D
- R12W
- R13
- R13B
- R13D
- R13W
- R14
- R14B
- R14D
- R14W
- R15
- R15B
- R15D
- R15W
- R8
- R8B
- R8D
- R8W
- R9
- R9B
- R9D
- R9W
- RAX
- RBP
- RBX
- RCX
- RDI
- RDX
- RIP
- RSI
- RSP
- SI
- SIL
- SP
- SPL
- SS
- ST0
- ST1
- ST2
- ST3
- ST4
- ST5
- ST6
- ST7
- XMM0
- XMM1
- XMM10
- XMM11
- XMM12
- XMM13
- XMM14
- XMM15
- XMM16
- XMM17
- XMM18
- XMM19
- XMM2
- XMM20
- XMM21
- XMM22
- XMM23
- XMM24
- XMM25
- XMM26
- XMM27
- XMM28
- XMM29
- XMM3
- XMM30
- XMM31
- XMM4
- XMM5
- XMM6
- XMM7
- XMM8
- XMM9
- YMM0
- YMM1
- YMM10
- YMM11
- YMM12
- YMM13
- YMM14
- YMM15
- YMM16
- YMM17
- YMM18
- YMM19
- YMM2
- YMM20
- YMM21
- YMM22
- YMM23
- YMM24
- YMM25
- YMM26
- YMM27
- YMM28
- YMM29
- YMM3
- YMM30
- YMM31
- YMM4
- YMM5
- YMM6
- YMM7
- YMM8
- YMM9
- ZMM0
- ZMM1
- ZMM10
- ZMM11
- ZMM12
- ZMM13
- ZMM14
- ZMM15
- ZMM16
- ZMM17
- ZMM18
- ZMM19
- ZMM2
- ZMM20
- ZMM21
- ZMM22
- ZMM23
- ZMM24
- ZMM25
- ZMM26
- ZMM27
- ZMM28
- ZMM29
- ZMM3
- ZMM30
- ZMM31
- ZMM4
- ZMM5
- ZMM6
- ZMM7
- ZMM8
- ZMM9
Relocation_Type ¶
Relocation_Type :: enum u8 { NONE = 0, REL8, // 8-bit PC-relative (short jump) REL32, // 32-bit PC-relative (call, jmp, RIP-relative) ABS32, // 32-bit absolute address ABS64, // 64-bit absolute address (movabs) }
SIB_Info ¶
Precomputed extraction of scale, index, base fields from a SIB byte.
Related Procedures With Parameters
SREG ¶
SREG :: enum u8 { ES, CS, SS, DS, FS, GS, }
Related Procedures With Parameters
- emit_mov_m16_sreg
- emit_mov_m64_sreg
- emit_mov_r16_sreg
- emit_mov_r64_sreg
- emit_mov_sreg_m16
- emit_mov_sreg_m64
- emit_mov_sreg_r16
- emit_mov_sreg_r64
- emit_pop_sreg
- emit_push_sreg
- inst_mov_m16_sreg
- inst_mov_m64_sreg
- inst_mov_r16_sreg
- inst_mov_r64_sreg
- inst_mov_sreg_m16
- inst_mov_sreg_m64
- inst_mov_sreg_r16
- inst_mov_sreg_r64
- inst_pop_sreg
- inst_push_sreg
- op_sreg
- emit_mov (procedure groups)
- emit_pop (procedure groups)
- emit_push (procedure groups)
- inst_mov (procedure groups)
- inst_pop (procedure groups)
- inst_push (procedure groups)
Side_Effect ¶
Side_Effect :: enum u8 { FENCE, // memory-ordering barrier (LFENCE/SFENCE/MFENCE, LOCK) SERIALIZING, // architecturally serializing (drains pipeline) HINT, // microarchitectural hint, architecturally inert (PAUSE/PREFETCH*/ENDBR) CACHE, // cache-line maintenance with coherence effects (CLFLUSH/CLWB) TRAP, // may deliberately raise a fault (#UD/#BR): UD0-2, BOUND INTERRUPT, // software interrupt / syscall gate HALT, // stops execution until an external event PRIVILEGED, // requires CPL0 / reads-writes supervisor machine state CONTROL, // alters control flow (writes RIP): branches, calls, returns CET, // control-flow-enforcement: landing pads, shadow-stack ops NONDETERMINISTIC, }
Side_Effects ¶
Side_Effects :: distinct bit_set[Side_Effect; u16]
Token_Kind ¶
Token_Kind :: rexcode_isa.Token_Kind
VEX_Decode_Entry ¶
VEX_Decode_Entry :: struct { esc: Escape, prefix: u8, opcode: u8, ext: u8, vex_w: VEX_W, vex_l: VEX_L, mnemonic: Mnemonic, ops: [4]Operand_Type, enc: [4]Operand_Encoding, flags: Encoding_Flags, }
Related Procedures With Returns
VEX_L ¶
VEX_L :: enum u8 { LIG, // L ignored L0, // L = 0 (128-bit / scalar) L1, // L = 1 (256-bit) L2, // L = 2 (512-bit, EVEX only) }
VEX.L / EVEX.L'L field
VEX_Type ¶
VEX_Type :: enum u8 { NONE, // legacy encoding VEX, // VEX prefix (AVX) EVEX, // EVEX prefix (AVX-512) XOP, // XOP prefix (AMD) }
XMM ¶
XMM :: enum u8 { XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM16, XMM17, XMM18, XMM19, XMM20, XMM21, XMM22, XMM23, XMM24, XMM25, XMM26, XMM27, XMM28, XMM29, XMM30, XMM31, }
YMM ¶
YMM :: enum u8 { YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15, YMM16, YMM17, YMM18, YMM19, YMM20, YMM21, YMM22, YMM23, YMM24, YMM25, YMM26, YMM27, YMM28, YMM29, YMM30, YMM31, }
ZMM ¶
ZMM :: enum u8 { ZMM0, ZMM1, ZMM2, ZMM3, ZMM4, ZMM5, ZMM6, ZMM7, ZMM8, ZMM9, ZMM10, ZMM11, ZMM12, ZMM13, ZMM14, ZMM15, ZMM16, ZMM17, ZMM18, ZMM19, ZMM20, ZMM21, ZMM22, ZMM23, ZMM24, ZMM25, ZMM26, ZMM27, ZMM28, ZMM29, ZMM30, ZMM31, }
Constants
One row per constant, under the prefix it shares with others.
| AH | :: Register(REG_GPR8H | 4)GPR 8-bit (high) - no REX allowed with these |
| AL | :: Register(REG_GPR8 | 0)GPR 8-bit (low) |
| AX | :: Register(REG_GPR16 | 0)GPR 16-bit |
| BH | :: Register(REG_GPR8H | 7) |
| BL | :: Register(REG_GPR8 | 3) |
| BND0 | :: Register(REG_BND | 0)Bound registers (MPX) |
| BND1 | :: Register(REG_BND | 1) |
| BND2 | :: Register(REG_BND | 2) |
| BND3 | :: Register(REG_BND | 3) |
| BP | :: Register(REG_GPR16 | 5) |
| BPL | :: Register(REG_GPR8 | 5) |
| BUILDER_TABLE_FINGERPRINT | :: u64(0x0d50f58e8a92e578)The ENCODE_RUNS layout these hints were generated against — see the note in the generator. |
| BX | :: Register(REG_GPR16 | 3) |
| CH | :: Register(REG_GPR8H | 5) |
| CL | :: Register(REG_GPR8 | 1) |
| CR0 | :: Register(REG_CR | 0)Control registers |
| CR2 | :: Register(REG_CR | 2) |
| CR3 | :: Register(REG_CR | 3) |
| CR4 | :: Register(REG_CR | 4) |
| CR8 | :: Register(REG_CR | 8) |
| CS | :: Register(REG_SEG | 1) |
| CX | :: Register(REG_GPR16 | 1) |
| DEFAULT_PRINT_OPTIONS | : rexcode_isa.Print_Options : isa.DEFAULT_PRINT_OPTIONS |
| DH | :: Register(REG_GPR8H | 6) |
| DI | :: Register(REG_GPR16 | 7) |
| DIL | :: Register(REG_GPR8 | 7) |
| DL | :: Register(REG_GPR8 | 2) |
| DR0 | :: Register(REG_DR | 0)Debug registers |
| DR1 | :: Register(REG_DR | 1) |
| DR2 | :: Register(REG_DR | 2) |
| DR3 | :: Register(REG_DR | 3) |
| DR6 | :: Register(REG_DR | 6) |
| DR7 | :: Register(REG_DR | 7) |
| DS | :: Register(REG_SEG | 3) |
| DX | :: Register(REG_GPR16 | 2) |
| EAX | :: Register(REG_GPR32 | 0)GPR 32-bit |
| EBP | :: Register(REG_GPR32 | 5) |
| EBX | :: Register(REG_GPR32 | 3) |
| ECX | :: Register(REG_GPR32 | 1) |
| EDI | :: Register(REG_GPR32 | 7) |
| EDX | :: Register(REG_GPR32 | 2) |
| ENC_HINT_NONE | :: u16(0)Pre-matched encoding hint: a typed builder that maps to exactly one encoding form (no value-dependent immediate selection) stores global_form_index + 1 in…Pre-matched encoding hint: a typed builder that maps to exactly one encoding
form (no value-dependent immediate selection) stores |
| ES | :: Register(REG_SEG | 0)Segment registers |
| ESI | :: Register(REG_GPR32 | 6) |
| ESP | :: Register(REG_GPR32 | 4) |
| FS | :: Register(REG_SEG | 4) |
| GS | :: Register(REG_SEG | 5) |
| K0 | :: Register(REG_K | 0)Opmask registers |
| K1 | :: Register(REG_K | 1) |
| K2 | :: Register(REG_K | 2) |
| K3 | :: Register(REG_K | 3) |
| K4 | :: Register(REG_K | 4) |
| K5 | :: Register(REG_K | 5) |
| K6 | :: Register(REG_K | 6) |
| K7 | :: Register(REG_K | 7) |
| LABEL_UNDEFINED | : rexcode_isa.Label_Definition : isa.LABEL_UNDEFINED |
| MAX_INST_SIZE | :: 15Maximum x64 instruction length |
| MEM_… 3 | |
|---|---|
| MEM_BASE_NONE | :: 31 |
| MEM_BASE_RIP | :: 30 |
| MEM_INDEX_NONE | :: 31 |
| MM0 | :: Register(REG_MM | 0)MMX registers |
| MM1 | :: Register(REG_MM | 1) |
| MM2 | :: Register(REG_MM | 2) |
| MM3 | :: Register(REG_MM | 3) |
| MM4 | :: Register(REG_MM | 4) |
| MM5 | :: Register(REG_MM | 5) |
| MM6 | :: Register(REG_MM | 6) |
| MM7 | :: Register(REG_MM | 7) |
| NONE | :: Register(0xFFFF)Sentinel |
| PREFIX_… 3 | |
| PREFIX_66 | :: 1Prefix byte constants |
| PREFIX_F2 | :: 3 |
| PREFIX_F3 | :: 2 |
| R10 | :: Register(REG_GPR64 | 10) |
| R10B | :: Register(REG_GPR8 | 10) |
| R10D | :: Register(REG_GPR32 | 10) |
| R10W | :: Register(REG_GPR16 | 10) |
| R11 | :: Register(REG_GPR64 | 11) |
| R11B | :: Register(REG_GPR8 | 11) |
| R11D | :: Register(REG_GPR32 | 11) |
| R11W | :: Register(REG_GPR16 | 11) |
| R12 | :: Register(REG_GPR64 | 12) |
| R12B | :: Register(REG_GPR8 | 12) |
| R12D | :: Register(REG_GPR32 | 12) |
| R12W | :: Register(REG_GPR16 | 12) |
| R13 | :: Register(REG_GPR64 | 13) |
| R13B | :: Register(REG_GPR8 | 13) |
| R13D | :: Register(REG_GPR32 | 13) |
| R13W | :: Register(REG_GPR16 | 13) |
| R14 | :: Register(REG_GPR64 | 14) |
| R14B | :: Register(REG_GPR8 | 14) |
| R14D | :: Register(REG_GPR32 | 14) |
| R14W | :: Register(REG_GPR16 | 14) |
| R15 | :: Register(REG_GPR64 | 15) |
| R15B | :: Register(REG_GPR8 | 15) |
| R15D | :: Register(REG_GPR32 | 15) |
| R15W | :: Register(REG_GPR16 | 15) |
| R8 | :: Register(REG_GPR64 | 8) |
| R8B | :: Register(REG_GPR8 | 8) |
| R8D | :: Register(REG_GPR32 | 8) |
| R8W | :: Register(REG_GPR16 | 8) |
| R9 | :: Register(REG_GPR64 | 9) |
| R9B | :: Register(REG_GPR8 | 9) |
| R9D | :: Register(REG_GPR32 | 9) |
| R9W | :: Register(REG_GPR16 | 9) |
| RAX | :: Register(REG_GPR64 | 0)GPR 64-bit |
| RBP | :: Register(REG_GPR64 | 5) |
| RBX | :: Register(REG_GPR64 | 3) |
| RCX | :: Register(REG_GPR64 | 1) |
| RDI | :: Register(REG_GPR64 | 7) |
| RDX | :: Register(REG_GPR64 | 2) |
| REG_… 16 | |
| REG_BND | :: 0xD00bound |
| REG_CR | :: 0xB00control |
| REG_DR | :: 0xC00debug |
| REG_GPR16 | :: 0x300 |
| REG_GPR32 | :: 0x200 |
| REG_GPR64 | :: 0x100 |
| REG_GPR8 | :: 0x400 |
| REG_GPR8H | :: 0x500AH, CH, DH, BH - legacy high byte regs |
| REG_K | :: 0x900opmask |
| REG_MM | :: 0xE00MMX |
| REG_NONE | :: 0x000Register classes (upper byte) |
| REG_SEG | :: 0xA00segment |
| REG_ST | :: 0xF00x87 FPU |
| REG_XMM | :: 0x600 |
| REG_YMM | :: 0x700 |
| REG_ZMM | :: 0x800 |
| RIP | :: Register(0xFFFE)Special: RIP for RIP-relative addressing |
| RSI | :: Register(REG_GPR64 | 6) |
| RSP | :: Register(REG_GPR64 | 4) |
| SI | :: Register(REG_GPR16 | 6) |
| SIL | :: Register(REG_GPR8 | 6) |
| SP | :: Register(REG_GPR16 | 4) |
| SPL | :: Register(REG_GPR8 | 4) |
| SS | :: Register(REG_SEG | 2) |
| ST0 | :: Register(REG_ST | 0)x87 FPU registers |
| ST1 | :: Register(REG_ST | 1) |
| ST2 | :: Register(REG_ST | 2) |
| ST3 | :: Register(REG_ST | 3) |
| ST4 | :: Register(REG_ST | 4) |
| ST5 | :: Register(REG_ST | 5) |
| ST6 | :: Register(REG_ST | 6) |
| ST7 | :: Register(REG_ST | 7) |
| XMM0 | :: Register(REG_XMM | 0)XMM (0-31) |
| XMM1 | :: Register(REG_XMM | 1) |
| XMM10 | :: Register(REG_XMM | 10) |
| XMM11 | :: Register(REG_XMM | 11) |
| XMM12 | :: Register(REG_XMM | 12) |
| XMM13 | :: Register(REG_XMM | 13) |
| XMM14 | :: Register(REG_XMM | 14) |
| XMM15 | :: Register(REG_XMM | 15) |
| XMM16 | :: Register(REG_XMM | 16) |
| XMM17 | :: Register(REG_XMM | 17) |
| XMM18 | :: Register(REG_XMM | 18) |
| XMM19 | :: Register(REG_XMM | 19) |
| XMM2 | :: Register(REG_XMM | 2) |
| XMM20 | :: Register(REG_XMM | 20) |
| XMM21 | :: Register(REG_XMM | 21) |
| XMM22 | :: Register(REG_XMM | 22) |
| XMM23 | :: Register(REG_XMM | 23) |
| XMM24 | :: Register(REG_XMM | 24) |
| XMM25 | :: Register(REG_XMM | 25) |
| XMM26 | :: Register(REG_XMM | 26) |
| XMM27 | :: Register(REG_XMM | 27) |
| XMM28 | :: Register(REG_XMM | 28) |
| XMM29 | :: Register(REG_XMM | 29) |
| XMM3 | :: Register(REG_XMM | 3) |
| XMM30 | :: Register(REG_XMM | 30) |
| XMM31 | :: Register(REG_XMM | 31) |
| XMM4 | :: Register(REG_XMM | 4) |
| XMM5 | :: Register(REG_XMM | 5) |
| XMM6 | :: Register(REG_XMM | 6) |
| XMM7 | :: Register(REG_XMM | 7) |
| XMM8 | :: Register(REG_XMM | 8) |
| XMM9 | :: Register(REG_XMM | 9) |
| YMM0 | :: Register(REG_YMM | 0)YMM (0-31) |
| YMM1 | :: Register(REG_YMM | 1) |
| YMM10 | :: Register(REG_YMM | 10) |
| YMM11 | :: Register(REG_YMM | 11) |
| YMM12 | :: Register(REG_YMM | 12) |
| YMM13 | :: Register(REG_YMM | 13) |
| YMM14 | :: Register(REG_YMM | 14) |
| YMM15 | :: Register(REG_YMM | 15) |
| YMM16 | :: Register(REG_YMM | 16) |
| YMM17 | :: Register(REG_YMM | 17) |
| YMM18 | :: Register(REG_YMM | 18) |
| YMM19 | :: Register(REG_YMM | 19) |
| YMM2 | :: Register(REG_YMM | 2) |
| YMM20 | :: Register(REG_YMM | 20) |
| YMM21 | :: Register(REG_YMM | 21) |
| YMM22 | :: Register(REG_YMM | 22) |
| YMM23 | :: Register(REG_YMM | 23) |
| YMM24 | :: Register(REG_YMM | 24) |
| YMM25 | :: Register(REG_YMM | 25) |
| YMM26 | :: Register(REG_YMM | 26) |
| YMM27 | :: Register(REG_YMM | 27) |
| YMM28 | :: Register(REG_YMM | 28) |
| YMM29 | :: Register(REG_YMM | 29) |
| YMM3 | :: Register(REG_YMM | 3) |
| YMM30 | :: Register(REG_YMM | 30) |
| YMM31 | :: Register(REG_YMM | 31) |
| YMM4 | :: Register(REG_YMM | 4) |
| YMM5 | :: Register(REG_YMM | 5) |
| YMM6 | :: Register(REG_YMM | 6) |
| YMM7 | :: Register(REG_YMM | 7) |
| YMM8 | :: Register(REG_YMM | 8) |
| YMM9 | :: Register(REG_YMM | 9) |
| ZMM0 | :: Register(REG_ZMM | 0)ZMM (0-31) |
| ZMM1 | :: Register(REG_ZMM | 1) |
| ZMM10 | :: Register(REG_ZMM | 10) |
| ZMM11 | :: Register(REG_ZMM | 11) |
| ZMM12 | :: Register(REG_ZMM | 12) |
| ZMM13 | :: Register(REG_ZMM | 13) |
| ZMM14 | :: Register(REG_ZMM | 14) |
| ZMM15 | :: Register(REG_ZMM | 15) |
| ZMM16 | :: Register(REG_ZMM | 16) |
| ZMM17 | :: Register(REG_ZMM | 17) |
| ZMM18 | :: Register(REG_ZMM | 18) |
| ZMM19 | :: Register(REG_ZMM | 19) |
| ZMM2 | :: Register(REG_ZMM | 2) |
| ZMM20 | :: Register(REG_ZMM | 20) |
| ZMM21 | :: Register(REG_ZMM | 21) |
| ZMM22 | :: Register(REG_ZMM | 22) |
| ZMM23 | :: Register(REG_ZMM | 23) |
| ZMM24 | :: Register(REG_ZMM | 24) |
| ZMM25 | :: Register(REG_ZMM | 25) |
| ZMM26 | :: Register(REG_ZMM | 26) |
| ZMM27 | :: Register(REG_ZMM | 27) |
| ZMM28 | :: Register(REG_ZMM | 28) |
| ZMM29 | :: Register(REG_ZMM | 29) |
| ZMM3 | :: Register(REG_ZMM | 3) |
| ZMM30 | :: Register(REG_ZMM | 30) |
| ZMM31 | :: Register(REG_ZMM | 31) |
| ZMM4 | :: Register(REG_ZMM | 4) |
| ZMM5 | :: Register(REG_ZMM | 5) |
| ZMM6 | :: Register(REG_ZMM | 6) |
| ZMM7 | :: Register(REG_ZMM | 7) |
| ZMM8 | :: Register(REG_ZMM | 8) |
| ZMM9 | :: Register(REG_ZMM | 9) |
Variables
CLOBBER_FORMS ¶
@(rodata) CLOBBER_FORMS: []Clobber = …
DECODE_INDEX_ESC_0F ¶
@(rodata) DECODE_INDEX_ESC_0F: []Decode_Index = …
DECODE_INDEX_ESC_0F38 ¶
@(rodata) DECODE_INDEX_ESC_0F38: []Decode_Index = …
DECODE_INDEX_ESC_0F3A ¶
@(rodata) DECODE_INDEX_ESC_0F3A: []Decode_Index = …
DECODE_INDEX_LEGACY ¶
@(rodata) DECODE_INDEX_LEGACY: []Decode_Index = …
ENCODE_FORMS ¶
@(rodata) ENCODE_FORMS: []Encoding = …
ENCODE_RECIPES ¶
@(rodata) ENCODE_RECIPES: []Form_Recipe = …
ENCODE_RUNS ¶
@(rodata) ENCODE_RUNS: []Encode_Run = …
EVEX_DECODE_ENTRIES ¶
@(rodata) EVEX_DECODE_ENTRIES: []VEX_Decode_Entry = …
EVEX_INDEX_0F ¶
@(rodata) EVEX_INDEX_0F: []Decode_Index = …
EVEX_INDEX_0F38 ¶
@(rodata) EVEX_INDEX_0F38: []Decode_Index = …
EVEX_INDEX_0F3A ¶
@(rodata) EVEX_INDEX_0F3A: []Decode_Index = …
LEGACY_DECODE_ENTRIES ¶
@(rodata) LEGACY_DECODE_ENTRIES: []Decode_Entry = …
MNEMONIC_ALIASES ¶
@(rodata) MNEMONIC_ALIASES: [57]Mnemonic_Alias = …
MODRM_TABLE ¶
@(rodata) MODRM_TABLE: []ModRM_Info = …
PREFIX_SEGMENT_TABLE ¶
@(rodata) PREFIX_SEGMENT_TABLE: [6]Register = …
Segment register lookup for prefix types 4-9
SIB_TABLE ¶
@(rodata) SIB_TABLE: []SIB_Info = …
VEX_DECODE_ENTRIES ¶
@(rodata) VEX_DECODE_ENTRIES: []VEX_Decode_Entry = …
VEX_INDEX_0F ¶
@(rodata) VEX_INDEX_0F: []Decode_Index = …
VEX_INDEX_0F38 ¶
@(rodata) VEX_INDEX_0F38: []Decode_Index = …
VEX_INDEX_0F3A ¶
@(rodata) VEX_INDEX_0F3A: []Decode_Index = …
Procedures
One row per procedure, under the procedure groups they belong to; each is a proc "contextless" unless it says otherwise.
Procedure Groups
Listed with their procedures under Procedures.
Source Files
- aliases.odin
- clobber_types.odin
- decoder.odin
- encoder.odin
- encoder_match.odin
- encoder_recipe.odin
- encoding_types.odin
- instructions.odin
- labels.odin
- mnemonic_builders.odin
- mnemonics.odin
- operands.odin
- printer.odin
- registers.odin
- reloc.odin
- tables.odin
Generation Information
Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-10 00:25:51.511820200 +0000 UTC