Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Emit(opcodes):
- if type(opcodes) != list and type(opcodes) != tuple:
- return None
- raw = ""
- for op in opcodes:
- raw+=hex(op)[2:]+" "
- return raw
- def encode_MISc2():
- # VEX.128.66.0F.WIG F7 /r VMASKMOVDQU xmm1, xmm2
- # ModRM:reg (r) ModRM:r/m (r)
- # EVEX.512.F3.0F.W0 7F /r VMOVDQU32 zmm2/m512 {k1}{z}, zmm1
- # ModRM:r/m (w) ModRM:reg (r)
- # EVEX.128.F3.0F.W1 6F /r VMOVDQU64 xmm1 {k1}{z}, xmm2/m128
- # ModRM:reg (w) ModRM:r/m (r)
- # EVEX.256.66.0F.W0 78 /r VCVTTPS2UQQ ymm1 {k1}{z}, xmm2/m128/m32bcst
- # ModRM:reg (w) ModRM:r/m (r)
- # EVEX.512.66.0F3A.W0 56 /r ib VREDUCEPS zmm1 {k1}{z}, zmm2/m512/m32bcst{sae}, imm8
- # ModRM:reg (w) ModRM:r/m (r) Imm8
- insn1 = "VMASKMOVDQU xmm0, xmm12"
- insn2 = "VMOVDQU32 ZMMWORD PTR fs:[r8d+edi*4+0x3604] {k3}, zmm24"
- insn3 = "VMOVDQU64 xmm29 {k7}{z},XMMWORD PTR gs:[rdx*2]"
- insn4 = "VCVTTPS2UQQ ymm1 {k1}{z},dword ptr [ebx+0x36] {1to4}"
- insn5 = "VREDUCEPS zmm0,{k4}{z},zmm20,{sae},0x0c"
- pfRzAddr = 0x67
- pfOvFs = 0x64
- pfOvGs = 0x65
- vex2 = 0b11000100_110_00001_0_1111_0_01
- evex1 = 0b01100010_010_0_00_01_0_1111_1_10_0_10_0_1_011
- evex2 = 0b01100010_011_0_00_01_1_1111_1_10_1_00_0_1_111
- evex3 = 0b01100010_111_1_00_01_0_1111_1_01_1_01_1_1_001
- evex4 = 0b01100010_101_1_00_11_0_1111_1_01_1_10_1_1_100
- opcode1 = 0xF7
- opcode2 = 0x7F
- opcode3 = 0x6F
- opcode4 = 0x78
- opcode5 = 0x56
- modrm1 = 0b11_000_100
- modrm2 = 0b10_000_100
- sib2 = 0b10_111_000
- disp32_2 = 0x04360000
- modrm3 = 0b00_101_100
- sib3 = 0b01_010_101
- disp32_3 = "00 00 00 00"
- modrm4 = 0b10_001_011
- disp32_4 = 0x36000000
- modrm5 = 0b11_000_100
- imm8_5 = 0x0c
- opcodes1 = [vex2,opcode1,modrm1]
- opcodes2 = [pfRzAddr,pfOvFs,evex1,opcode2,modrm2,sib2,disp32_2]
- opcodes3 = [pfOvGs,evex2,opcode3,modrm3,sib3]
- opcodes4 = [pfRzAddr,evex3,opcode4,modrm4,disp32_4]
- opcodes5 = [evex4,opcode5,modrm5,imm8_5]
- x86insn1 = Emit(opcodes1)
- x86insn2 = Emit(opcodes2)
- x86insn3 = Emit(opcodes3) + disp32_3
- x86insn4 = Emit(opcodes4)
- x86insn5 = Emit(opcodes5)
- print(x86insn1,insn1)
- print(x86insn2,insn2)
- print(x86insn3,insn3)
- print(x86insn4,insn4)
- print(x86insn5,insn5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement