├── .gitattributes ├── .gitignore ├── Common └── UnivDisasm │ ├── Config.inc │ ├── EFLAGS_TABLE.inc │ ├── Home.txt │ ├── Includes │ ├── 3DNOW.inc │ ├── ADX.inc │ ├── AES.inc │ ├── AVX.inc │ ├── AVX2-VSIB.inc │ ├── AVX2.inc │ ├── AVX512BW-VL.inc │ ├── AVX512BW.inc │ ├── AVX512CD-VL.inc │ ├── AVX512DQ-VL.inc │ ├── AVX512DQ.inc │ ├── AVX512ER.inc │ ├── AVX512F-VL-VSIB.inc │ ├── AVX512F-VL.inc │ ├── AVX512F.inc │ ├── AVX512IFMA-VL.inc │ ├── AVX512PF-VSIB.inc │ ├── AVX512VBMI-VL.inc │ ├── BMI.inc │ ├── BMI2.inc │ ├── CommonDecoders.inc │ ├── F16C.inc │ ├── FMA.inc │ ├── FMA4.inc │ ├── FPU.inc │ ├── Format.bat │ ├── GP.inc │ ├── GROUPS.dec.inc │ ├── GROUPS.inc │ ├── ICEBP.inc │ ├── INSX.inc │ ├── INVPCID.inc │ ├── LWP.inc │ ├── MEM-SSE.inc │ ├── MEM-SSE2.inc │ ├── MMX-SSE.inc │ ├── MMX-SSE2.inc │ ├── MMX-SSSE3.inc │ ├── MMX.inc │ ├── MPX.inc │ ├── OpCodes.dec.inc │ ├── OpCodes.inc │ ├── OpCodes.tables.inc │ ├── PCLMUL.inc │ ├── SHA.inc │ ├── SMM.inc │ ├── SSE.inc │ ├── SSE2.inc │ ├── SSE3.inc │ ├── SSE4A.inc │ ├── SSE4V1-SSE5A.inc │ ├── SSE4V1.inc │ ├── SSE4V2.inc │ ├── SSE5A.inc │ ├── SSSE3.inc │ ├── SYSTEM.inc │ ├── TBM.inc │ ├── TSX.inc │ ├── VME.inc │ ├── VMX.inc │ └── XOP.inc │ ├── ModRmFlags.inc │ ├── UnivDisasm.Cnsts.Instructions.pas │ ├── UnivDisasm.Cnsts.Mnemonics.pas │ ├── UnivDisasm.Cnsts.Regs.pas │ ├── UnivDisasm.Cnsts.pas │ ├── UnivDisasm.Disasm.pas │ ├── UnivDisasm.Internal.Common.pas │ ├── UnivDisasm.Internal.Escape.pas │ ├── UnivDisasm.Internal.Prefixes.pas │ ├── UnivDisasm.Syntax.NilSyntax.pas │ ├── UnivDisasm.Syntax.UnivSyntax.pas │ ├── UnivDisasm.Syntax.Utils.pas │ ├── UnivDisasm.SyntaxManager.pas │ └── UnivDisasm.Utils.pas ├── Demo ├── DebugEngineDemo.dpr ├── DebugEngineDemo.dproj ├── DebugEngineDemo.res ├── uMain.dfm └── uMain.pas ├── LICENSE ├── README.md ├── Script ├── MXCSRGen.pl └── RFlagsGen.pl ├── Snapshot ├── dbg_info.png └── map_gen.PNG ├── Source ├── DebugEngine.AsmRegUtils.pas ├── DebugEngine.Core.pas ├── DebugEngine.DebugInfo.pas ├── DebugEngine.DebugUtils.pas ├── DebugEngine.Disasm.pas ├── DebugEngine.HookException.pas ├── DebugEngine.MemoryHack.pas ├── DebugEngine.PeUtils.pas ├── DebugEngine.Trace.pas └── DebugEngine.inc └── Tools ├── Source └── DD │ ├── DD.dpr │ ├── DD.dproj │ └── DD.res ├── bin └── DD.exe └── bin64 └── DD.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | $ cat .gitattributes 2 | *.inc linguist-language=Pascal 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | #*.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Config.inc: -------------------------------------------------------------------------------- 1 | {$IFNDEF UNIVDISASM_CONFIG} 2 | 3 | {$DEFINE UNIVDISASM_CONFIG} 4 | 5 | {$DEFINE NEED_DISPLAY} // Undef if you don't want to have instruction str. 6 | 7 | {$DEFINE MustInline} // Delphi will inline small functions if MustInline defined. 8 | 9 | { 10 | ==> NEED_VFORM <== 11 | If defined, UnivDisasm will distinguish between VEX instructions 12 | and non VEX instructions. 13 | E.g: 14 | (If defined): "VMOVLPS" InstID is NOT the same as "MOVLPS" InstID. 15 | (If not defined): "VMOVLPS" is THE SAME as "MOVLPS" InstID. 16 | } 17 | 18 | { .$DEFINE NEED_VFORM } 19 | 20 | {$ENDIF UNIVDISASM_CONFIG} 21 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Home.txt: -------------------------------------------------------------------------------- 1 | https://github.com/MahdiSafsafi/UnivDisasm -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/ADX.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is ADX.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_ADX_ADCX_Gy_Ey(PInst: PInstruction); 25 | begin 26 | // ADCX Gy,Ey 27 | PInst^.InstGroups := INST_GRP_ADX; 28 | PInst^.InstCategory := (INST_CATEGORY_ARITHMETIC or INST_CATEGORY_BINARY or 29 | INST_CATEGORY_INTEGER or INST_CATEGORY_UNSIGNED); 30 | PInst^.FlagsIndex := $00; 31 | MakeMndPrefix66(PInst); 32 | PInst^.InstID := INST_ID_ADCX; 33 | Decode_Gy_Ey(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_ADCX); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_ADX_ADOX_Gy_Ey(PInst: PInstruction); 41 | begin 42 | // ADOX Gy,Ey 43 | PInst^.InstGroups := INST_GRP_ADX; 44 | PInst^.InstCategory := (INST_CATEGORY_ARITHMETIC or INST_CATEGORY_BINARY or 45 | INST_CATEGORY_INTEGER or INST_CATEGORY_UNSIGNED); 46 | PInst^.FlagsIndex := $00; 47 | MakeMndPrefixF3(PInst); 48 | PInst^.InstID := INST_ID_ADOX; 49 | Decode_Gy_Ey(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_ADOX); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AES.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AES.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AES_AESIMC_Vo_Wo(PInst: PInstruction); 25 | begin 26 | // AESIMC Vo,Wo 27 | PInst^.InstGroups := INST_GRP_AES; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_AESIMC; 32 | Decode_Vo_Wo(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_AESIMC); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_AES_AESENC_Vo_Wo(PInst: PInstruction); 40 | begin 41 | // AESENC Vo,Wo 42 | PInst^.InstGroups := INST_GRP_AES; 43 | PInst^.InstCategory := INST_CATEGORY_NIL; 44 | PInst^.FlagsIndex := $00; 45 | MakeMndPrefix66(PInst); 46 | PInst^.InstID := INST_ID_AESENC; 47 | Decode_Vo_Wo(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_AESENC); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_AES_AESENCLAST_Vo_Wo(PInst: PInstruction); 55 | begin 56 | // AESENCLAST Vo,Wo 57 | PInst^.InstGroups := INST_GRP_AES; 58 | PInst^.InstCategory := INST_CATEGORY_NIL; 59 | PInst^.FlagsIndex := $00; 60 | MakeMndPrefix66(PInst); 61 | PInst^.InstID := INST_ID_AESENCLAST; 62 | Decode_Vo_Wo(PInst); 63 | {$IFDEF NEED_DISPLAY} 64 | MoveMnem(PInst, MNEM_AESENCLAST); 65 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 66 | {$ENDIF NEED_DISPLAY} 67 | end; 68 | 69 | procedure Decode_AES_AESDEC_Vo_Wo(PInst: PInstruction); 70 | begin 71 | // AESDEC Vo,Wo 72 | PInst^.InstGroups := INST_GRP_AES; 73 | PInst^.InstCategory := INST_CATEGORY_NIL; 74 | PInst^.FlagsIndex := $00; 75 | MakeMndPrefix66(PInst); 76 | PInst^.InstID := INST_ID_AESDEC; 77 | Decode_Vo_Wo(PInst); 78 | {$IFDEF NEED_DISPLAY} 79 | MoveMnem(PInst, MNEM_AESDEC); 80 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 81 | {$ENDIF NEED_DISPLAY} 82 | end; 83 | 84 | procedure Decode_AES_AESDECLAST_Vo_Wo(PInst: PInstruction); 85 | begin 86 | // AESDECLAST Vo,Wo 87 | PInst^.InstGroups := INST_GRP_AES; 88 | PInst^.InstCategory := INST_CATEGORY_NIL; 89 | PInst^.FlagsIndex := $00; 90 | MakeMndPrefix66(PInst); 91 | PInst^.InstID := INST_ID_AESDECLAST; 92 | Decode_Vo_Wo(PInst); 93 | {$IFDEF NEED_DISPLAY} 94 | MoveMnem(PInst, MNEM_AESDECLAST); 95 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 96 | {$ENDIF NEED_DISPLAY} 97 | end; 98 | 99 | procedure Decode_AES_AESKEYGENASSIST_Vo_Wo_Ib(PInst: PInstruction); 100 | begin 101 | // AESKEYGENASSIST Vo,Wo,Ib 102 | PInst^.InstGroups := INST_GRP_AES; 103 | PInst^.InstCategory := INST_CATEGORY_NIL; 104 | PInst^.FlagsIndex := $00; 105 | MakeMndPrefix66(PInst); 106 | PInst^.InstID := INST_ID_AESKEYGENASSIST; 107 | Decode_Vo_Wo_Ib(PInst); 108 | {$IFDEF NEED_DISPLAY} 109 | MoveMnem(PInst, MNEM_AESKEYGENASSIST); 110 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 111 | {$ENDIF NEED_DISPLAY} 112 | end; 113 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX2-VSIB.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX2-VSIB.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX2_VSIB_VPGATHERDQ_Vx_Mq_o_Hx(PInst: PInstruction); 25 | begin 26 | // VPGATHERDQ Vx,Mq.o,Hx 27 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefix66(PInst); 30 | PInst^.InstID := INST_ID_VPGATHERDQ; 31 | Decode_vsib_Vx_Mq_o_Hx(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_VPGATHERDQ); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_AVX2_VSIB_VPGATHERDD_Vx_Md_x_Hx(PInst: PInstruction); 39 | begin 40 | // VPGATHERDD Vx,Md.x,Hx 41 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 42 | PInst^.FlagsIndex := $00; 43 | MakeMndPrefix66(PInst); 44 | PInst^.InstID := INST_ID_VPGATHERDD; 45 | Decode_vsib_Vx_Md_x_Hx(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_VPGATHERDD); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_AVX2_VSIB_VPGATHERQQ_Vx_Mq_x_Hx(PInst: PInstruction); 53 | begin 54 | // VPGATHERQQ Vx,Mq.x,Hx 55 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 56 | PInst^.FlagsIndex := $00; 57 | MakeMndPrefix66(PInst); 58 | PInst^.InstID := INST_ID_VPGATHERQQ; 59 | Decode_vsib_Vx_Mq_x_Hx(PInst); 60 | {$IFDEF NEED_DISPLAY} 61 | MoveMnem(PInst, MNEM_VPGATHERQQ); 62 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 63 | {$ENDIF NEED_DISPLAY} 64 | end; 65 | 66 | procedure Decode_AVX2_VSIB_VPGATHERQD_Vo_Md_x_Ho(PInst: PInstruction); 67 | begin 68 | // VPGATHERQD Vo,Md.x,Ho 69 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 70 | PInst^.FlagsIndex := $00; 71 | MakeMndPrefix66(PInst); 72 | PInst^.InstID := INST_ID_VPGATHERQD; 73 | Decode_vsib_Vo_Md_x_Ho(PInst); 74 | {$IFDEF NEED_DISPLAY} 75 | MoveMnem(PInst, MNEM_VPGATHERQD); 76 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 77 | {$ENDIF NEED_DISPLAY} 78 | end; 79 | 80 | procedure Decode_AVX2_VSIB_VGATHERDPD_Vx_Mq_o_Hx(PInst: PInstruction); 81 | begin 82 | // VGATHERDPD Vx,Mq.o,Hx 83 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 84 | PInst^.FlagsIndex := $00; 85 | MakeMndPrefix66(PInst); 86 | PInst^.InstID := INST_ID_VGATHERDPD; 87 | Decode_vsib_Vx_Mq_o_Hx(PInst); 88 | {$IFDEF NEED_DISPLAY} 89 | MoveMnem(PInst, MNEM_VGATHERDPD); 90 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 91 | {$ENDIF NEED_DISPLAY} 92 | end; 93 | 94 | procedure Decode_AVX2_VSIB_VGATHERDPS_Vx_Md_x_Hx(PInst: PInstruction); 95 | begin 96 | // VGATHERDPS Vx,Md.x,Hx 97 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 98 | PInst^.FlagsIndex := $00; 99 | MakeMndPrefix66(PInst); 100 | PInst^.InstID := INST_ID_VGATHERDPS; 101 | Decode_vsib_Vx_Md_x_Hx(PInst); 102 | {$IFDEF NEED_DISPLAY} 103 | MoveMnem(PInst, MNEM_VGATHERDPS); 104 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 105 | {$ENDIF NEED_DISPLAY} 106 | end; 107 | 108 | procedure Decode_AVX2_VSIB_VGATHERQPD_Vx_Mq_x_Hx(PInst: PInstruction); 109 | begin 110 | // VGATHERQPD Vx,Mq.x,Hx 111 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 112 | PInst^.FlagsIndex := $00; 113 | MakeMndPrefix66(PInst); 114 | PInst^.SetSp(SP_DISP8_VE_64); 115 | PInst^.InstID := INST_ID_VGATHERQPD; 116 | Decode_vsib_Vx_Mq_x_Hx(PInst); 117 | {$IFDEF NEED_DISPLAY} 118 | MoveMnem(PInst, MNEM_VGATHERQPD); 119 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 120 | {$ENDIF NEED_DISPLAY} 121 | end; 122 | 123 | procedure Decode_AVX2_VSIB_VGATHERQPS_Vo_Md_x_Ho(PInst: PInstruction); 124 | begin 125 | // VGATHERQPS Vo,Md.x,Ho 126 | PInst^.InstGroups := (INST_GRP_AVX2 or INST_GRP_VSIB); 127 | PInst^.FlagsIndex := $00; 128 | MakeMndPrefix66(PInst); 129 | PInst^.SetSp(SP_DISP8_VE_64); 130 | PInst^.InstID := INST_ID_VGATHERQPS; 131 | Decode_vsib_Vo_Md_x_Ho(PInst); 132 | {$IFDEF NEED_DISPLAY} 133 | MoveMnem(PInst, MNEM_VGATHERQPS); 134 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 135 | {$ENDIF NEED_DISPLAY} 136 | end; 137 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512CD-VL.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512CD-VL.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512CD_VL_VPBROADCASTMB2Q_Vn_mK(PInst: PInstruction); 25 | begin 26 | // VPBROADCASTMB2Q Vn,mK 27 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefixF3(PInst); 30 | PInst^.InstID := INST_ID_VPBROADCASTMB2Q; 31 | Decode_Vn_mK(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_VPBROADCASTMB2Q); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_AVX512CD_VL_VPBROADCASTMW2D_Vn_mK(PInst: PInstruction); 39 | begin 40 | // VPBROADCASTMW2D Vn,mK 41 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 42 | PInst^.FlagsIndex := $00; 43 | MakeMndPrefixF3(PInst); 44 | PInst^.InstID := INST_ID_VPBROADCASTMW2D; 45 | Decode_Vn_mK(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_VPBROADCASTMW2D); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_AVX512CD_VL_VPLZCNTQ_Vn_K_z_B64_Wn(PInst: PInstruction); 53 | begin 54 | // VPLZCNTQ Vn{K}{z},B64(Wn) 55 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 56 | PInst^.FlagsIndex := $00; 57 | MakeMndPrefix66(PInst); 58 | PInst^.SetTuple4VL(TT_FV); 59 | PInst^.InstID := INST_ID_VPLZCNTQ; 60 | Decode_Vn_K_z_B64_Wn(PInst); 61 | {$IFDEF NEED_DISPLAY} 62 | MoveMnem(PInst, MNEM_VPLZCNTQ); 63 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 64 | {$ENDIF NEED_DISPLAY} 65 | end; 66 | 67 | procedure Decode_AVX512CD_VL_VPLZCNTD_Vn_K_z_B32_Wn(PInst: PInstruction); 68 | begin 69 | // VPLZCNTD Vn{K}{z},B32(Wn) 70 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 71 | PInst^.FlagsIndex := $00; 72 | MakeMndPrefix66(PInst); 73 | PInst^.SetTuple4VL(TT_FV); 74 | PInst^.InstID := INST_ID_VPLZCNTD; 75 | Decode_Vn_K_z_B32_Wn(PInst); 76 | {$IFDEF NEED_DISPLAY} 77 | MoveMnem(PInst, MNEM_VPLZCNTD); 78 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 79 | {$ENDIF NEED_DISPLAY} 80 | end; 81 | 82 | procedure Decode_AVX512CD_VL_VPCONFLICTQ_Vn_K_z_B64_Wn(PInst: PInstruction); 83 | begin 84 | // VPCONFLICTQ Vn{K}{z},B64(Wn) 85 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 86 | PInst^.FlagsIndex := $00; 87 | MakeMndPrefix66(PInst); 88 | PInst^.SetTuple4VL(TT_FV); 89 | PInst^.InstID := INST_ID_VPCONFLICTQ; 90 | Decode_Vn_K_z_B64_Wn(PInst); 91 | {$IFDEF NEED_DISPLAY} 92 | MoveMnem(PInst, MNEM_VPCONFLICTQ); 93 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 94 | {$ENDIF NEED_DISPLAY} 95 | end; 96 | 97 | procedure Decode_AVX512CD_VL_VPCONFLICTD_Vn_K_z_B32_Wn(PInst: PInstruction); 98 | begin 99 | // VPCONFLICTD Vn{K}{z},B32(Wn) 100 | PInst^.InstGroups := (INST_GRP_AVX512CD or INST_GRP_VL); 101 | PInst^.FlagsIndex := $00; 102 | MakeMndPrefix66(PInst); 103 | PInst^.SetTuple4VL(TT_FV); 104 | PInst^.InstID := INST_ID_VPCONFLICTD; 105 | Decode_Vn_K_z_B32_Wn(PInst); 106 | {$IFDEF NEED_DISPLAY} 107 | MoveMnem(PInst, MNEM_VPCONFLICTD); 108 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 109 | {$ENDIF NEED_DISPLAY} 110 | end; 111 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512ER.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512ER.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512ER_VEXP2PD_Vz_K_z_B64_Wz_sae(PInst: PInstruction); 25 | begin 26 | // VEXP2PD Vz{K}{z},B64(Wz){sae} 27 | PInst^.InstGroups := INST_GRP_AVX512ER; 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefix66(PInst); 30 | PInst^.SetTuple4VL512(TT_FV); 31 | PInst^.InstID := INST_ID_VEXP2PD; 32 | Decode_Vz_K_z_B64_Wz_sae(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_VEXP2PD); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_AVX512ER_VEXP2PS_Vz_K_z_B32_Wz_sae(PInst: PInstruction); 40 | begin 41 | // VEXP2PS Vz{K}{z},B32(Wz){sae} 42 | PInst^.InstGroups := INST_GRP_AVX512ER; 43 | PInst^.FlagsIndex := $00; 44 | MakeMndPrefix66(PInst); 45 | PInst^.SetTuple4VL512(TT_FV); 46 | PInst^.InstID := INST_ID_VEXP2PS; 47 | Decode_Vz_K_z_B32_Wz_sae(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_VEXP2PS); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_AVX512ER_VRCP28PD_Vz_K_z_B64_Wz_sae(PInst: PInstruction); 55 | begin 56 | // VRCP28PD Vz{K}{z},B64(Wz){sae} 57 | PInst^.InstGroups := INST_GRP_AVX512ER; 58 | PInst^.FlagsIndex := $00; 59 | MakeMndPrefix66(PInst); 60 | PInst^.SetTuple4VL512(TT_FV); 61 | PInst^.InstID := INST_ID_VRCP28PD; 62 | Decode_Vz_K_z_B64_Wz_sae(PInst); 63 | {$IFDEF NEED_DISPLAY} 64 | MoveMnem(PInst, MNEM_VRCP28PD); 65 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 66 | {$ENDIF NEED_DISPLAY} 67 | end; 68 | 69 | procedure Decode_AVX512ER_VRCP28PS_Vz_K_z_B32_Wz_sae(PInst: PInstruction); 70 | begin 71 | // VRCP28PS Vz{K}{z},B32(Wz){sae} 72 | PInst^.InstGroups := INST_GRP_AVX512ER; 73 | PInst^.FlagsIndex := $00; 74 | MakeMndPrefix66(PInst); 75 | PInst^.SetTuple4VL512(TT_FV); 76 | PInst^.InstID := INST_ID_VRCP28PS; 77 | Decode_Vz_K_z_B32_Wz_sae(PInst); 78 | {$IFDEF NEED_DISPLAY} 79 | MoveMnem(PInst, MNEM_VRCP28PS); 80 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 81 | {$ENDIF NEED_DISPLAY} 82 | end; 83 | 84 | procedure Decode_AVX512ER_VRCP28SD_Vo_K_z_Ho_Wo_q_sae(PInst: PInstruction); 85 | begin 86 | // VRCP28SD Vo{K}{z},Ho,Wo.q{sae} 87 | PInst^.InstGroups := INST_GRP_AVX512ER; 88 | PInst^.FlagsIndex := $00; 89 | MakeMndPrefix66(PInst); 90 | PInst^.SetTuple4VL128(TT_T1S); 91 | PInst^.InstID := INST_ID_VRCP28SD; 92 | Decode_Vo_K_z_Ho_Wo_q_sae(PInst); 93 | {$IFDEF NEED_DISPLAY} 94 | MoveMnem(PInst, MNEM_VRCP28SD); 95 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 96 | {$ENDIF NEED_DISPLAY} 97 | end; 98 | 99 | procedure Decode_AVX512ER_VRCP28SS_Vo_K_z_Ho_Wo_d_sae(PInst: PInstruction); 100 | begin 101 | // VRCP28SS Vo{K}{z},Ho,Wo.d{sae} 102 | PInst^.InstGroups := INST_GRP_AVX512ER; 103 | PInst^.FlagsIndex := $00; 104 | MakeMndPrefix66(PInst); 105 | PInst^.SetTuple4VL128(TT_T1S); 106 | PInst^.InstID := INST_ID_VRCP28SS; 107 | Decode_Vo_K_z_Ho_Wo_d_sae(PInst); 108 | {$IFDEF NEED_DISPLAY} 109 | MoveMnem(PInst, MNEM_VRCP28SS); 110 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 111 | {$ENDIF NEED_DISPLAY} 112 | end; 113 | 114 | procedure Decode_AVX512ER_VRSQRT28PD_Vz_K_z_B64_Wz_sae(PInst: PInstruction); 115 | begin 116 | // VRSQRT28PD Vz{K}{z},B64(Wz){sae} 117 | PInst^.InstGroups := INST_GRP_AVX512ER; 118 | PInst^.FlagsIndex := $00; 119 | MakeMndPrefix66(PInst); 120 | PInst^.SetTuple4VL512(TT_FV); 121 | PInst^.InstID := INST_ID_VRSQRT28PD; 122 | Decode_Vz_K_z_B64_Wz_sae(PInst); 123 | {$IFDEF NEED_DISPLAY} 124 | MoveMnem(PInst, MNEM_VRSQRT28PD); 125 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 126 | {$ENDIF NEED_DISPLAY} 127 | end; 128 | 129 | procedure Decode_AVX512ER_VRSQRT28PS_Vz_K_z_B32_Wz_sae(PInst: PInstruction); 130 | begin 131 | // VRSQRT28PS Vz{K}{z},B32(Wz){sae} 132 | PInst^.InstGroups := INST_GRP_AVX512ER; 133 | PInst^.FlagsIndex := $00; 134 | MakeMndPrefix66(PInst); 135 | PInst^.SetTuple4VL512(TT_FV); 136 | PInst^.InstID := INST_ID_VRSQRT28PS; 137 | Decode_Vz_K_z_B32_Wz_sae(PInst); 138 | {$IFDEF NEED_DISPLAY} 139 | MoveMnem(PInst, MNEM_VRSQRT28PS); 140 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 141 | {$ENDIF NEED_DISPLAY} 142 | end; 143 | 144 | procedure Decode_AVX512ER_VRSQRT28SD_Vo_K_z_Ho_Wo_q_sae(PInst: PInstruction); 145 | begin 146 | // VRSQRT28SD Vo{K}{z},Ho,Wo.q{sae} 147 | PInst^.InstGroups := INST_GRP_AVX512ER; 148 | PInst^.FlagsIndex := $00; 149 | MakeMndPrefix66(PInst); 150 | PInst^.SetTuple4VL128(TT_T1S); 151 | PInst^.InstID := INST_ID_VRSQRT28SD; 152 | Decode_Vo_K_z_Ho_Wo_q_sae(PInst); 153 | {$IFDEF NEED_DISPLAY} 154 | MoveMnem(PInst, MNEM_VRSQRT28SD); 155 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 156 | {$ENDIF NEED_DISPLAY} 157 | end; 158 | 159 | procedure Decode_AVX512ER_VRSQRT28SS_Vo_K_z_Ho_Wo_d_sae(PInst: PInstruction); 160 | begin 161 | // VRSQRT28SS Vo{K}{z},Ho,Wo.d{sae} 162 | PInst^.InstGroups := INST_GRP_AVX512ER; 163 | PInst^.FlagsIndex := $00; 164 | MakeMndPrefix66(PInst); 165 | PInst^.SetTuple4VL128(TT_T1S); 166 | PInst^.InstID := INST_ID_VRSQRT28SS; 167 | Decode_Vo_K_z_Ho_Wo_d_sae(PInst); 168 | {$IFDEF NEED_DISPLAY} 169 | MoveMnem(PInst, MNEM_VRSQRT28SS); 170 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 171 | {$ENDIF NEED_DISPLAY} 172 | end; 173 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512F-VL-VSIB.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512F-VL-VSIB.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512F_VL_VSIB_VPGATHERDQ_Vn_K_not_0_Mq_h 25 | (PInst: PInstruction); 26 | begin 27 | // VPGATHERDQ Vn{K.!0},Mq.h 28 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.SetTuple4VL(TT_T1S); 32 | PInst^.InstID := INST_ID_VPGATHERDQ; 33 | Decode_vsib_Vn_K_not_0_Mq_h(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_VPGATHERDQ); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_AVX512F_VL_VSIB_VPGATHERDD_Vn_K_not_0_Md_n 41 | (PInst: PInstruction); 42 | begin 43 | // VPGATHERDD Vn{K.!0},Md.n 44 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 45 | PInst^.FlagsIndex := $00; 46 | MakeMndPrefix66(PInst); 47 | PInst^.SetTuple4VL(TT_T1S); 48 | PInst^.InstID := INST_ID_VPGATHERDD; 49 | Decode_vsib_Vn_K_not_0_Md_n(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_VPGATHERDD); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | 56 | procedure Decode_AVX512F_VL_VSIB_VPGATHERQQ_Vn_K_not_0_Mq_n 57 | (PInst: PInstruction); 58 | begin 59 | // VPGATHERQQ Vn{K.!0},Mq.n 60 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 61 | PInst^.FlagsIndex := $00; 62 | MakeMndPrefix66(PInst); 63 | PInst^.SetTuple4VL(TT_T1S); 64 | PInst^.InstID := INST_ID_VPGATHERQQ; 65 | Decode_vsib_Vn_K_not_0_Mq_n(PInst); 66 | {$IFDEF NEED_DISPLAY} 67 | MoveMnem(PInst, MNEM_VPGATHERQQ); 68 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 69 | {$ENDIF NEED_DISPLAY} 70 | end; 71 | 72 | procedure Decode_AVX512F_VL_VSIB_VPGATHERQD_Vh_K_not_0_Md_n 73 | (PInst: PInstruction); 74 | begin 75 | // VPGATHERQD Vh{K.!0},Md.n 76 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 77 | PInst^.FlagsIndex := $00; 78 | MakeMndPrefix66(PInst); 79 | PInst^.SetTuple4VL(TT_T1S); 80 | PInst^.InstID := INST_ID_VPGATHERQD; 81 | Decode_vsib_Vh_K_not_0_Md_n(PInst); 82 | {$IFDEF NEED_DISPLAY} 83 | MoveMnem(PInst, MNEM_VPGATHERQD); 84 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 85 | {$ENDIF NEED_DISPLAY} 86 | end; 87 | 88 | procedure Decode_AVX512F_VL_VSIB_VGATHERDPD_Vn_K_not_0_Mq_h 89 | (PInst: PInstruction); 90 | begin 91 | // VGATHERDPD Vn{K.!0},Mq.h 92 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 93 | PInst^.FlagsIndex := $00; 94 | MakeMndPrefix66(PInst); 95 | PInst^.SetTuple4VL(TT_T1S); 96 | PInst^.InstID := INST_ID_VGATHERDPD; 97 | Decode_vsib_Vn_K_not_0_Mq_h(PInst); 98 | {$IFDEF NEED_DISPLAY} 99 | MoveMnem(PInst, MNEM_VGATHERDPD); 100 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 101 | {$ENDIF NEED_DISPLAY} 102 | end; 103 | 104 | procedure Decode_AVX512F_VL_VSIB_VGATHERDPS_Vn_K_not_0_Md_n 105 | (PInst: PInstruction); 106 | begin 107 | // VGATHERDPS Vn{K.!0},Md.n 108 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 109 | PInst^.FlagsIndex := $00; 110 | MakeMndPrefix66(PInst); 111 | PInst^.SetTuple4VL(TT_T1S); 112 | PInst^.InstID := INST_ID_VGATHERDPS; 113 | Decode_vsib_Vn_K_not_0_Md_n(PInst); 114 | {$IFDEF NEED_DISPLAY} 115 | MoveMnem(PInst, MNEM_VGATHERDPS); 116 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 117 | {$ENDIF NEED_DISPLAY} 118 | end; 119 | 120 | procedure Decode_AVX512F_VL_VSIB_VGATHERQPD_Vn_K_not_0_Mq_n 121 | (PInst: PInstruction); 122 | begin 123 | // VGATHERQPD Vn{K.!0},Mq.n 124 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 125 | PInst^.FlagsIndex := $00; 126 | MakeMndPrefix66(PInst); 127 | PInst^.SetTuple4VL(TT_T1S); 128 | PInst^.SetSp(SP_DISP8_VE_64); 129 | PInst^.InstID := INST_ID_VGATHERQPD; 130 | Decode_vsib_Vn_K_not_0_Mq_n(PInst); 131 | {$IFDEF NEED_DISPLAY} 132 | MoveMnem(PInst, MNEM_VGATHERQPD); 133 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 134 | {$ENDIF NEED_DISPLAY} 135 | end; 136 | 137 | procedure Decode_AVX512F_VL_VSIB_VGATHERQPS_Vh_K_not_0_Md_n 138 | (PInst: PInstruction); 139 | begin 140 | // VGATHERQPS Vh{K.!0},Md.n 141 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 142 | PInst^.FlagsIndex := $00; 143 | MakeMndPrefix66(PInst); 144 | PInst^.SetTuple4VL(TT_T1S); 145 | PInst^.SetSp(SP_DISP8_VE_64); 146 | PInst^.InstID := INST_ID_VGATHERQPS; 147 | Decode_vsib_Vh_K_not_0_Md_n(PInst); 148 | {$IFDEF NEED_DISPLAY} 149 | MoveMnem(PInst, MNEM_VGATHERQPS); 150 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 151 | {$ENDIF NEED_DISPLAY} 152 | end; 153 | 154 | procedure Decode_AVX512F_VL_VSIB_VPSCATTERDQ_Mq_h_K_not_0_Vn 155 | (PInst: PInstruction); 156 | begin 157 | // VPSCATTERDQ Mq.h{K.!0},Vn 158 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 159 | PInst^.FlagsIndex := $00; 160 | MakeMndPrefix66(PInst); 161 | PInst^.SetTuple4VL(TT_T1S); 162 | PInst^.SetSp(SP_DISP8_VE_64); 163 | PInst^.InstID := INST_ID_VPSCATTERDQ; 164 | Decode_vsib_Mq_h_K_not_0_Vn(PInst); 165 | {$IFDEF NEED_DISPLAY} 166 | MoveMnem(PInst, MNEM_VPSCATTERDQ); 167 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 168 | {$ENDIF NEED_DISPLAY} 169 | end; 170 | 171 | procedure Decode_AVX512F_VL_VSIB_VPSCATTERDD_Md_n_K_not_0_Vn 172 | (PInst: PInstruction); 173 | begin 174 | // VPSCATTERDD Md.n{K.!0},Vn 175 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 176 | PInst^.FlagsIndex := $00; 177 | MakeMndPrefix66(PInst); 178 | PInst^.SetTuple4VL(TT_T1S); 179 | PInst^.SetSp(SP_DISP8_VE_32); 180 | PInst^.InstID := INST_ID_VPSCATTERDD; 181 | Decode_vsib_Md_n_K_not_0_Vn(PInst); 182 | {$IFDEF NEED_DISPLAY} 183 | MoveMnem(PInst, MNEM_VPSCATTERDD); 184 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 185 | {$ENDIF NEED_DISPLAY} 186 | end; 187 | 188 | procedure Decode_AVX512F_VL_VSIB_VPSCATTERQQ_Mq_n_K_not_0_Vn 189 | (PInst: PInstruction); 190 | begin 191 | // VPSCATTERQQ Mq.n{K.!0},Vn 192 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 193 | PInst^.FlagsIndex := $00; 194 | MakeMndPrefix66(PInst); 195 | PInst^.SetTuple4VL(TT_T1S); 196 | PInst^.SetSp(SP_DISP8_VE_64); 197 | PInst^.InstID := INST_ID_VPSCATTERQQ; 198 | Decode_vsib_Mq_n_K_not_0_Vn(PInst); 199 | {$IFDEF NEED_DISPLAY} 200 | MoveMnem(PInst, MNEM_VPSCATTERQQ); 201 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 202 | {$ENDIF NEED_DISPLAY} 203 | end; 204 | 205 | procedure Decode_AVX512F_VL_VSIB_VPSCATTERQD_Md_n_K_not_0_Vh 206 | (PInst: PInstruction); 207 | begin 208 | // VPSCATTERQD Md.n{K.!0},Vh 209 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 210 | PInst^.FlagsIndex := $00; 211 | MakeMndPrefix66(PInst); 212 | PInst^.SetTuple4VL(TT_T1S); 213 | PInst^.SetSp(SP_DISP8_VE_64); 214 | PInst^.InstID := INST_ID_VPSCATTERQD; 215 | Decode_vsib_Md_n_K_not_0_Vh(PInst); 216 | {$IFDEF NEED_DISPLAY} 217 | MoveMnem(PInst, MNEM_VPSCATTERQD); 218 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 219 | {$ENDIF NEED_DISPLAY} 220 | end; 221 | 222 | procedure Decode_AVX512F_VL_VSIB_VSCATTERDPD_Mq_h_K_not_0_Vn 223 | (PInst: PInstruction); 224 | begin 225 | // VSCATTERDPD Mq.h{K.!0},Vn 226 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 227 | PInst^.FlagsIndex := $00; 228 | MakeMndPrefix66(PInst); 229 | PInst^.SetTuple4VL(TT_T1S); 230 | PInst^.SetSp(SP_DISP8_VE_64); 231 | PInst^.InstID := INST_ID_VSCATTERDPD; 232 | Decode_vsib_Mq_h_K_not_0_Vn(PInst); 233 | {$IFDEF NEED_DISPLAY} 234 | MoveMnem(PInst, MNEM_VSCATTERDPD); 235 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 236 | {$ENDIF NEED_DISPLAY} 237 | end; 238 | 239 | procedure Decode_AVX512F_VL_VSIB_VSCATTERDPS_Md_n_K_not_0_Vn 240 | (PInst: PInstruction); 241 | begin 242 | // VSCATTERDPS Md.n{K.!0},Vn 243 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 244 | PInst^.FlagsIndex := $00; 245 | MakeMndPrefix66(PInst); 246 | PInst^.SetTuple4VL(TT_T1S); 247 | PInst^.SetSp(SP_DISP8_VE_32); 248 | PInst^.InstID := INST_ID_VSCATTERDPS; 249 | Decode_vsib_Md_n_K_not_0_Vn(PInst); 250 | {$IFDEF NEED_DISPLAY} 251 | MoveMnem(PInst, MNEM_VSCATTERDPS); 252 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 253 | {$ENDIF NEED_DISPLAY} 254 | end; 255 | 256 | procedure Decode_AVX512F_VL_VSIB_VSCATTERQPD_Mq_n_K_not_0_Vn 257 | (PInst: PInstruction); 258 | begin 259 | // VSCATTERQPD Mq.n{K.!0},Vn 260 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 261 | PInst^.FlagsIndex := $00; 262 | MakeMndPrefix66(PInst); 263 | PInst^.SetTuple4VL(TT_T1S); 264 | PInst^.SetSp(SP_DISP8_VE_64); 265 | PInst^.InstID := INST_ID_VSCATTERQPD; 266 | Decode_vsib_Mq_n_K_not_0_Vn(PInst); 267 | {$IFDEF NEED_DISPLAY} 268 | MoveMnem(PInst, MNEM_VSCATTERQPD); 269 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 270 | {$ENDIF NEED_DISPLAY} 271 | end; 272 | 273 | procedure Decode_AVX512F_VL_VSIB_VSCATTERQPS_Md_n_K_not_0_Vh 274 | (PInst: PInstruction); 275 | begin 276 | // VSCATTERQPS Md.n{K.!0},Vh 277 | PInst^.InstGroups := (INST_GRP_AVX512F or INST_GRP_VL or INST_GRP_VSIB); 278 | PInst^.FlagsIndex := $00; 279 | MakeMndPrefix66(PInst); 280 | PInst^.SetTuple4VL(TT_T1S); 281 | PInst^.SetSp(SP_DISP8_VE_64); 282 | PInst^.InstID := INST_ID_VSCATTERQPS; 283 | Decode_vsib_Md_n_K_not_0_Vh(PInst); 284 | {$IFDEF NEED_DISPLAY} 285 | MoveMnem(PInst, MNEM_VSCATTERQPS); 286 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 287 | {$ENDIF NEED_DISPLAY} 288 | end; 289 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512IFMA-VL.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512IFMA-VL.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512IFMA_VL_VPMADD52LUQ_Vn_Kw_z_Hn_B64_Wn 25 | (PInst: PInstruction); 26 | begin 27 | // VPMADD52LUQ Vn{Kw}{z},Hn,B64(Wn) 28 | PInst^.InstGroups := (INST_GRP_AVX512IFMA or INST_GRP_VL); 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.SetTuple4VL(TT_FV); 32 | PInst^.InstID := INST_ID_VPMADD52LUQ; 33 | Decode_Vn_Kw_z_Hn_B64_Wn(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_VPMADD52LUQ); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_AVX512IFMA_VL_VPMADD52HUQ_Vn_Kw_z_Hn_B64_Wn 41 | (PInst: PInstruction); 42 | begin 43 | // VPMADD52HUQ Vn{Kw}{z},Hn,B64(Wn) 44 | PInst^.InstGroups := (INST_GRP_AVX512IFMA or INST_GRP_VL); 45 | PInst^.FlagsIndex := $00; 46 | MakeMndPrefix66(PInst); 47 | PInst^.SetTuple4VL(TT_FV); 48 | PInst^.InstID := INST_ID_VPMADD52HUQ; 49 | Decode_Vn_Kw_z_Hn_B64_Wn(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_VPMADD52HUQ); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512PF-VSIB.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512PF-VSIB.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512PF_VSIB_VGATHERPF0DPS_Md_z_K_not_0(PInst: PInstruction); 25 | begin 26 | // VGATHERPF0DPS Md.z{K.!0} 27 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefix66(PInst); 30 | PInst^.SetTuple4VL512(TT_T1S); 31 | PInst^.InstID := INST_ID_VGATHERPF0DPS; 32 | Decode_vsib_Md_z_K_not_0(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_VGATHERPF0DPS); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_AVX512PF_VSIB_VGATHERPF0DPD_Mq_y_K_not_0(PInst: PInstruction); 40 | begin 41 | // VGATHERPF0DPD Mq.y{K.!0} 42 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 43 | PInst^.FlagsIndex := $00; 44 | MakeMndPrefix66(PInst); 45 | PInst^.SetTuple4VL512(TT_T1S); 46 | PInst^.InstID := INST_ID_VGATHERPF0DPD; 47 | Decode_vsib_Mq_y_K_not_0(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_VGATHERPF0DPD); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_AVX512PF_VSIB_VGATHERPF1DPS_Md_z_K_not_0(PInst: PInstruction); 55 | begin 56 | // VGATHERPF1DPS Md.z{K.!0} 57 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 58 | PInst^.FlagsIndex := $00; 59 | MakeMndPrefix66(PInst); 60 | PInst^.SetTuple4VL512(TT_T1S); 61 | PInst^.InstID := INST_ID_VGATHERPF1DPS; 62 | Decode_vsib_Md_z_K_not_0(PInst); 63 | {$IFDEF NEED_DISPLAY} 64 | MoveMnem(PInst, MNEM_VGATHERPF1DPS); 65 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 66 | {$ENDIF NEED_DISPLAY} 67 | end; 68 | 69 | procedure Decode_AVX512PF_VSIB_VGATHERPF1DPD_Mq_y_K_not_0(PInst: PInstruction); 70 | begin 71 | // VGATHERPF1DPD Mq.y{K.!0} 72 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 73 | PInst^.FlagsIndex := $00; 74 | MakeMndPrefix66(PInst); 75 | PInst^.SetTuple4VL512(TT_T1S); 76 | PInst^.InstID := INST_ID_VGATHERPF1DPD; 77 | Decode_vsib_Mq_y_K_not_0(PInst); 78 | {$IFDEF NEED_DISPLAY} 79 | MoveMnem(PInst, MNEM_VGATHERPF1DPD); 80 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 81 | {$ENDIF NEED_DISPLAY} 82 | end; 83 | 84 | procedure Decode_AVX512PF_VSIB_VSCATTERPF0DPS_Md_z_K_not_0(PInst: PInstruction); 85 | begin 86 | // VSCATTERPF0DPS Md.z{K.!0} 87 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 88 | PInst^.FlagsIndex := $00; 89 | MakeMndPrefix66(PInst); 90 | PInst^.SetTuple4VL512(TT_T1S); 91 | PInst^.InstID := INST_ID_VSCATTERPF0DPS; 92 | Decode_vsib_Md_z_K_not_0(PInst); 93 | {$IFDEF NEED_DISPLAY} 94 | MoveMnem(PInst, MNEM_VSCATTERPF0DPS); 95 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 96 | {$ENDIF NEED_DISPLAY} 97 | end; 98 | 99 | procedure Decode_AVX512PF_VSIB_VSCATTERPF0DPD_Mq_y_K_not_0(PInst: PInstruction); 100 | begin 101 | // VSCATTERPF0DPD Mq.y{K.!0} 102 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 103 | PInst^.FlagsIndex := $00; 104 | MakeMndPrefix66(PInst); 105 | PInst^.SetTuple4VL512(TT_T1S); 106 | PInst^.InstID := INST_ID_VSCATTERPF0DPD; 107 | Decode_vsib_Mq_y_K_not_0(PInst); 108 | {$IFDEF NEED_DISPLAY} 109 | MoveMnem(PInst, MNEM_VSCATTERPF0DPD); 110 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 111 | {$ENDIF NEED_DISPLAY} 112 | end; 113 | 114 | procedure Decode_AVX512PF_VSIB_VSCATTERPF1DPS_Md_z_K_not_0(PInst: PInstruction); 115 | begin 116 | // VSCATTERPF1DPS Md.z{K.!0} 117 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 118 | PInst^.FlagsIndex := $00; 119 | MakeMndPrefix66(PInst); 120 | PInst^.SetTuple4VL512(TT_T1S); 121 | PInst^.InstID := INST_ID_VSCATTERPF1DPS; 122 | Decode_vsib_Md_z_K_not_0(PInst); 123 | {$IFDEF NEED_DISPLAY} 124 | MoveMnem(PInst, MNEM_VSCATTERPF1DPS); 125 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 126 | {$ENDIF NEED_DISPLAY} 127 | end; 128 | 129 | procedure Decode_AVX512PF_VSIB_VSCATTERPF1DPD_Mq_y_K_not_0(PInst: PInstruction); 130 | begin 131 | // VSCATTERPF1DPD Mq.y{K.!0} 132 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 133 | PInst^.FlagsIndex := $00; 134 | MakeMndPrefix66(PInst); 135 | PInst^.SetTuple4VL512(TT_T1S); 136 | PInst^.InstID := INST_ID_VSCATTERPF1DPD; 137 | Decode_vsib_Mq_y_K_not_0(PInst); 138 | {$IFDEF NEED_DISPLAY} 139 | MoveMnem(PInst, MNEM_VSCATTERPF1DPD); 140 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 141 | {$ENDIF NEED_DISPLAY} 142 | end; 143 | 144 | procedure Decode_AVX512PF_VSIB_VGATHERPF0QPS_Md_z_K_not_0(PInst: PInstruction); 145 | begin 146 | // VGATHERPF0QPS Md.z{K.!0} 147 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 148 | PInst^.FlagsIndex := $00; 149 | MakeMndPrefix66(PInst); 150 | PInst^.SetTuple4VL512(TT_T1S); 151 | PInst^.InstID := INST_ID_VGATHERPF0QPS; 152 | Decode_vsib_Md_z_K_not_0(PInst); 153 | {$IFDEF NEED_DISPLAY} 154 | MoveMnem(PInst, MNEM_VGATHERPF0QPS); 155 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 156 | {$ENDIF NEED_DISPLAY} 157 | end; 158 | 159 | procedure Decode_AVX512PF_VSIB_VGATHERPF0QPD_Mq_z_K_not_0(PInst: PInstruction); 160 | begin 161 | // VGATHERPF0QPD Mq.z{K.!0} 162 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 163 | PInst^.FlagsIndex := $00; 164 | MakeMndPrefix66(PInst); 165 | PInst^.SetTuple4VL512(TT_T1S); 166 | PInst^.InstID := INST_ID_VGATHERPF0QPD; 167 | Decode_vsib_Mq_z_K_not_0(PInst); 168 | {$IFDEF NEED_DISPLAY} 169 | MoveMnem(PInst, MNEM_VGATHERPF0QPD); 170 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 171 | {$ENDIF NEED_DISPLAY} 172 | end; 173 | 174 | procedure Decode_AVX512PF_VSIB_VGATHERPF1QPS_Md_z_K_not_0(PInst: PInstruction); 175 | begin 176 | // VGATHERPF1QPS Md.z{K.!0} 177 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 178 | PInst^.FlagsIndex := $00; 179 | MakeMndPrefix66(PInst); 180 | PInst^.SetTuple4VL512(TT_T1S); 181 | PInst^.InstID := INST_ID_VGATHERPF1QPS; 182 | Decode_vsib_Md_z_K_not_0(PInst); 183 | {$IFDEF NEED_DISPLAY} 184 | MoveMnem(PInst, MNEM_VGATHERPF1QPS); 185 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 186 | {$ENDIF NEED_DISPLAY} 187 | end; 188 | 189 | procedure Decode_AVX512PF_VSIB_VGATHERPF1QPD_Mq_z_K_not_0(PInst: PInstruction); 190 | begin 191 | // VGATHERPF1QPD Mq.z{K.!0} 192 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 193 | PInst^.FlagsIndex := $00; 194 | MakeMndPrefix66(PInst); 195 | PInst^.SetTuple4VL512(TT_T1S); 196 | PInst^.InstID := INST_ID_VGATHERPF1QPD; 197 | Decode_vsib_Mq_z_K_not_0(PInst); 198 | {$IFDEF NEED_DISPLAY} 199 | MoveMnem(PInst, MNEM_VGATHERPF1QPD); 200 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 201 | {$ENDIF NEED_DISPLAY} 202 | end; 203 | 204 | procedure Decode_AVX512PF_VSIB_VSCATTERPF0QPS_Md_z_K_not_0(PInst: PInstruction); 205 | begin 206 | // VSCATTERPF0QPS Md.z{K.!0} 207 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 208 | PInst^.FlagsIndex := $00; 209 | MakeMndPrefix66(PInst); 210 | PInst^.SetTuple4VL512(TT_T1S); 211 | PInst^.InstID := INST_ID_VSCATTERPF0QPS; 212 | Decode_vsib_Md_z_K_not_0(PInst); 213 | {$IFDEF NEED_DISPLAY} 214 | MoveMnem(PInst, MNEM_VSCATTERPF0QPS); 215 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 216 | {$ENDIF NEED_DISPLAY} 217 | end; 218 | 219 | procedure Decode_AVX512PF_VSIB_VSCATTERPF0QPD_Mq_z_K_not_0(PInst: PInstruction); 220 | begin 221 | // VSCATTERPF0QPD Mq.z{K.!0} 222 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 223 | PInst^.FlagsIndex := $00; 224 | MakeMndPrefix66(PInst); 225 | PInst^.SetTuple4VL512(TT_T1S); 226 | PInst^.InstID := INST_ID_VSCATTERPF0QPD; 227 | Decode_vsib_Mq_z_K_not_0(PInst); 228 | {$IFDEF NEED_DISPLAY} 229 | MoveMnem(PInst, MNEM_VSCATTERPF0QPD); 230 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 231 | {$ENDIF NEED_DISPLAY} 232 | end; 233 | 234 | procedure Decode_AVX512PF_VSIB_VSCATTERPF1QPS_Md_z_K_not_0(PInst: PInstruction); 235 | begin 236 | // VSCATTERPF1QPS Md.z{K.!0} 237 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 238 | PInst^.FlagsIndex := $00; 239 | MakeMndPrefix66(PInst); 240 | PInst^.SetTuple4VL512(TT_T1S); 241 | PInst^.InstID := INST_ID_VSCATTERPF1QPS; 242 | Decode_vsib_Md_z_K_not_0(PInst); 243 | {$IFDEF NEED_DISPLAY} 244 | MoveMnem(PInst, MNEM_VSCATTERPF1QPS); 245 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 246 | {$ENDIF NEED_DISPLAY} 247 | end; 248 | 249 | procedure Decode_AVX512PF_VSIB_VSCATTERPF1QPD_Mq_z_K_not_0(PInst: PInstruction); 250 | begin 251 | // VSCATTERPF1QPD Mq.z{K.!0} 252 | PInst^.InstGroups := (INST_GRP_AVX512PF or INST_GRP_VSIB); 253 | PInst^.FlagsIndex := $00; 254 | MakeMndPrefix66(PInst); 255 | PInst^.SetTuple4VL512(TT_T1S); 256 | PInst^.InstID := INST_ID_VSCATTERPF1QPD; 257 | Decode_vsib_Mq_z_K_not_0(PInst); 258 | {$IFDEF NEED_DISPLAY} 259 | MoveMnem(PInst, MNEM_VSCATTERPF1QPD); 260 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 261 | {$ENDIF NEED_DISPLAY} 262 | end; 263 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/AVX512VBMI-VL.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is AVX512VBMI-VL.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_AVX512VBMI_VL_VPERMI2B_Vn_K_z_Hn_Wn(PInst: PInstruction); 25 | begin 26 | // VPERMI2B Vn{K}{z},Hn,Wn 27 | PInst^.InstGroups := (INST_GRP_AVX512VBMI or INST_GRP_VL); 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefix66(PInst); 30 | PInst^.SetTuple4VL(TT_FVM); 31 | PInst^.InstID := INST_ID_VPERMI2B; 32 | Decode_Vn_K_z_Hn_Wn(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_VPERMI2B); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_AVX512VBMI_VL_VPERMT2B_Vn_K_z_Hn_Wn(PInst: PInstruction); 40 | begin 41 | // VPERMT2B Vn{K}{z},Hn,Wn 42 | PInst^.InstGroups := (INST_GRP_AVX512VBMI or INST_GRP_VL); 43 | PInst^.FlagsIndex := $00; 44 | MakeMndPrefix66(PInst); 45 | PInst^.SetTuple4VL(TT_FVM); 46 | PInst^.InstID := INST_ID_VPERMT2B; 47 | Decode_Vn_K_z_Hn_Wn(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_VPERMT2B); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_AVX512VBMI_VL_VPMULTISHIFTQB_Vn_K_z_Hn_B64_Wn 55 | (PInst: PInstruction); 56 | begin 57 | // VPMULTISHIFTQB Vn{K}{z},Hn,B64(Wn) 58 | PInst^.InstGroups := (INST_GRP_AVX512VBMI or INST_GRP_VL); 59 | PInst^.FlagsIndex := $00; 60 | MakeMndPrefix66(PInst); 61 | PInst^.SetTuple4VL(TT_FV); 62 | PInst^.InstID := INST_ID_VPMULTISHIFTQB; 63 | Decode_Vn_K_z_Hn_B64_Wn(PInst); 64 | {$IFDEF NEED_DISPLAY} 65 | MoveMnem(PInst, MNEM_VPMULTISHIFTQB); 66 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 67 | {$ENDIF NEED_DISPLAY} 68 | end; 69 | 70 | procedure Decode_AVX512VBMI_VL_VPERMB_Vn_K_z_Hn_Wn(PInst: PInstruction); 71 | begin 72 | // VPERMB Vn{K}{z},Hn,Wn 73 | PInst^.InstGroups := (INST_GRP_AVX512VBMI or INST_GRP_VL); 74 | PInst^.FlagsIndex := $00; 75 | MakeMndPrefix66(PInst); 76 | PInst^.SetTuple4VL(TT_FVM); 77 | PInst^.InstID := INST_ID_VPERMB; 78 | Decode_Vn_K_z_Hn_Wn(PInst); 79 | {$IFDEF NEED_DISPLAY} 80 | MoveMnem(PInst, MNEM_VPERMB); 81 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 82 | {$ENDIF NEED_DISPLAY} 83 | end; 84 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/BMI.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is BMI.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_BMI_ANDN_Gy_By_Ey(PInst: PInstruction); 25 | begin 26 | // ANDN Gy,By,Ey 27 | PInst^.InstGroups := INST_GRP_BMI; 28 | PInst^.InstCategory := INST_CATEGORY_BMI1; 29 | PInst^.FlagsIndex := $00; 30 | PInst^.InstID := INST_ID_ANDN; 31 | Decode_Gy_By_Ey(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_ANDN); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_BMI_BEXTR_Gy_Ey_By(PInst: PInstruction); 39 | begin 40 | // BEXTR Gy,Ey,By 41 | PInst^.InstGroups := INST_GRP_BMI; 42 | PInst^.InstCategory := INST_CATEGORY_BMI1; 43 | PInst^.FlagsIndex := $00; 44 | PInst^.InstID := INST_ID_BEXTR; 45 | Decode_Gy_Ey_By(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_BEXTR); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_BMI_BLSR_By_Ey(PInst: PInstruction); 53 | begin 54 | // BLSR By,Ey 55 | PInst^.InstGroups := INST_GRP_BMI; 56 | PInst^.InstCategory := INST_CATEGORY_BMI1; 57 | PInst^.FlagsIndex := $00; 58 | PInst^.InstID := INST_ID_BLSR; 59 | Decode_By_Ey(PInst); 60 | {$IFDEF NEED_DISPLAY} 61 | MoveMnem(PInst, MNEM_BLSR); 62 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 63 | {$ENDIF NEED_DISPLAY} 64 | end; 65 | 66 | procedure Decode_BMI_BLSMSK_By_Ey(PInst: PInstruction); 67 | begin 68 | // BLSMSK By,Ey 69 | PInst^.InstGroups := INST_GRP_BMI; 70 | PInst^.InstCategory := INST_CATEGORY_BMI1; 71 | PInst^.FlagsIndex := $00; 72 | PInst^.InstID := INST_ID_BLSMSK; 73 | Decode_By_Ey(PInst); 74 | {$IFDEF NEED_DISPLAY} 75 | MoveMnem(PInst, MNEM_BLSMSK); 76 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 77 | {$ENDIF NEED_DISPLAY} 78 | end; 79 | 80 | procedure Decode_BMI_BLSI_By_Ey(PInst: PInstruction); 81 | begin 82 | // BLSI By,Ey 83 | PInst^.InstGroups := INST_GRP_BMI; 84 | PInst^.InstCategory := INST_CATEGORY_BMI1; 85 | PInst^.FlagsIndex := $00; 86 | PInst^.InstID := INST_ID_BLSI; 87 | Decode_By_Ey(PInst); 88 | {$IFDEF NEED_DISPLAY} 89 | MoveMnem(PInst, MNEM_BLSI); 90 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 91 | {$ENDIF NEED_DISPLAY} 92 | end; 93 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/BMI2.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is BMI2.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_BMI2_PDEP_Gy_By_Ey(PInst: PInstruction); 25 | begin 26 | // PDEP Gy,By,Ey 27 | PInst^.InstGroups := INST_GRP_BMI2; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefixF2(PInst); 31 | PInst^.InstID := INST_ID_PDEP; 32 | Decode_Gy_By_Ey(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_PDEP); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_BMI2_PEXT_Gy_By_Ey(PInst: PInstruction); 40 | begin 41 | // PEXT Gy,By,Ey 42 | PInst^.InstGroups := INST_GRP_BMI2; 43 | PInst^.InstCategory := INST_CATEGORY_NIL; 44 | PInst^.FlagsIndex := $00; 45 | MakeMndPrefixF3(PInst); 46 | PInst^.InstID := INST_ID_PEXT; 47 | Decode_Gy_By_Ey(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_PEXT); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_BMI2_BZHI_Gy_Ey_By(PInst: PInstruction); 55 | begin 56 | // BZHI Gy,Ey,By 57 | PInst^.InstGroups := INST_GRP_BMI2; 58 | PInst^.InstCategory := INST_CATEGORY_NIL; 59 | PInst^.FlagsIndex := $00; 60 | PInst^.InstID := INST_ID_BZHI; 61 | Decode_Gy_Ey_By(PInst); 62 | {$IFDEF NEED_DISPLAY} 63 | MoveMnem(PInst, MNEM_BZHI); 64 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 65 | {$ENDIF NEED_DISPLAY} 66 | end; 67 | 68 | procedure Decode_BMI2_MULX_Gy_By_Ey(PInst: PInstruction); 69 | begin 70 | // MULX Gy,By,Ey 71 | PInst^.InstGroups := INST_GRP_BMI2; 72 | PInst^.InstCategory := INST_CATEGORY_UNSIGNED; 73 | PInst^.FlagsIndex := $00; 74 | MakeMndPrefixF2(PInst); 75 | PInst^.InstID := INST_ID_MULX; 76 | Decode_Gy_By_Ey(PInst); 77 | {$IFDEF NEED_DISPLAY} 78 | MoveMnem(PInst, MNEM_MULX); 79 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 80 | {$ENDIF NEED_DISPLAY} 81 | end; 82 | 83 | procedure Decode_BMI2_SHLX_Gy_Ey_By(PInst: PInstruction); 84 | begin 85 | // SHLX Gy,Ey,By 86 | PInst^.InstGroups := INST_GRP_BMI2; 87 | PInst^.InstCategory := INST_CATEGORY_SHIFT; 88 | PInst^.FlagsIndex := $00; 89 | MakeMndPrefix66(PInst); 90 | PInst^.InstID := INST_ID_SHLX; 91 | Decode_Gy_Ey_By(PInst); 92 | {$IFDEF NEED_DISPLAY} 93 | MoveMnem(PInst, MNEM_SHLX); 94 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 95 | {$ENDIF NEED_DISPLAY} 96 | end; 97 | 98 | procedure Decode_BMI2_SHRX_Gy_Ey_By(PInst: PInstruction); 99 | begin 100 | // SHRX Gy,Ey,By 101 | PInst^.InstGroups := INST_GRP_BMI2; 102 | PInst^.InstCategory := INST_CATEGORY_SHIFT; 103 | PInst^.FlagsIndex := $00; 104 | MakeMndPrefixF2(PInst); 105 | PInst^.InstID := INST_ID_SHRX; 106 | Decode_Gy_Ey_By(PInst); 107 | {$IFDEF NEED_DISPLAY} 108 | MoveMnem(PInst, MNEM_SHRX); 109 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 110 | {$ENDIF NEED_DISPLAY} 111 | end; 112 | 113 | procedure Decode_BMI2_SARX_Gy_Ey_By(PInst: PInstruction); 114 | begin 115 | // SARX Gy,Ey,By 116 | PInst^.InstGroups := INST_GRP_BMI2; 117 | PInst^.InstCategory := INST_CATEGORY_SHIFT; 118 | PInst^.FlagsIndex := $00; 119 | MakeMndPrefixF3(PInst); 120 | PInst^.InstID := INST_ID_SARX; 121 | Decode_Gy_Ey_By(PInst); 122 | {$IFDEF NEED_DISPLAY} 123 | MoveMnem(PInst, MNEM_SARX); 124 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 125 | {$ENDIF NEED_DISPLAY} 126 | end; 127 | 128 | procedure Decode_BMI2_RORX_By_Ey_Ib(PInst: PInstruction); 129 | begin 130 | // RORX By,Ey,Ib 131 | PInst^.InstGroups := INST_GRP_BMI2; 132 | PInst^.InstCategory := INST_CATEGORY_ROTATE; 133 | PInst^.FlagsIndex := $00; 134 | MakeMndPrefixF2(PInst); 135 | PInst^.InstID := INST_ID_RORX; 136 | Decode_By_Ey_Ib(PInst); 137 | {$IFDEF NEED_DISPLAY} 138 | MoveMnem(PInst, MNEM_RORX); 139 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 140 | {$ENDIF NEED_DISPLAY} 141 | end; 142 | 143 | procedure Decode_BMI2_TZCNT_Gv_Ev(PInst: PInstruction); 144 | begin 145 | // TZCNT Gv,Ev 146 | PInst^.InstGroups := INST_GRP_BMI2; 147 | PInst^.InstCategory := INST_CATEGORY_BMI1; 148 | PInst^.FlagsIndex := $00; 149 | MakeMndPrefixF3(PInst); 150 | PInst^.InstID := INST_ID_TZCNT; 151 | Decode_Gv_Ev(PInst); 152 | {$IFDEF NEED_DISPLAY} 153 | MoveMnem(PInst, MNEM_TZCNT); 154 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 155 | {$ENDIF NEED_DISPLAY} 156 | end; 157 | 158 | procedure Decode_BMI2_LZCNT_Gv_Ev(PInst: PInstruction); 159 | begin 160 | // LZCNT Gv,Ev 161 | PInst^.InstGroups := INST_GRP_BMI2; 162 | PInst^.InstCategory := INST_CATEGORY_BMI1; 163 | PInst^.FlagsIndex := $00; 164 | MakeMndPrefixF3(PInst); 165 | PInst^.InstID := INST_ID_LZCNT; 166 | Decode_Gv_Ev(PInst); 167 | {$IFDEF NEED_DISPLAY} 168 | MoveMnem(PInst, MNEM_LZCNT); 169 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 170 | {$ENDIF NEED_DISPLAY} 171 | end; 172 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/F16C.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is F16C.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_F16C_VCVTPH2PS_Vo_Wo_q(PInst: PInstruction); 25 | begin 26 | // VCVTPH2PS Vo,Wo.q 27 | PInst^.InstGroups := INST_GRP_F16C; 28 | PInst^.InstCategory := (INST_CATEGORY_16_BIT or INST_CATEGORY_CONVERT or 29 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SINGLE_PRECISION); 30 | PInst^.FlagsIndex := $00; 31 | MakeMndPrefix66(PInst); 32 | PInst^.InstID := INST_ID_VCVTPH2PS; 33 | Decode_Vo_Wo_q(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_VCVTPH2PS); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_F16C_VCVTPH2PS_Vy_Wo_o(PInst: PInstruction); 41 | begin 42 | // VCVTPH2PS Vy,Wo.o 43 | PInst^.InstGroups := INST_GRP_F16C; 44 | PInst^.InstCategory := (INST_CATEGORY_16_BIT or INST_CATEGORY_CONVERT or 45 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SINGLE_PRECISION); 46 | PInst^.FlagsIndex := $00; 47 | MakeMndPrefix66(PInst); 48 | PInst^.InstID := INST_ID_VCVTPH2PS; 49 | Decode_Vy_Wo_o(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_VCVTPH2PS); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | 56 | procedure Decode_F16C_VCVTPS2PH_Wo_q_Vo_Ib(PInst: PInstruction); 57 | begin 58 | // VCVTPS2PH Wo.q,Vo,Ib 59 | PInst^.InstGroups := INST_GRP_F16C; 60 | PInst^.InstCategory := (INST_CATEGORY_16_BIT or INST_CATEGORY_CONVERT or 61 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SINGLE_PRECISION); 62 | PInst^.FlagsIndex := $00; 63 | MakeMndPrefix66(PInst); 64 | PInst^.InstID := INST_ID_VCVTPS2PH; 65 | Decode_Wo_q_Vo_Ib(PInst); 66 | {$IFDEF NEED_DISPLAY} 67 | MoveMnem(PInst, MNEM_VCVTPS2PH); 68 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 69 | {$ENDIF NEED_DISPLAY} 70 | end; 71 | 72 | procedure Decode_F16C_VCVTPS2PH_Wo_o_Vy_Ib(PInst: PInstruction); 73 | begin 74 | // VCVTPS2PH Wo.o,Vy,Ib 75 | PInst^.InstGroups := INST_GRP_F16C; 76 | PInst^.InstCategory := (INST_CATEGORY_16_BIT or INST_CATEGORY_CONVERT or 77 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SINGLE_PRECISION); 78 | PInst^.FlagsIndex := $00; 79 | MakeMndPrefix66(PInst); 80 | PInst^.InstID := INST_ID_VCVTPS2PH; 81 | Decode_Wo_o_Vy_Ib(PInst); 82 | {$IFDEF NEED_DISPLAY} 83 | MoveMnem(PInst, MNEM_VCVTPS2PH); 84 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 85 | {$ENDIF NEED_DISPLAY} 86 | end; 87 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/Format.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for /r %%i in (*.inc) do ( 3 | echo %%i 4 | Formatter.exe -delphi %%i 5 | ) 6 | pause -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/GROUPS.dec.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is GROUPS.dec.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_GROUP_1(PInst: PInstruction); forward; 25 | procedure Decode_GROUP_2(PInst: PInstruction); forward; 26 | procedure Decode_GROUP_3(PInst: PInstruction); forward; 27 | procedure Decode_GROUP_4(PInst: PInstruction); forward; 28 | procedure Decode_GROUP_5(PInst: PInstruction); forward; 29 | procedure Decode_GROUP_6(PInst: PInstruction); forward; 30 | procedure Decode_GROUP_7(PInst: PInstruction); forward; 31 | procedure Decode_GROUP_8(PInst: PInstruction); forward; 32 | procedure Decode_GROUP_9(PInst: PInstruction); forward; 33 | procedure Decode_GROUP_10(PInst: PInstruction); forward; 34 | procedure Decode_GROUP_11(PInst: PInstruction); forward; 35 | procedure Decode_GROUP_12(PInst: PInstruction); forward; 36 | procedure Decode_GROUP_13(PInst: PInstruction); forward; 37 | procedure Decode_GROUP_14(PInst: PInstruction); forward; 38 | procedure Decode_GROUP_15(PInst: PInstruction); forward; 39 | procedure Decode_GROUP_16(PInst: PInstruction); forward; 40 | procedure Decode_GROUP_17(PInst: PInstruction); forward; 41 | procedure Decode_GROUP_18(PInst: PInstruction); forward; 42 | procedure Decode_GROUP_1A(PInst: PInstruction); forward; 43 | procedure Decode_GROUP_XOP1(PInst: PInstruction); forward; 44 | procedure Decode_GROUP_XOP2(PInst: PInstruction); forward; 45 | procedure Decode_GROUP_XOP3(PInst: PInstruction); forward; 46 | procedure Decode_GROUP_XOP4(PInst: PInstruction); forward; 47 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/ICEBP.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is ICEBP.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_ICEBP_INT1_void(PInst: PInstruction); 25 | begin 26 | // INT1 void 27 | PInst^.InstGroups := INST_GRP_ICEBP; 28 | PInst^.FlagsIndex := $00; 29 | PInst^.InstID := INST_ID_INT1; 30 | Decode_void(PInst); 31 | {$IFDEF NEED_DISPLAY} 32 | MoveMnem(PInst, MNEM_INT1); 33 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 34 | {$ENDIF NEED_DISPLAY} 35 | end; 36 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/INVPCID.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is INVPCID.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_INVPCID_INVPCID_Gy_Mo(PInst: PInstruction); 25 | begin 26 | // INVPCID Gy,Mo 27 | PInst^.InstGroups := INST_GRP_INVPCID; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_INVPCID; 32 | Decode_Gy_Mo(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_INVPCID); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/LWP.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is LWP.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_LWP_LLWPCB_Ry(PInst: PInstruction); 25 | begin 26 | // LLWPCB Ry 27 | PInst^.InstGroups := INST_GRP_LWP; 28 | PInst^.FlagsIndex := $00; 29 | PInst^.InstID := INST_ID_LLWPCB; 30 | Decode_Ry(PInst); 31 | {$IFDEF NEED_DISPLAY} 32 | MoveMnem(PInst, MNEM_LLWPCB); 33 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 34 | {$ENDIF NEED_DISPLAY} 35 | end; 36 | 37 | procedure Decode_LWP_SLWPCB_Ry(PInst: PInstruction); 38 | begin 39 | // SLWPCB Ry 40 | PInst^.InstGroups := INST_GRP_LWP; 41 | PInst^.FlagsIndex := $00; 42 | PInst^.InstID := INST_ID_SLWPCB; 43 | Decode_Ry(PInst); 44 | {$IFDEF NEED_DISPLAY} 45 | MoveMnem(PInst, MNEM_SLWPCB); 46 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 47 | {$ENDIF NEED_DISPLAY} 48 | end; 49 | 50 | procedure Decode_LWP_LWPINS_By_Ed_Id(PInst: PInstruction); 51 | begin 52 | // LWPINS By,Ed,Id 53 | PInst^.InstGroups := INST_GRP_LWP; 54 | PInst^.FlagsIndex := $00; 55 | PInst^.InstID := INST_ID_LWPINS; 56 | Decode_By_Ed_Id(PInst); 57 | {$IFDEF NEED_DISPLAY} 58 | MoveMnem(PInst, MNEM_LWPINS); 59 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 60 | {$ENDIF NEED_DISPLAY} 61 | end; 62 | 63 | procedure Decode_LWP_LWPVAL_By_Ed_Id(PInst: PInstruction); 64 | begin 65 | // LWPVAL By,Ed,Id 66 | PInst^.InstGroups := INST_GRP_LWP; 67 | PInst^.FlagsIndex := $00; 68 | PInst^.InstID := INST_ID_LWPVAL; 69 | Decode_By_Ed_Id(PInst); 70 | {$IFDEF NEED_DISPLAY} 71 | MoveMnem(PInst, MNEM_LWPVAL); 72 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 73 | {$ENDIF NEED_DISPLAY} 74 | end; 75 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MEM-SSE.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MEM-SSE.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MEM_SSE_SFENCE_void(PInst: PInstruction); 25 | begin 26 | // SFENCE void 27 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE); 28 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 29 | INST_CATEGORY_STORE); 30 | PInst^.FlagsIndex := $00; 31 | PInst^.InstID := INST_ID_SFENCE; 32 | Decode_void(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_SFENCE); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_MEM_SSE_PREFETCHNTA_M(PInst: PInstruction); 40 | begin 41 | // PREFETCHNTA M 42 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE); 43 | PInst^.FlagsIndex := $00; 44 | PInst^.InstID := INST_ID_PREFETCHNTA; 45 | Decode_M(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_PREFETCHNTA); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_MEM_SSE_PREFETCHT0_M(PInst: PInstruction); 53 | begin 54 | // PREFETCHT0 M 55 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE); 56 | PInst^.FlagsIndex := $00; 57 | PInst^.InstID := INST_ID_PREFETCHT0; 58 | Decode_M(PInst); 59 | {$IFDEF NEED_DISPLAY} 60 | MoveMnem(PInst, MNEM_PREFETCHT0); 61 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 62 | {$ENDIF NEED_DISPLAY} 63 | end; 64 | 65 | procedure Decode_MEM_SSE_PREFETCHT1_M(PInst: PInstruction); 66 | begin 67 | // PREFETCHT1 M 68 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE); 69 | PInst^.FlagsIndex := $00; 70 | PInst^.InstID := INST_ID_PREFETCHT1; 71 | Decode_M(PInst); 72 | {$IFDEF NEED_DISPLAY} 73 | MoveMnem(PInst, MNEM_PREFETCHT1); 74 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 75 | {$ENDIF NEED_DISPLAY} 76 | end; 77 | 78 | procedure Decode_MEM_SSE_PREFETCHT2_M(PInst: PInstruction); 79 | begin 80 | // PREFETCHT2 M 81 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE); 82 | PInst^.FlagsIndex := $00; 83 | PInst^.InstID := INST_ID_PREFETCHT2; 84 | Decode_M(PInst); 85 | {$IFDEF NEED_DISPLAY} 86 | MoveMnem(PInst, MNEM_PREFETCHT2); 87 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 88 | {$ENDIF NEED_DISPLAY} 89 | end; 90 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MEM-SSE2.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MEM-SSE2.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MEM_SSE2_MOVNTI_My_Gy(PInst: PInstruction); 25 | begin 26 | // MOVNTI My,Gy 27 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE2); 28 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 29 | INST_CATEGORY_STORE); 30 | PInst^.FlagsIndex := $00; 31 | PInst^.InstID := INST_ID_MOVNTI; 32 | Decode_My_Gy(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_MOVNTI); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_MEM_SSE2_LFENCE_void(PInst: PInstruction); 40 | begin 41 | // LFENCE void 42 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE2); 43 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 44 | INST_CATEGORY_LOAD); 45 | PInst^.FlagsIndex := $00; 46 | PInst^.InstID := INST_ID_LFENCE; 47 | Decode_void(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_LFENCE); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_MEM_SSE2_MFENCE_void(PInst: PInstruction); 55 | begin 56 | // MFENCE void 57 | PInst^.InstGroups := (INST_GRP_MEM or INST_GRP_SSE2); 58 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 59 | INST_CATEGORY_LOAD or INST_CATEGORY_STORE); 60 | PInst^.FlagsIndex := $00; 61 | PInst^.InstID := INST_ID_MFENCE; 62 | Decode_void(PInst); 63 | {$IFDEF NEED_DISPLAY} 64 | MoveMnem(PInst, MNEM_MFENCE); 65 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 66 | {$ENDIF NEED_DISPLAY} 67 | end; 68 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MMX-SSE.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MMX-SSE.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MMX_SSE_CVTPI2PS_Vo_Nq(PInst: PInstruction); 25 | begin 26 | // CVTPI2PS Vo,Nq 27 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 28 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 29 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_INTEGER or 30 | INST_CATEGORY_PACKED or INST_CATEGORY_SINGLE_PRECISION); 31 | PInst^.FlagsIndex := $00; 32 | PInst^.InstID := INST_ID_CVTPI2PS; 33 | Decode_Vo_Nq(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_CVTPI2PS); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_MMX_SSE_CVTTPS2PI_Pq_Wo_q(PInst: PInstruction); 41 | begin 42 | // CVTTPS2PI Pq,Wo.q 43 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 44 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 45 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_INTEGER or 46 | INST_CATEGORY_PACKED or INST_CATEGORY_SINGLE_PRECISION); 47 | PInst^.FlagsIndex := $00; 48 | PInst^.InstID := INST_ID_CVTTPS2PI; 49 | Decode_Pq_Wo_q(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_CVTTPS2PI); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | 56 | procedure Decode_MMX_SSE_CVTPS2PI_Pq_Wo_q(PInst: PInstruction); 57 | begin 58 | // CVTPS2PI Pq,Wo.q 59 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 60 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 61 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_INTEGER or 62 | INST_CATEGORY_PACKED or INST_CATEGORY_SINGLE_PRECISION); 63 | PInst^.FlagsIndex := $00; 64 | PInst^.InstID := INST_ID_CVTPS2PI; 65 | Decode_Pq_Wo_q(PInst); 66 | {$IFDEF NEED_DISPLAY} 67 | MoveMnem(PInst, MNEM_CVTPS2PI); 68 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 69 | {$ENDIF NEED_DISPLAY} 70 | end; 71 | 72 | procedure Decode_MMX_SSE_PSHUFW_Pq_Qq_Ib(PInst: PInstruction); 73 | begin 74 | // PSHUFW Pq,Qq,Ib 75 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 76 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 77 | INST_CATEGORY_PACKED or INST_CATEGORY_SHUFFLE or INST_CATEGORY_SIMD); 78 | PInst^.FlagsIndex := $00; 79 | PInst^.InstID := INST_ID_PSHUFW; 80 | Decode_Pq_Qq_Ib(PInst); 81 | {$IFDEF NEED_DISPLAY} 82 | MoveMnem(PInst, MNEM_PSHUFW); 83 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 84 | {$ENDIF NEED_DISPLAY} 85 | end; 86 | 87 | procedure Decode_MMX_SSE_PINSRW_Pq_Mw_Ib(PInst: PInstruction); 88 | begin 89 | // PINSRW Pq,Mw,Ib 90 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 91 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 92 | INST_CATEGORY_SIMD); 93 | PInst^.FlagsIndex := $00; 94 | PInst^.InstID := INST_ID_PINSRW; 95 | Decode_Pq_Mw_Ib(PInst); 96 | {$IFDEF NEED_DISPLAY} 97 | MoveMnem(PInst, MNEM_PINSRW); 98 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 99 | {$ENDIF NEED_DISPLAY} 100 | end; 101 | 102 | procedure Decode_MMX_SSE_PINSRW_Pq_Rv_Ib(PInst: PInstruction); 103 | begin 104 | // PINSRW Pq,Rv,Ib 105 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 106 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 107 | INST_CATEGORY_SIMD); 108 | PInst^.FlagsIndex := $00; 109 | PInst^.InstID := INST_ID_PINSRW; 110 | Decode_Pq_Rv_Ib(PInst); 111 | {$IFDEF NEED_DISPLAY} 112 | MoveMnem(PInst, MNEM_PINSRW); 113 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 114 | {$ENDIF NEED_DISPLAY} 115 | end; 116 | 117 | procedure Decode_MMX_SSE_PEXTRW_Gy_Nq_Ib(PInst: PInstruction); 118 | begin 119 | // PEXTRW Gy,Nq,Ib 120 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 121 | PInst^.InstCategory := INST_CATEGORY_EXTRACTION; 122 | PInst^.FlagsIndex := $00; 123 | PInst^.InstID := INST_ID_PEXTRW; 124 | Decode_Gy_Nq_Ib(PInst); 125 | {$IFDEF NEED_DISPLAY} 126 | MoveMnem(PInst, MNEM_PEXTRW); 127 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 128 | {$ENDIF NEED_DISPLAY} 129 | end; 130 | 131 | procedure Decode_MMX_SSE_PMOVMSKB_Gy_Nq(PInst: PInstruction); 132 | begin 133 | // PMOVMSKB Gy,Nq 134 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 135 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 136 | INST_CATEGORY_SIMD); 137 | PInst^.FlagsIndex := $00; 138 | PInst^.InstID := INST_ID_PMOVMSKB; 139 | Decode_Gy_Nq(PInst); 140 | {$IFDEF NEED_DISPLAY} 141 | MoveMnem(PInst, MNEM_PMOVMSKB); 142 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 143 | {$ENDIF NEED_DISPLAY} 144 | end; 145 | 146 | procedure Decode_MMX_SSE_PMINUB_Pq_Qq(PInst: PInstruction); 147 | begin 148 | // PMINUB Pq,Qq 149 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 150 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 151 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_UNSIGNED); 152 | PInst^.FlagsIndex := $00; 153 | PInst^.InstID := INST_ID_PMINUB; 154 | Decode_Pq_Qq(PInst); 155 | {$IFDEF NEED_DISPLAY} 156 | MoveMnem(PInst, MNEM_PMINUB); 157 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 158 | {$ENDIF NEED_DISPLAY} 159 | end; 160 | 161 | procedure Decode_MMX_SSE_PMAXUB_Pq_Qq(PInst: PInstruction); 162 | begin 163 | // PMAXUB Pq,Qq 164 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 165 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 166 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_UNSIGNED); 167 | PInst^.FlagsIndex := $00; 168 | PInst^.InstID := INST_ID_PMAXUB; 169 | Decode_Pq_Qq(PInst); 170 | {$IFDEF NEED_DISPLAY} 171 | MoveMnem(PInst, MNEM_PMAXUB); 172 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 173 | {$ENDIF NEED_DISPLAY} 174 | end; 175 | 176 | procedure Decode_MMX_SSE_PAVGB_Pq_Qq(PInst: PInstruction); 177 | begin 178 | // PAVGB Pq,Qq 179 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 180 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 181 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_UNSIGNED); 182 | PInst^.FlagsIndex := $00; 183 | PInst^.InstID := INST_ID_PAVGB; 184 | Decode_Pq_Qq(PInst); 185 | {$IFDEF NEED_DISPLAY} 186 | MoveMnem(PInst, MNEM_PAVGB); 187 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 188 | {$ENDIF NEED_DISPLAY} 189 | end; 190 | 191 | procedure Decode_MMX_SSE_PAVGW_Pq_Qq(PInst: PInstruction); 192 | begin 193 | // PAVGW Pq,Qq 194 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 195 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 196 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_UNSIGNED); 197 | PInst^.FlagsIndex := $00; 198 | PInst^.InstID := INST_ID_PAVGW; 199 | Decode_Pq_Qq(PInst); 200 | {$IFDEF NEED_DISPLAY} 201 | MoveMnem(PInst, MNEM_PAVGW); 202 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 203 | {$ENDIF NEED_DISPLAY} 204 | end; 205 | 206 | procedure Decode_MMX_SSE_PMULHUW_Pq_Qq(PInst: PInstruction); 207 | begin 208 | // PMULHUW Pq,Qq 209 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 210 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 211 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_STORE or 212 | INST_CATEGORY_UNSIGNED); 213 | PInst^.FlagsIndex := $00; 214 | PInst^.InstID := INST_ID_PMULHUW; 215 | Decode_Pq_Qq(PInst); 216 | {$IFDEF NEED_DISPLAY} 217 | MoveMnem(PInst, MNEM_PMULHUW); 218 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 219 | {$ENDIF NEED_DISPLAY} 220 | end; 221 | 222 | procedure Decode_MMX_SSE_MOVNTQ_Mq_Pq(PInst: PInstruction); 223 | begin 224 | // MOVNTQ Mq,Pq 225 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 226 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 227 | INST_CATEGORY_STORE); 228 | PInst^.FlagsIndex := $00; 229 | PInst^.InstID := INST_ID_MOVNTQ; 230 | Decode_Mq_Pq(PInst); 231 | {$IFDEF NEED_DISPLAY} 232 | MoveMnem(PInst, MNEM_MOVNTQ); 233 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 234 | {$ENDIF NEED_DISPLAY} 235 | end; 236 | 237 | procedure Decode_MMX_SSE_PMINSW_Pq_Qq(PInst: PInstruction); 238 | begin 239 | // PMINSW Pq,Qq 240 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 241 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 242 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED or INST_CATEGORY_SIMD); 243 | PInst^.FlagsIndex := $00; 244 | PInst^.InstID := INST_ID_PMINSW; 245 | Decode_Pq_Qq(PInst); 246 | {$IFDEF NEED_DISPLAY} 247 | MoveMnem(PInst, MNEM_PMINSW); 248 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 249 | {$ENDIF NEED_DISPLAY} 250 | end; 251 | 252 | procedure Decode_MMX_SSE_PMAXSW_Pq_Qq(PInst: PInstruction); 253 | begin 254 | // PMAXSW Pq,Qq 255 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 256 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 257 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED or INST_CATEGORY_SIMD); 258 | PInst^.FlagsIndex := $00; 259 | PInst^.InstID := INST_ID_PMAXSW; 260 | Decode_Pq_Qq(PInst); 261 | {$IFDEF NEED_DISPLAY} 262 | MoveMnem(PInst, MNEM_PMAXSW); 263 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 264 | {$ENDIF NEED_DISPLAY} 265 | end; 266 | 267 | procedure Decode_MMX_SSE_PSADBW_Pq_Qq(PInst: PInstruction); 268 | begin 269 | // PSADBW Pq,Qq 270 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 271 | PInst^.InstCategory := (INST_CATEGORY_64_BIT or INST_CATEGORY_INTEGER or 272 | INST_CATEGORY_SIMD); 273 | PInst^.FlagsIndex := $00; 274 | PInst^.InstID := INST_ID_PSADBW; 275 | Decode_Pq_Qq(PInst); 276 | {$IFDEF NEED_DISPLAY} 277 | MoveMnem(PInst, MNEM_PSADBW); 278 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 279 | {$ENDIF NEED_DISPLAY} 280 | end; 281 | 282 | procedure Decode_MMX_SSE_MASKMOVQ_Pq_Nq(PInst: PInstruction); 283 | begin 284 | // MASKMOVQ Pq,Nq 285 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE); 286 | PInst^.InstCategory := (INST_CATEGORY_CACHEABILITY_CONTROL or 287 | INST_CATEGORY_STORE); 288 | PInst^.FlagsIndex := $00; 289 | PInst^.InstID := INST_ID_MASKMOVQ; 290 | Decode_Pq_Nq(PInst); 291 | {$IFDEF NEED_DISPLAY} 292 | MoveMnem(PInst, MNEM_MASKMOVQ); 293 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 294 | {$ENDIF NEED_DISPLAY} 295 | end; 296 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MMX-SSE2.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MMX-SSE2.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MMX_SSE2_CVTPI2PD_Vo_Nq(PInst: PInstruction); 25 | begin 26 | // CVTPI2PD Vo,Nq 27 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 28 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 29 | INST_CATEGORY_DOUBLE_PRECISION or INST_CATEGORY_FLOATING_POINT or 30 | INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED); 31 | PInst^.FlagsIndex := $00; 32 | MakeMndPrefix66(PInst); 33 | PInst^.InstID := INST_ID_CVTPI2PD; 34 | Decode_Vo_Nq(PInst); 35 | {$IFDEF NEED_DISPLAY} 36 | MoveMnem(PInst, MNEM_CVTPI2PD); 37 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 38 | {$ENDIF NEED_DISPLAY} 39 | end; 40 | 41 | procedure Decode_MMX_SSE2_CVTTPD2PI_Pq_Wo(PInst: PInstruction); 42 | begin 43 | // CVTTPD2PI Pq,Wo 44 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 45 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 46 | INST_CATEGORY_DOUBLE_PRECISION or INST_CATEGORY_FLOATING_POINT or 47 | INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED); 48 | PInst^.FlagsIndex := $00; 49 | MakeMndPrefix66(PInst); 50 | PInst^.InstID := INST_ID_CVTTPD2PI; 51 | Decode_Pq_Wo(PInst); 52 | {$IFDEF NEED_DISPLAY} 53 | MoveMnem(PInst, MNEM_CVTTPD2PI); 54 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 55 | {$ENDIF NEED_DISPLAY} 56 | end; 57 | 58 | procedure Decode_MMX_SSE2_CVTPD2PI_Pq_Wo(PInst: PInstruction); 59 | begin 60 | // CVTPD2PI Pq,Wo 61 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 62 | PInst^.InstCategory := (INST_CATEGORY_CONVERT or 63 | INST_CATEGORY_DOUBLE_PRECISION or INST_CATEGORY_FLOATING_POINT or 64 | INST_CATEGORY_PACKED); 65 | PInst^.FlagsIndex := $00; 66 | MakeMndPrefix66(PInst); 67 | PInst^.InstID := INST_ID_CVTPD2PI; 68 | Decode_Pq_Wo(PInst); 69 | {$IFDEF NEED_DISPLAY} 70 | MoveMnem(PInst, MNEM_CVTPD2PI); 71 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 72 | {$ENDIF NEED_DISPLAY} 73 | end; 74 | 75 | procedure Decode_MMX_SSE2_PADDQ_Pq_Qq(PInst: PInstruction); 76 | begin 77 | // PADDQ Pq,Qq 78 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 79 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_INTEGER or 80 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD); 81 | PInst^.FlagsIndex := $00; 82 | PInst^.InstID := INST_ID_PADDQ; 83 | Decode_Pq_Qq(PInst); 84 | {$IFDEF NEED_DISPLAY} 85 | MoveMnem(PInst, MNEM_PADDQ); 86 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 87 | {$ENDIF NEED_DISPLAY} 88 | end; 89 | 90 | procedure Decode_MMX_SSE2_MOVDQ2Q_Pq_Uq(PInst: PInstruction); 91 | begin 92 | // MOVDQ2Q Pq,Uq 93 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 94 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_INTEGER or 95 | INST_CATEGORY_SIMD); 96 | PInst^.FlagsIndex := $00; 97 | MakeMndPrefixF2(PInst); 98 | PInst^.InstID := INST_ID_MOVDQ2Q; 99 | Decode_Pq_Uq(PInst); 100 | {$IFDEF NEED_DISPLAY} 101 | MoveMnem(PInst, MNEM_MOVDQ2Q); 102 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 103 | {$ENDIF NEED_DISPLAY} 104 | end; 105 | 106 | procedure Decode_MMX_SSE2_MOVQ2DQ_Vo_Nq(PInst: PInstruction); 107 | begin 108 | // MOVQ2DQ Vo,Nq 109 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 110 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_INTEGER or 111 | INST_CATEGORY_SIMD); 112 | PInst^.FlagsIndex := $00; 113 | MakeMndPrefixF3(PInst); 114 | PInst^.InstID := INST_ID_MOVQ2DQ; 115 | Decode_Vo_Nq(PInst); 116 | {$IFDEF NEED_DISPLAY} 117 | MoveMnem(PInst, MNEM_MOVQ2DQ); 118 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 119 | {$ENDIF NEED_DISPLAY} 120 | end; 121 | 122 | procedure Decode_MMX_SSE2_PMULUDQ_Pq_Qq(PInst: PInstruction); 123 | begin 124 | // PMULUDQ Pq,Qq 125 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 126 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_INTEGER or 127 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD or INST_CATEGORY_UNSIGNED); 128 | PInst^.FlagsIndex := $00; 129 | PInst^.InstID := INST_ID_PMULUDQ; 130 | Decode_Pq_Qq(PInst); 131 | {$IFDEF NEED_DISPLAY} 132 | MoveMnem(PInst, MNEM_PMULUDQ); 133 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 134 | {$ENDIF NEED_DISPLAY} 135 | end; 136 | 137 | procedure Decode_MMX_SSE2_PSUBQ_Pq_Qq(PInst: PInstruction); 138 | begin 139 | // PSUBQ Pq,Qq 140 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSE2); 141 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_INTEGER or 142 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD); 143 | PInst^.FlagsIndex := $00; 144 | PInst^.InstID := INST_ID_PSUBQ; 145 | Decode_Pq_Qq(PInst); 146 | {$IFDEF NEED_DISPLAY} 147 | MoveMnem(PInst, MNEM_PSUBQ); 148 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 149 | {$ENDIF NEED_DISPLAY} 150 | end; 151 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MMX-SSSE3.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MMX-SSSE3.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MMX_SSSE3_PSHUFB_Pq_Qq(PInst: PInstruction); 25 | begin 26 | // PSHUFB Pq,Qq 27 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 28 | PInst^.InstCategory := INST_CATEGORY_SHUFFLE; 29 | PInst^.FlagsIndex := $00; 30 | PInst^.InstID := INST_ID_PSHUFB; 31 | Decode_Pq_Qq(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_PSHUFB); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_MMX_SSSE3_PHADDW_Pq_Qq(PInst: PInstruction); 39 | begin 40 | // PHADDW Pq,Qq 41 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 42 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 43 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 44 | PInst^.FlagsIndex := $00; 45 | PInst^.InstID := INST_ID_PHADDW; 46 | Decode_Pq_Qq(PInst); 47 | {$IFDEF NEED_DISPLAY} 48 | MoveMnem(PInst, MNEM_PHADDW); 49 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 50 | {$ENDIF NEED_DISPLAY} 51 | end; 52 | 53 | procedure Decode_MMX_SSSE3_PHADDD_Pq_Qq(PInst: PInstruction); 54 | begin 55 | // PHADDD Pq,Qq 56 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 57 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 58 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 59 | PInst^.FlagsIndex := $00; 60 | PInst^.InstID := INST_ID_PHADDD; 61 | Decode_Pq_Qq(PInst); 62 | {$IFDEF NEED_DISPLAY} 63 | MoveMnem(PInst, MNEM_PHADDD); 64 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 65 | {$ENDIF NEED_DISPLAY} 66 | end; 67 | 68 | procedure Decode_MMX_SSSE3_PHADDSW_Pq_Qq(PInst: PInstruction); 69 | begin 70 | // PHADDSW Pq,Qq 71 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 72 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 73 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 74 | PInst^.FlagsIndex := $00; 75 | PInst^.InstID := INST_ID_PHADDSW; 76 | Decode_Pq_Qq(PInst); 77 | {$IFDEF NEED_DISPLAY} 78 | MoveMnem(PInst, MNEM_PHADDSW); 79 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 80 | {$ENDIF NEED_DISPLAY} 81 | end; 82 | 83 | procedure Decode_MMX_SSSE3_PMADDUBSW_Pq_Qq(PInst: PInstruction); 84 | begin 85 | // PMADDUBSW Pq,Qq 86 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 87 | PInst^.InstCategory := (INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED or 88 | INST_CATEGORY_UNSIGNED); 89 | PInst^.FlagsIndex := $00; 90 | PInst^.InstID := INST_ID_PMADDUBSW; 91 | Decode_Pq_Qq(PInst); 92 | {$IFDEF NEED_DISPLAY} 93 | MoveMnem(PInst, MNEM_PMADDUBSW); 94 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 95 | {$ENDIF NEED_DISPLAY} 96 | end; 97 | 98 | procedure Decode_MMX_SSSE3_PHSUBW_Pq_Qq(PInst: PInstruction); 99 | begin 100 | // PHSUBW Pq,Qq 101 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 102 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 103 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 104 | PInst^.FlagsIndex := $00; 105 | PInst^.InstID := INST_ID_PHSUBW; 106 | Decode_Pq_Qq(PInst); 107 | {$IFDEF NEED_DISPLAY} 108 | MoveMnem(PInst, MNEM_PHSUBW); 109 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 110 | {$ENDIF NEED_DISPLAY} 111 | end; 112 | 113 | procedure Decode_MMX_SSSE3_PHSUBD_Pq_Qq(PInst: PInstruction); 114 | begin 115 | // PHSUBD Pq,Qq 116 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 117 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 118 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 119 | PInst^.FlagsIndex := $00; 120 | PInst^.InstID := INST_ID_PHSUBD; 121 | Decode_Pq_Qq(PInst); 122 | {$IFDEF NEED_DISPLAY} 123 | MoveMnem(PInst, MNEM_PHSUBD); 124 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 125 | {$ENDIF NEED_DISPLAY} 126 | end; 127 | 128 | procedure Decode_MMX_SSSE3_PHSUBSW_Pq_Qq(PInst: PInstruction); 129 | begin 130 | // PHSUBSW Pq,Qq 131 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 132 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 133 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 134 | PInst^.FlagsIndex := $00; 135 | PInst^.InstID := INST_ID_PHSUBSW; 136 | Decode_Pq_Qq(PInst); 137 | {$IFDEF NEED_DISPLAY} 138 | MoveMnem(PInst, MNEM_PHSUBSW); 139 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 140 | {$ENDIF NEED_DISPLAY} 141 | end; 142 | 143 | procedure Decode_MMX_SSSE3_PSIGNB_Pq_Qq(PInst: PInstruction); 144 | begin 145 | // PSIGNB Pq,Qq 146 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 147 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 148 | PInst^.FlagsIndex := $00; 149 | PInst^.InstID := INST_ID_PSIGNB; 150 | Decode_Pq_Qq(PInst); 151 | {$IFDEF NEED_DISPLAY} 152 | MoveMnem(PInst, MNEM_PSIGNB); 153 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 154 | {$ENDIF NEED_DISPLAY} 155 | end; 156 | 157 | procedure Decode_MMX_SSSE3_PSIGNW_Pq_Qq(PInst: PInstruction); 158 | begin 159 | // PSIGNW Pq,Qq 160 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 161 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 162 | PInst^.FlagsIndex := $00; 163 | PInst^.InstID := INST_ID_PSIGNW; 164 | Decode_Pq_Qq(PInst); 165 | {$IFDEF NEED_DISPLAY} 166 | MoveMnem(PInst, MNEM_PSIGNW); 167 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 168 | {$ENDIF NEED_DISPLAY} 169 | end; 170 | 171 | procedure Decode_MMX_SSSE3_PSIGND_Pq_Qq(PInst: PInstruction); 172 | begin 173 | // PSIGND Pq,Qq 174 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 175 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 176 | PInst^.FlagsIndex := $00; 177 | PInst^.InstID := INST_ID_PSIGND; 178 | Decode_Pq_Qq(PInst); 179 | {$IFDEF NEED_DISPLAY} 180 | MoveMnem(PInst, MNEM_PSIGND); 181 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 182 | {$ENDIF NEED_DISPLAY} 183 | end; 184 | 185 | procedure Decode_MMX_SSSE3_PMULHRSW_Pq_Qq(PInst: PInstruction); 186 | begin 187 | // PMULHRSW Pq,Qq 188 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 189 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED or 190 | INST_CATEGORY_ROUND or INST_CATEGORY_SCALE or INST_CATEGORY_SIGNED); 191 | PInst^.FlagsIndex := $00; 192 | PInst^.InstID := INST_ID_PMULHRSW; 193 | Decode_Pq_Qq(PInst); 194 | {$IFDEF NEED_DISPLAY} 195 | MoveMnem(PInst, MNEM_PMULHRSW); 196 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 197 | {$ENDIF NEED_DISPLAY} 198 | end; 199 | 200 | procedure Decode_MMX_SSSE3_PABSB_Pq_Qq(PInst: PInstruction); 201 | begin 202 | // PABSB Pq,Qq 203 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 204 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 205 | PInst^.FlagsIndex := $00; 206 | PInst^.InstID := INST_ID_PABSB; 207 | Decode_Pq_Qq(PInst); 208 | {$IFDEF NEED_DISPLAY} 209 | MoveMnem(PInst, MNEM_PABSB); 210 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 211 | {$ENDIF NEED_DISPLAY} 212 | end; 213 | 214 | procedure Decode_MMX_SSSE3_PABSW_Pq_Qq(PInst: PInstruction); 215 | begin 216 | // PABSW Pq,Qq 217 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 218 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 219 | PInst^.FlagsIndex := $00; 220 | PInst^.InstID := INST_ID_PABSW; 221 | Decode_Pq_Qq(PInst); 222 | {$IFDEF NEED_DISPLAY} 223 | MoveMnem(PInst, MNEM_PABSW); 224 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 225 | {$ENDIF NEED_DISPLAY} 226 | end; 227 | 228 | procedure Decode_MMX_SSSE3_PABSD_Pq_Qq(PInst: PInstruction); 229 | begin 230 | // PABSD Pq,Qq 231 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 232 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 233 | PInst^.FlagsIndex := $00; 234 | PInst^.InstID := INST_ID_PABSD; 235 | Decode_Pq_Qq(PInst); 236 | {$IFDEF NEED_DISPLAY} 237 | MoveMnem(PInst, MNEM_PABSD); 238 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 239 | {$ENDIF NEED_DISPLAY} 240 | end; 241 | 242 | procedure Decode_MMX_SSSE3_PALIGNR_Pq_Qq_Ib(PInst: PInstruction); 243 | begin 244 | // PALIGNR Pq,Qq,Ib 245 | PInst^.InstGroups := (INST_GRP_MMX or INST_GRP_SSSE3); 246 | PInst^.InstCategory := INST_CATEGORY_ALIGN_RIGHT; 247 | PInst^.FlagsIndex := $00; 248 | PInst^.InstID := INST_ID_PALIGNR; 249 | Decode_Pq_Qq_Ib(PInst); 250 | {$IFDEF NEED_DISPLAY} 251 | MoveMnem(PInst, MNEM_PALIGNR); 252 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 253 | {$ENDIF NEED_DISPLAY} 254 | end; 255 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/MPX.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is MPX.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_MPX_BNDLDX_rB_Mib(PInst: PInstruction); 25 | begin 26 | // BNDLDX rB,Mib 27 | PInst^.InstGroups := INST_GRP_MPX; 28 | PInst^.FlagsIndex := $00; 29 | PInst^.InstID := INST_ID_BNDLDX; 30 | Decode_rB_Mib(PInst); 31 | {$IFDEF NEED_DISPLAY} 32 | MoveMnem(PInst, MNEM_BNDLDX); 33 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 34 | {$ENDIF NEED_DISPLAY} 35 | end; 36 | 37 | procedure Decode_MPX_BNDMOV_rB_mB(PInst: PInstruction); 38 | begin 39 | // BNDMOV rB,mB 40 | PInst^.InstGroups := INST_GRP_MPX; 41 | PInst^.FlagsIndex := $00; 42 | MakeMndPrefix66(PInst); 43 | PInst^.InstID := INST_ID_BNDMOV; 44 | Decode_rB_mB(PInst); 45 | {$IFDEF NEED_DISPLAY} 46 | MoveMnem(PInst, MNEM_BNDMOV); 47 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 48 | {$ENDIF NEED_DISPLAY} 49 | end; 50 | 51 | procedure Decode_MPX_BNDMOV_rB_M(PInst: PInstruction); 52 | begin 53 | // BNDMOV rB,M 54 | PInst^.InstGroups := INST_GRP_MPX; 55 | PInst^.FlagsIndex := $00; 56 | MakeMndPrefix66(PInst); 57 | PInst^.InstID := INST_ID_BNDMOV; 58 | Decode_rB_M(PInst); 59 | {$IFDEF NEED_DISPLAY} 60 | MoveMnem(PInst, MNEM_BNDMOV); 61 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 62 | {$ENDIF NEED_DISPLAY} 63 | end; 64 | 65 | procedure Decode_MPX_BNDCL_rB_Ey(PInst: PInstruction); 66 | begin 67 | // BNDCL rB,Ey 68 | PInst^.InstGroups := INST_GRP_MPX; 69 | PInst^.FlagsIndex := $00; 70 | MakeMndPrefixF3(PInst); 71 | PInst^.InstID := INST_ID_BNDCL; 72 | Decode_rB_Ey(PInst); 73 | {$IFDEF NEED_DISPLAY} 74 | MoveMnem(PInst, MNEM_BNDCL); 75 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 76 | {$ENDIF NEED_DISPLAY} 77 | end; 78 | 79 | procedure Decode_MPX_BNDCU_rB_Ey(PInst: PInstruction); 80 | begin 81 | // BNDCU rB,Ey 82 | PInst^.InstGroups := INST_GRP_MPX; 83 | PInst^.FlagsIndex := $00; 84 | MakeMndPrefixF2(PInst); 85 | PInst^.InstID := INST_ID_BNDCU; 86 | Decode_rB_Ey(PInst); 87 | {$IFDEF NEED_DISPLAY} 88 | MoveMnem(PInst, MNEM_BNDCU); 89 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 90 | {$ENDIF NEED_DISPLAY} 91 | end; 92 | 93 | procedure Decode_MPX_BNDSTX_Mib_rB(PInst: PInstruction); 94 | begin 95 | // BNDSTX Mib,rB 96 | PInst^.InstGroups := INST_GRP_MPX; 97 | PInst^.FlagsIndex := $00; 98 | PInst^.InstID := INST_ID_BNDSTX; 99 | Decode_Mib_rB(PInst); 100 | {$IFDEF NEED_DISPLAY} 101 | MoveMnem(PInst, MNEM_BNDSTX); 102 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 103 | {$ENDIF NEED_DISPLAY} 104 | end; 105 | 106 | procedure Decode_MPX_BNDMOV_mB_rB(PInst: PInstruction); 107 | begin 108 | // BNDMOV mB,rB 109 | PInst^.InstGroups := INST_GRP_MPX; 110 | PInst^.FlagsIndex := $00; 111 | MakeMndPrefix66(PInst); 112 | PInst^.InstID := INST_ID_BNDMOV; 113 | Decode_mB_rB(PInst); 114 | {$IFDEF NEED_DISPLAY} 115 | MoveMnem(PInst, MNEM_BNDMOV); 116 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 117 | {$ENDIF NEED_DISPLAY} 118 | end; 119 | 120 | procedure Decode_MPX_BNDMOV_M_rB(PInst: PInstruction); 121 | begin 122 | // BNDMOV M,rB 123 | PInst^.InstGroups := INST_GRP_MPX; 124 | PInst^.FlagsIndex := $00; 125 | MakeMndPrefix66(PInst); 126 | PInst^.InstID := INST_ID_BNDMOV; 127 | Decode_M_rB(PInst); 128 | {$IFDEF NEED_DISPLAY} 129 | MoveMnem(PInst, MNEM_BNDMOV); 130 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 131 | {$ENDIF NEED_DISPLAY} 132 | end; 133 | 134 | procedure Decode_MPX_BNDMK_rB_My(PInst: PInstruction); 135 | begin 136 | // BNDMK rB,My 137 | PInst^.InstGroups := INST_GRP_MPX; 138 | PInst^.FlagsIndex := $00; 139 | MakeMndPrefixF3(PInst); 140 | PInst^.InstID := INST_ID_BNDMK; 141 | Decode_rB_My(PInst); 142 | {$IFDEF NEED_DISPLAY} 143 | MoveMnem(PInst, MNEM_BNDMK); 144 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 145 | {$ENDIF NEED_DISPLAY} 146 | end; 147 | 148 | procedure Decode_MPX_BNDCN_rB_Ey(PInst: PInstruction); 149 | begin 150 | // BNDCN rB,Ey 151 | PInst^.InstGroups := INST_GRP_MPX; 152 | PInst^.FlagsIndex := $00; 153 | MakeMndPrefixF2(PInst); 154 | PInst^.InstID := INST_ID_BNDCN; 155 | Decode_rB_Ey(PInst); 156 | {$IFDEF NEED_DISPLAY} 157 | MoveMnem(PInst, MNEM_BNDCN); 158 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 159 | {$ENDIF NEED_DISPLAY} 160 | end; 161 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/PCLMUL.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is PCLMUL.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_PCLMUL_PCLMULQDQ_Vo_Wo_Ib(PInst: PInstruction); 25 | begin 26 | // PCLMULQDQ Vo,Wo,Ib 27 | PInst^.InstGroups := INST_GRP_PCLMUL; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_PCLMULQDQ; 32 | Decode_Vo_Wo_Ib(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_PCLMULQDQ); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SHA.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SHA.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SHA_SHA1NEXTE_Vo_Wo(PInst: PInstruction); 25 | begin 26 | // SHA1NEXTE Vo,Wo 27 | PInst^.InstGroups := INST_GRP_SHA; 28 | PInst^.FlagsIndex := $00; 29 | PInst^.InstID := INST_ID_SHA1NEXTE; 30 | Decode_Vo_Wo(PInst); 31 | {$IFDEF NEED_DISPLAY} 32 | MoveMnem(PInst, MNEM_SHA1NEXTE); 33 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 34 | {$ENDIF NEED_DISPLAY} 35 | end; 36 | 37 | procedure Decode_SHA_SHA1MSG1_Vo_Wo(PInst: PInstruction); 38 | begin 39 | // SHA1MSG1 Vo,Wo 40 | PInst^.InstGroups := INST_GRP_SHA; 41 | PInst^.FlagsIndex := $00; 42 | PInst^.InstID := INST_ID_SHA1MSG1; 43 | Decode_Vo_Wo(PInst); 44 | {$IFDEF NEED_DISPLAY} 45 | MoveMnem(PInst, MNEM_SHA1MSG1); 46 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 47 | {$ENDIF NEED_DISPLAY} 48 | end; 49 | 50 | procedure Decode_SHA_SHA1MSG2_Vo_Wo(PInst: PInstruction); 51 | begin 52 | // SHA1MSG2 Vo,Wo 53 | PInst^.InstGroups := INST_GRP_SHA; 54 | PInst^.FlagsIndex := $00; 55 | PInst^.InstID := INST_ID_SHA1MSG2; 56 | Decode_Vo_Wo(PInst); 57 | {$IFDEF NEED_DISPLAY} 58 | MoveMnem(PInst, MNEM_SHA1MSG2); 59 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 60 | {$ENDIF NEED_DISPLAY} 61 | end; 62 | 63 | procedure Decode_SHA_SHA256RNDS2_Vo_Wo(PInst: PInstruction); 64 | begin 65 | // SHA256RNDS2 Vo,Wo 66 | PInst^.InstGroups := INST_GRP_SHA; 67 | PInst^.FlagsIndex := $00; 68 | PInst^.InstID := INST_ID_SHA256RNDS2; 69 | Decode_Vo_Wo(PInst); 70 | {$IFDEF NEED_DISPLAY} 71 | MoveMnem(PInst, MNEM_SHA256RNDS2); 72 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 73 | {$ENDIF NEED_DISPLAY} 74 | end; 75 | 76 | procedure Decode_SHA_SHA256MSG1_Vo_Wo(PInst: PInstruction); 77 | begin 78 | // SHA256MSG1 Vo,Wo 79 | PInst^.InstGroups := INST_GRP_SHA; 80 | PInst^.FlagsIndex := $00; 81 | PInst^.InstID := INST_ID_SHA256MSG1; 82 | Decode_Vo_Wo(PInst); 83 | {$IFDEF NEED_DISPLAY} 84 | MoveMnem(PInst, MNEM_SHA256MSG1); 85 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 86 | {$ENDIF NEED_DISPLAY} 87 | end; 88 | 89 | procedure Decode_SHA_SHA256MSG2_Vo_Wo(PInst: PInstruction); 90 | begin 91 | // SHA256MSG2 Vo,Wo 92 | PInst^.InstGroups := INST_GRP_SHA; 93 | PInst^.FlagsIndex := $00; 94 | PInst^.InstID := INST_ID_SHA256MSG2; 95 | Decode_Vo_Wo(PInst); 96 | {$IFDEF NEED_DISPLAY} 97 | MoveMnem(PInst, MNEM_SHA256MSG2); 98 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 99 | {$ENDIF NEED_DISPLAY} 100 | end; 101 | 102 | procedure Decode_SHA_SHA1RNDS4_Vo_Wo_Ib(PInst: PInstruction); 103 | begin 104 | // SHA1RNDS4 Vo,Wo,Ib 105 | PInst^.InstGroups := INST_GRP_SHA; 106 | PInst^.FlagsIndex := $00; 107 | PInst^.InstID := INST_ID_SHA1RNDS4; 108 | Decode_Vo_Wo_Ib(PInst); 109 | {$IFDEF NEED_DISPLAY} 110 | MoveMnem(PInst, MNEM_SHA1RNDS4); 111 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 112 | {$ENDIF NEED_DISPLAY} 113 | end; 114 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SMM.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SMM.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SMM_RSM_void(PInst: PInstruction); 25 | begin 26 | // RSM void 27 | PInst^.InstGroups := INST_GRP_SMM; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $58; 30 | PInst^.InstID := INST_ID_RSM; 31 | Decode_void(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_RSM); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SSE3.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SSE3.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SSE3_MOVDDUP_Vo_Wo_q(PInst: PInstruction); 25 | begin 26 | // MOVDDUP Vo,Wo.q 27 | PInst^.InstGroups := INST_GRP_SSE3; 28 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SIMD); 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefixF2(PInst); 31 | PInst^.InstID := INST_ID_MOVDDUP; 32 | Decode_Vo_Wo_q(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_MOVDDUP); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_SSE3_MOVSLDUP_Vo_Wo(PInst: PInstruction); 40 | begin 41 | // MOVSLDUP Vo,Wo 42 | PInst^.InstGroups := INST_GRP_SSE3; 43 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SIMD); 44 | PInst^.FlagsIndex := $00; 45 | MakeMndPrefixF3(PInst); 46 | PInst^.InstID := INST_ID_MOVSLDUP; 47 | Decode_Vo_Wo(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_MOVSLDUP); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | 54 | procedure Decode_SSE3_MOVSHDUP_Vo_Wo(PInst: PInstruction); 55 | begin 56 | // MOVSHDUP Vo,Wo 57 | PInst^.InstGroups := INST_GRP_SSE3; 58 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SIMD); 59 | PInst^.FlagsIndex := $00; 60 | MakeMndPrefixF3(PInst); 61 | PInst^.InstID := INST_ID_MOVSHDUP; 62 | Decode_Vo_Wo(PInst); 63 | {$IFDEF NEED_DISPLAY} 64 | MoveMnem(PInst, MNEM_MOVSHDUP); 65 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 66 | {$ENDIF NEED_DISPLAY} 67 | end; 68 | 69 | procedure Decode_SSE3_HADDPD_Vo_Wo(PInst: PInstruction); 70 | begin 71 | // HADDPD Vo,Wo 72 | PInst^.InstGroups := INST_GRP_SSE3; 73 | PInst^.InstCategory := (INST_CATEGORY_DOUBLE_PRECISION or 74 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_HORIZONTAL or 75 | INST_CATEGORY_SIMD); 76 | PInst^.FlagsIndex := $00; 77 | MakeMndPrefix66(PInst); 78 | PInst^.InstID := INST_ID_HADDPD; 79 | Decode_Vo_Wo(PInst); 80 | {$IFDEF NEED_DISPLAY} 81 | MoveMnem(PInst, MNEM_HADDPD); 82 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 83 | {$ENDIF NEED_DISPLAY} 84 | end; 85 | 86 | procedure Decode_SSE3_HADDPS_Vo_Wo(PInst: PInstruction); 87 | begin 88 | // HADDPS Vo,Wo 89 | PInst^.InstGroups := INST_GRP_SSE3; 90 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or 91 | INST_CATEGORY_HORIZONTAL or INST_CATEGORY_SIMD or 92 | INST_CATEGORY_SINGLE_PRECISION); 93 | PInst^.FlagsIndex := $00; 94 | MakeMndPrefixF2(PInst); 95 | PInst^.InstID := INST_ID_HADDPS; 96 | Decode_Vo_Wo(PInst); 97 | {$IFDEF NEED_DISPLAY} 98 | MoveMnem(PInst, MNEM_HADDPS); 99 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 100 | {$ENDIF NEED_DISPLAY} 101 | end; 102 | 103 | procedure Decode_SSE3_HSUBPD_Vo_Wo(PInst: PInstruction); 104 | begin 105 | // HSUBPD Vo,Wo 106 | PInst^.InstGroups := INST_GRP_SSE3; 107 | PInst^.InstCategory := (INST_CATEGORY_DOUBLE_PRECISION or 108 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_HORIZONTAL or 109 | INST_CATEGORY_SIMD); 110 | PInst^.FlagsIndex := $00; 111 | MakeMndPrefix66(PInst); 112 | PInst^.InstID := INST_ID_HSUBPD; 113 | Decode_Vo_Wo(PInst); 114 | {$IFDEF NEED_DISPLAY} 115 | MoveMnem(PInst, MNEM_HSUBPD); 116 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 117 | {$ENDIF NEED_DISPLAY} 118 | end; 119 | 120 | procedure Decode_SSE3_HSUBPS_Vo_Wo(PInst: PInstruction); 121 | begin 122 | // HSUBPS Vo,Wo 123 | PInst^.InstGroups := INST_GRP_SSE3; 124 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or 125 | INST_CATEGORY_HORIZONTAL or INST_CATEGORY_SIMD or 126 | INST_CATEGORY_SINGLE_PRECISION); 127 | PInst^.FlagsIndex := $00; 128 | MakeMndPrefixF2(PInst); 129 | PInst^.InstID := INST_ID_HSUBPS; 130 | Decode_Vo_Wo(PInst); 131 | {$IFDEF NEED_DISPLAY} 132 | MoveMnem(PInst, MNEM_HSUBPS); 133 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 134 | {$ENDIF NEED_DISPLAY} 135 | end; 136 | 137 | procedure Decode_SSE3_ADDSUBPD_Vo_Wo(PInst: PInstruction); 138 | begin 139 | // ADDSUBPD Vo,Wo 140 | PInst^.InstGroups := INST_GRP_SSE3; 141 | PInst^.InstCategory := (INST_CATEGORY_DOUBLE_PRECISION or 142 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SIMD); 143 | PInst^.FlagsIndex := $00; 144 | MakeMndPrefix66(PInst); 145 | PInst^.InstID := INST_ID_ADDSUBPD; 146 | Decode_Vo_Wo(PInst); 147 | {$IFDEF NEED_DISPLAY} 148 | MoveMnem(PInst, MNEM_ADDSUBPD); 149 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 150 | {$ENDIF NEED_DISPLAY} 151 | end; 152 | 153 | procedure Decode_SSE3_ADDSUBPS_Vo_Wo(PInst: PInstruction); 154 | begin 155 | // ADDSUBPS Vo,Wo 156 | PInst^.InstGroups := INST_GRP_SSE3; 157 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_SIMD or 158 | INST_CATEGORY_SINGLE_PRECISION); 159 | PInst^.FlagsIndex := $00; 160 | MakeMndPrefixF2(PInst); 161 | PInst^.InstID := INST_ID_ADDSUBPS; 162 | Decode_Vo_Wo(PInst); 163 | {$IFDEF NEED_DISPLAY} 164 | MoveMnem(PInst, MNEM_ADDSUBPS); 165 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 166 | {$ENDIF NEED_DISPLAY} 167 | end; 168 | 169 | procedure Decode_SSE3_LDDQU_Vo_Mo(PInst: PInstruction); 170 | begin 171 | // LDDQU Vo,Mo 172 | PInst^.InstGroups := INST_GRP_SSE3; 173 | PInst^.InstCategory := (INST_CATEGORY_128_BIT or INST_CATEGORY_LOAD or 174 | INST_CATEGORY_UNALIGNED); 175 | PInst^.FlagsIndex := $00; 176 | MakeMndPrefixF2(PInst); 177 | PInst^.InstID := INST_ID_LDDQU; 178 | Decode_Vo_Mo(PInst); 179 | {$IFDEF NEED_DISPLAY} 180 | MoveMnem(PInst, MNEM_LDDQU); 181 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 182 | {$ENDIF NEED_DISPLAY} 183 | end; 184 | 185 | procedure Decode_SSE3_MONITOR_void(PInst: PInstruction); 186 | begin 187 | // MONITOR void 188 | PInst^.InstGroups := INST_GRP_SSE3; 189 | PInst^.InstCategory := (INST_CATEGORY_AGENT_SYNCHRONIZATION or 190 | INST_CATEGORY_STORE); 191 | PInst^.FlagsIndex := $00; 192 | PInst^.InstID := INST_ID_MONITOR; 193 | Decode_void(PInst); 194 | {$IFDEF NEED_DISPLAY} 195 | MoveMnem(PInst, MNEM_MONITOR); 196 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 197 | {$ENDIF NEED_DISPLAY} 198 | end; 199 | 200 | procedure Decode_SSE3_MWAIT_void(PInst: PInstruction); 201 | begin 202 | // MWAIT void 203 | PInst^.InstGroups := INST_GRP_SSE3; 204 | PInst^.InstCategory := (INST_CATEGORY_AGENT_SYNCHRONIZATION or 205 | INST_CATEGORY_STORE); 206 | PInst^.FlagsIndex := $00; 207 | PInst^.InstID := INST_ID_MWAIT; 208 | Decode_void(PInst); 209 | {$IFDEF NEED_DISPLAY} 210 | MoveMnem(PInst, MNEM_MWAIT); 211 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 212 | {$ENDIF NEED_DISPLAY} 213 | end; 214 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SSE4A.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SSE4A.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SSE4A_MOVNTSD_Mq_Vo(PInst: PInstruction); 25 | begin 26 | // MOVNTSD Mq,Vo 27 | PInst^.InstGroups := INST_GRP_SSE4A; 28 | PInst^.FlagsIndex := $00; 29 | MakeMndPrefixF2(PInst); 30 | PInst^.InstID := INST_ID_MOVNTSD; 31 | Decode_Mq_Vo(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_MOVNTSD); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_SSE4A_MOVNTSS_Md_Vo(PInst: PInstruction); 39 | begin 40 | // MOVNTSS Md,Vo 41 | PInst^.InstGroups := INST_GRP_SSE4A; 42 | PInst^.FlagsIndex := $00; 43 | MakeMndPrefixF3(PInst); 44 | PInst^.InstID := INST_ID_MOVNTSS; 45 | Decode_Md_Vo(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_MOVNTSS); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_SSE4A_EXTRQ_Uo_Ib_Ib(PInst: PInstruction); 53 | begin 54 | // EXTRQ Uo,Ib,Ib 55 | PInst^.InstGroups := INST_GRP_SSE4A; 56 | PInst^.FlagsIndex := $00; 57 | MakeMndPrefix66(PInst); 58 | PInst^.InstID := INST_ID_EXTRQ; 59 | Decode_Uo_Ib_Ib(PInst); 60 | {$IFDEF NEED_DISPLAY} 61 | MoveMnem(PInst, MNEM_EXTRQ); 62 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 63 | {$ENDIF NEED_DISPLAY} 64 | end; 65 | 66 | procedure Decode_SSE4A_INSERTQ_Vo_Uo_Ib_Ib(PInst: PInstruction); 67 | begin 68 | // INSERTQ Vo,Uo,Ib,Ib 69 | PInst^.InstGroups := INST_GRP_SSE4A; 70 | PInst^.FlagsIndex := $00; 71 | MakeMndPrefixF2(PInst); 72 | PInst^.InstID := INST_ID_INSERTQ; 73 | Decode_Vo_Uo_Ib_Ib(PInst); 74 | {$IFDEF NEED_DISPLAY} 75 | MoveMnem(PInst, MNEM_INSERTQ); 76 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 77 | {$ENDIF NEED_DISPLAY} 78 | end; 79 | 80 | procedure Decode_SSE4A_EXTRQ_Vo_Uo(PInst: PInstruction); 81 | begin 82 | // EXTRQ Vo,Uo 83 | PInst^.InstGroups := INST_GRP_SSE4A; 84 | PInst^.FlagsIndex := $00; 85 | MakeMndPrefix66(PInst); 86 | PInst^.InstID := INST_ID_EXTRQ; 87 | Decode_Vo_Uo(PInst); 88 | {$IFDEF NEED_DISPLAY} 89 | MoveMnem(PInst, MNEM_EXTRQ); 90 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 91 | {$ENDIF NEED_DISPLAY} 92 | end; 93 | 94 | procedure Decode_SSE4A_INSERTQ_Vo_Uo(PInst: PInstruction); 95 | begin 96 | // INSERTQ Vo,Uo 97 | PInst^.InstGroups := INST_GRP_SSE4A; 98 | PInst^.FlagsIndex := $00; 99 | MakeMndPrefixF2(PInst); 100 | PInst^.InstID := INST_ID_INSERTQ; 101 | Decode_Vo_Uo(PInst); 102 | {$IFDEF NEED_DISPLAY} 103 | MoveMnem(PInst, MNEM_INSERTQ); 104 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 105 | {$ENDIF NEED_DISPLAY} 106 | end; 107 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SSE4V1-SSE5A.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SSE4V1-SSE5A.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SSE4V1_SSE5A_PTEST_Vo_Wo(PInst: PInstruction); 25 | begin 26 | // PTEST Vo,Wo 27 | PInst^.InstGroups := (INST_GRP_SSE4V1 or INST_GRP_SSE5A); 28 | PInst^.InstCategory := INST_CATEGORY_CONDITIONAL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_PTEST; 32 | Decode_Vo_Wo(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_PTEST); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_SSE4V1_SSE5A_ROUNDPS_Vo_Wo_Ib(PInst: PInstruction); 40 | begin 41 | // ROUNDPS Vo,Wo,Ib 42 | PInst^.InstGroups := (INST_GRP_SSE4V1 or INST_GRP_SSE5A); 43 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or 44 | INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED or INST_CATEGORY_ROUND or 45 | INST_CATEGORY_SINGLE_PRECISION); 46 | PInst^.FlagsIndex := $00; 47 | MakeMndPrefix66(PInst); 48 | PInst^.InstID := INST_ID_ROUNDPS; 49 | Decode_Vo_Wo_Ib(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_ROUNDPS); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | 56 | procedure Decode_SSE4V1_SSE5A_ROUNDPD_Vo_Wo_Ib(PInst: PInstruction); 57 | begin 58 | // ROUNDPD Vo,Wo,Ib 59 | PInst^.InstGroups := (INST_GRP_SSE4V1 or INST_GRP_SSE5A); 60 | PInst^.InstCategory := (INST_CATEGORY_DOUBLE_PRECISION or 61 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_INTEGER or 62 | INST_CATEGORY_PACKED or INST_CATEGORY_ROUND); 63 | PInst^.FlagsIndex := $00; 64 | MakeMndPrefix66(PInst); 65 | PInst^.InstID := INST_ID_ROUNDPD; 66 | Decode_Vo_Wo_Ib(PInst); 67 | {$IFDEF NEED_DISPLAY} 68 | MoveMnem(PInst, MNEM_ROUNDPD); 69 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 70 | {$ENDIF NEED_DISPLAY} 71 | end; 72 | 73 | procedure Decode_SSE4V1_SSE5A_ROUNDSS_Vo_Wo_d_Ib(PInst: PInstruction); 74 | begin 75 | // ROUNDSS Vo,Wo.d,Ib 76 | PInst^.InstGroups := (INST_GRP_SSE4V1 or INST_GRP_SSE5A); 77 | PInst^.InstCategory := (INST_CATEGORY_FLOATING_POINT or 78 | INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED or INST_CATEGORY_ROUND or 79 | INST_CATEGORY_SINGLE_PRECISION); 80 | PInst^.FlagsIndex := $00; 81 | MakeMndPrefix66(PInst); 82 | PInst^.InstID := INST_ID_ROUNDSS; 83 | Decode_Vo_Wo_d_Ib(PInst); 84 | {$IFDEF NEED_DISPLAY} 85 | MoveMnem(PInst, MNEM_ROUNDSS); 86 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 87 | {$ENDIF NEED_DISPLAY} 88 | end; 89 | 90 | procedure Decode_SSE4V1_SSE5A_ROUNDSD_Vo_Wo_q_Ib(PInst: PInstruction); 91 | begin 92 | // ROUNDSD Vo,Wo.q,Ib 93 | PInst^.InstGroups := (INST_GRP_SSE4V1 or INST_GRP_SSE5A); 94 | PInst^.InstCategory := (INST_CATEGORY_DOUBLE_PRECISION or 95 | INST_CATEGORY_FLOATING_POINT or INST_CATEGORY_INTEGER or 96 | INST_CATEGORY_PACKED or INST_CATEGORY_ROUND); 97 | PInst^.FlagsIndex := $00; 98 | MakeMndPrefix66(PInst); 99 | PInst^.InstID := INST_ID_ROUNDSD; 100 | Decode_Vo_Wo_q_Ib(PInst); 101 | {$IFDEF NEED_DISPLAY} 102 | MoveMnem(PInst, MNEM_ROUNDSD); 103 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 104 | {$ENDIF NEED_DISPLAY} 105 | end; 106 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SSE4V2.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SSE4V2.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SSE4V2_PCMPGTQ_Vo_Wo(PInst: PInstruction); 25 | begin 26 | // PCMPGTQ Vo,Wo 27 | PInst^.InstGroups := INST_GRP_SSE4V2; 28 | PInst^.InstCategory := (INST_CATEGORY_COMPARE or INST_CATEGORY_INTEGER or 29 | INST_CATEGORY_PACKED or INST_CATEGORY_SIMD); 30 | PInst^.FlagsIndex := $00; 31 | MakeMndPrefix66(PInst); 32 | PInst^.InstID := INST_ID_PCMPGTQ; 33 | Decode_Vo_Wo(PInst); 34 | {$IFDEF NEED_DISPLAY} 35 | MoveMnem(PInst, MNEM_PCMPGTQ); 36 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 37 | {$ENDIF NEED_DISPLAY} 38 | end; 39 | 40 | procedure Decode_SSE4V2_CRC32_Gy_Eb(PInst: PInstruction); 41 | begin 42 | // CRC32 Gy,Eb 43 | PInst^.InstGroups := INST_GRP_SSE4V2; 44 | PInst^.InstCategory := INST_CATEGORY_BIT_BYTE; 45 | PInst^.FlagsIndex := $00; 46 | MakeMndPrefix66(PInst); 47 | MakeMndPrefixF2(PInst); 48 | PInst^.InstID := INST_ID_CRC32; 49 | Decode_Gy_Eb(PInst); 50 | {$IFDEF NEED_DISPLAY} 51 | MoveMnem(PInst, MNEM_CRC32); 52 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 53 | {$ENDIF NEED_DISPLAY} 54 | end; 55 | 56 | procedure Decode_SSE4V2_CRC32_Gy_Ev(PInst: PInstruction); 57 | begin 58 | // CRC32 Gy,Ev 59 | PInst^.InstGroups := INST_GRP_SSE4V2; 60 | PInst^.InstCategory := INST_CATEGORY_BIT_BYTE; 61 | PInst^.FlagsIndex := $00; 62 | MakeMndPrefix66(PInst); 63 | MakeMndPrefixF2(PInst); 64 | PInst^.InstID := INST_ID_CRC32; 65 | Decode_Gy_Ev(PInst); 66 | {$IFDEF NEED_DISPLAY} 67 | MoveMnem(PInst, MNEM_CRC32); 68 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 69 | {$ENDIF NEED_DISPLAY} 70 | end; 71 | 72 | procedure Decode_SSE4V2_PCMPESTRM_Vo_Wo_Ib(PInst: PInstruction); 73 | begin 74 | // PCMPESTRM Vo,Wo,Ib 75 | PInst^.InstGroups := INST_GRP_SSE4V2; 76 | PInst^.InstCategory := (INST_CATEGORY_COMPARE or INST_CATEGORY_PACKED or 77 | INST_CATEGORY_STRING); 78 | PInst^.FlagsIndex := $00; 79 | MakeMndPrefix66(PInst); 80 | PInst^.InstID := INST_ID_PCMPESTRM; 81 | Decode_Vo_Wo_Ib(PInst); 82 | {$IFDEF NEED_DISPLAY} 83 | MoveMnem(PInst, MNEM_PCMPESTRM); 84 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 85 | {$ENDIF NEED_DISPLAY} 86 | end; 87 | 88 | procedure Decode_SSE4V2_PCMPESTRI_Vo_Wo_Ib(PInst: PInstruction); 89 | begin 90 | // PCMPESTRI Vo,Wo,Ib 91 | PInst^.InstGroups := INST_GRP_SSE4V2; 92 | PInst^.InstCategory := (INST_CATEGORY_COMPARE or INST_CATEGORY_PACKED or 93 | INST_CATEGORY_STRING); 94 | PInst^.FlagsIndex := $00; 95 | MakeMndPrefix66(PInst); 96 | PInst^.InstID := INST_ID_PCMPESTRI; 97 | Decode_Vo_Wo_Ib(PInst); 98 | {$IFDEF NEED_DISPLAY} 99 | MoveMnem(PInst, MNEM_PCMPESTRI); 100 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 101 | {$ENDIF NEED_DISPLAY} 102 | end; 103 | 104 | procedure Decode_SSE4V2_PCMPISTRM_Vo_Wo_Ib(PInst: PInstruction); 105 | begin 106 | // PCMPISTRM Vo,Wo,Ib 107 | PInst^.InstGroups := INST_GRP_SSE4V2; 108 | PInst^.InstCategory := (INST_CATEGORY_COMPARE or INST_CATEGORY_PACKED or 109 | INST_CATEGORY_STRING); 110 | PInst^.FlagsIndex := $00; 111 | MakeMndPrefix66(PInst); 112 | PInst^.InstID := INST_ID_PCMPISTRM; 113 | Decode_Vo_Wo_Ib(PInst); 114 | {$IFDEF NEED_DISPLAY} 115 | MoveMnem(PInst, MNEM_PCMPISTRM); 116 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 117 | {$ENDIF NEED_DISPLAY} 118 | end; 119 | 120 | procedure Decode_SSE4V2_PCMPISTRI_Vo_Wo_Ib(PInst: PInstruction); 121 | begin 122 | // PCMPISTRI Vo,Wo,Ib 123 | PInst^.InstGroups := INST_GRP_SSE4V2; 124 | PInst^.InstCategory := (INST_CATEGORY_COMPARE or INST_CATEGORY_PACKED or 125 | INST_CATEGORY_STRING); 126 | PInst^.FlagsIndex := $00; 127 | MakeMndPrefix66(PInst); 128 | PInst^.InstID := INST_ID_PCMPISTRI; 129 | Decode_Vo_Wo_Ib(PInst); 130 | {$IFDEF NEED_DISPLAY} 131 | MoveMnem(PInst, MNEM_PCMPISTRI); 132 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 133 | {$ENDIF NEED_DISPLAY} 134 | end; 135 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/SSSE3.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is SSSE3.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_SSSE3_PSHUFB_Vo_Wo(PInst: PInstruction); 25 | begin 26 | // PSHUFB Vo,Wo 27 | PInst^.InstGroups := INST_GRP_SSSE3; 28 | PInst^.InstCategory := INST_CATEGORY_SHUFFLE; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_PSHUFB; 32 | Decode_Vo_Wo(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_PSHUFB); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_SSSE3_PHADDW_Vo_Wo(PInst: PInstruction); 40 | begin 41 | // PHADDW Vo,Wo 42 | PInst^.InstGroups := INST_GRP_SSSE3; 43 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 44 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 45 | PInst^.FlagsIndex := $00; 46 | MakeMndPrefix66(PInst); 47 | PInst^.InstID := INST_ID_PHADDW; 48 | Decode_Vo_Wo(PInst); 49 | {$IFDEF NEED_DISPLAY} 50 | MoveMnem(PInst, MNEM_PHADDW); 51 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 52 | {$ENDIF NEED_DISPLAY} 53 | end; 54 | 55 | procedure Decode_SSSE3_PHADDD_Vo_Wo(PInst: PInstruction); 56 | begin 57 | // PHADDD Vo,Wo 58 | PInst^.InstGroups := INST_GRP_SSSE3; 59 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 60 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 61 | PInst^.FlagsIndex := $00; 62 | MakeMndPrefix66(PInst); 63 | PInst^.InstID := INST_ID_PHADDD; 64 | Decode_Vo_Wo(PInst); 65 | {$IFDEF NEED_DISPLAY} 66 | MoveMnem(PInst, MNEM_PHADDD); 67 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 68 | {$ENDIF NEED_DISPLAY} 69 | end; 70 | 71 | procedure Decode_SSSE3_PHADDSW_Vo_Wo(PInst: PInstruction); 72 | begin 73 | // PHADDSW Vo,Wo 74 | PInst^.InstGroups := INST_GRP_SSSE3; 75 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 76 | INST_CATEGORY_PACK or INST_CATEGORY_SIGNED); 77 | PInst^.FlagsIndex := $00; 78 | MakeMndPrefix66(PInst); 79 | PInst^.InstID := INST_ID_PHADDSW; 80 | Decode_Vo_Wo(PInst); 81 | {$IFDEF NEED_DISPLAY} 82 | MoveMnem(PInst, MNEM_PHADDSW); 83 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 84 | {$ENDIF NEED_DISPLAY} 85 | end; 86 | 87 | procedure Decode_SSSE3_PMADDUBSW_Vo_Wo(PInst: PInstruction); 88 | begin 89 | // PMADDUBSW Vo,Wo 90 | PInst^.InstGroups := INST_GRP_SSSE3; 91 | PInst^.InstCategory := (INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED or 92 | INST_CATEGORY_UNSIGNED); 93 | PInst^.FlagsIndex := $00; 94 | MakeMndPrefix66(PInst); 95 | PInst^.InstID := INST_ID_PMADDUBSW; 96 | Decode_Vo_Wo(PInst); 97 | {$IFDEF NEED_DISPLAY} 98 | MoveMnem(PInst, MNEM_PMADDUBSW); 99 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 100 | {$ENDIF NEED_DISPLAY} 101 | end; 102 | 103 | procedure Decode_SSSE3_PHSUBW_Vo_Wo(PInst: PInstruction); 104 | begin 105 | // PHSUBW Vo,Wo 106 | PInst^.InstGroups := INST_GRP_SSSE3; 107 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 108 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 109 | PInst^.FlagsIndex := $00; 110 | MakeMndPrefix66(PInst); 111 | PInst^.InstID := INST_ID_PHSUBW; 112 | Decode_Vo_Wo(PInst); 113 | {$IFDEF NEED_DISPLAY} 114 | MoveMnem(PInst, MNEM_PHSUBW); 115 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 116 | {$ENDIF NEED_DISPLAY} 117 | end; 118 | 119 | procedure Decode_SSSE3_PHSUBD_Vo_Wo(PInst: PInstruction); 120 | begin 121 | // PHSUBD Vo,Wo 122 | PInst^.InstGroups := INST_GRP_SSSE3; 123 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 124 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 125 | PInst^.FlagsIndex := $00; 126 | MakeMndPrefix66(PInst); 127 | PInst^.InstID := INST_ID_PHSUBD; 128 | Decode_Vo_Wo(PInst); 129 | {$IFDEF NEED_DISPLAY} 130 | MoveMnem(PInst, MNEM_PHSUBD); 131 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 132 | {$ENDIF NEED_DISPLAY} 133 | end; 134 | 135 | procedure Decode_SSSE3_PHSUBSW_Vo_Wo(PInst: PInstruction); 136 | begin 137 | // PHSUBSW Vo,Wo 138 | PInst^.InstGroups := INST_GRP_SSSE3; 139 | PInst^.InstCategory := (INST_CATEGORY_HORIZONTAL or INST_CATEGORY_INTEGER or 140 | INST_CATEGORY_PACKED or INST_CATEGORY_SIGNED); 141 | PInst^.FlagsIndex := $00; 142 | MakeMndPrefix66(PInst); 143 | PInst^.InstID := INST_ID_PHSUBSW; 144 | Decode_Vo_Wo(PInst); 145 | {$IFDEF NEED_DISPLAY} 146 | MoveMnem(PInst, MNEM_PHSUBSW); 147 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 148 | {$ENDIF NEED_DISPLAY} 149 | end; 150 | 151 | procedure Decode_SSSE3_PSIGNB_Vo_Wo(PInst: PInstruction); 152 | begin 153 | // PSIGNB Vo,Wo 154 | PInst^.InstGroups := INST_GRP_SSSE3; 155 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 156 | PInst^.FlagsIndex := $00; 157 | MakeMndPrefix66(PInst); 158 | PInst^.InstID := INST_ID_PSIGNB; 159 | Decode_Vo_Wo(PInst); 160 | {$IFDEF NEED_DISPLAY} 161 | MoveMnem(PInst, MNEM_PSIGNB); 162 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 163 | {$ENDIF NEED_DISPLAY} 164 | end; 165 | 166 | procedure Decode_SSSE3_PSIGNW_Vo_Wo(PInst: PInstruction); 167 | begin 168 | // PSIGNW Vo,Wo 169 | PInst^.InstGroups := INST_GRP_SSSE3; 170 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 171 | PInst^.FlagsIndex := $00; 172 | MakeMndPrefix66(PInst); 173 | PInst^.InstID := INST_ID_PSIGNW; 174 | Decode_Vo_Wo(PInst); 175 | {$IFDEF NEED_DISPLAY} 176 | MoveMnem(PInst, MNEM_PSIGNW); 177 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 178 | {$ENDIF NEED_DISPLAY} 179 | end; 180 | 181 | procedure Decode_SSSE3_PSIGND_Vo_Wo(PInst: PInstruction); 182 | begin 183 | // PSIGND Vo,Wo 184 | PInst^.InstGroups := INST_GRP_SSSE3; 185 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_SIGNED); 186 | PInst^.FlagsIndex := $00; 187 | MakeMndPrefix66(PInst); 188 | PInst^.InstID := INST_ID_PSIGND; 189 | Decode_Vo_Wo(PInst); 190 | {$IFDEF NEED_DISPLAY} 191 | MoveMnem(PInst, MNEM_PSIGND); 192 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 193 | {$ENDIF NEED_DISPLAY} 194 | end; 195 | 196 | procedure Decode_SSSE3_PMULHRSW_Vo_Wo(PInst: PInstruction); 197 | begin 198 | // PMULHRSW Vo,Wo 199 | PInst^.InstGroups := INST_GRP_SSSE3; 200 | PInst^.InstCategory := (INST_CATEGORY_INTEGER or INST_CATEGORY_PACKED or 201 | INST_CATEGORY_ROUND or INST_CATEGORY_SCALE or INST_CATEGORY_SIGNED); 202 | PInst^.FlagsIndex := $00; 203 | MakeMndPrefix66(PInst); 204 | PInst^.InstID := INST_ID_PMULHRSW; 205 | Decode_Vo_Wo(PInst); 206 | {$IFDEF NEED_DISPLAY} 207 | MoveMnem(PInst, MNEM_PMULHRSW); 208 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 209 | {$ENDIF NEED_DISPLAY} 210 | end; 211 | 212 | procedure Decode_SSSE3_PABSB_Vo_Wo(PInst: PInstruction); 213 | begin 214 | // PABSB Vo,Wo 215 | PInst^.InstGroups := INST_GRP_SSSE3; 216 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 217 | PInst^.FlagsIndex := $00; 218 | MakeMndPrefix66(PInst); 219 | PInst^.InstID := INST_ID_PABSB; 220 | Decode_Vo_Wo(PInst); 221 | {$IFDEF NEED_DISPLAY} 222 | MoveMnem(PInst, MNEM_PABSB); 223 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 224 | {$ENDIF NEED_DISPLAY} 225 | end; 226 | 227 | procedure Decode_SSSE3_PABSW_Vo_Wo(PInst: PInstruction); 228 | begin 229 | // PABSW Vo,Wo 230 | PInst^.InstGroups := INST_GRP_SSSE3; 231 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 232 | PInst^.FlagsIndex := $00; 233 | MakeMndPrefix66(PInst); 234 | PInst^.InstID := INST_ID_PABSW; 235 | Decode_Vo_Wo(PInst); 236 | {$IFDEF NEED_DISPLAY} 237 | MoveMnem(PInst, MNEM_PABSW); 238 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 239 | {$ENDIF NEED_DISPLAY} 240 | end; 241 | 242 | procedure Decode_SSSE3_PABSD_Vo_Wo(PInst: PInstruction); 243 | begin 244 | // PABSD Vo,Wo 245 | PInst^.InstGroups := INST_GRP_SSSE3; 246 | PInst^.InstCategory := INST_CATEGORY_SIGNED; 247 | PInst^.FlagsIndex := $00; 248 | MakeMndPrefix66(PInst); 249 | PInst^.InstID := INST_ID_PABSD; 250 | Decode_Vo_Wo(PInst); 251 | {$IFDEF NEED_DISPLAY} 252 | MoveMnem(PInst, MNEM_PABSD); 253 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 254 | {$ENDIF NEED_DISPLAY} 255 | end; 256 | 257 | procedure Decode_SSSE3_PALIGNR_Vo_Wo_Ib(PInst: PInstruction); 258 | begin 259 | // PALIGNR Vo,Wo,Ib 260 | PInst^.InstGroups := INST_GRP_SSSE3; 261 | PInst^.InstCategory := INST_CATEGORY_ALIGN_RIGHT; 262 | PInst^.FlagsIndex := $00; 263 | MakeMndPrefix66(PInst); 264 | PInst^.InstID := INST_ID_PALIGNR; 265 | Decode_Vo_Wo_Ib(PInst); 266 | {$IFDEF NEED_DISPLAY} 267 | MoveMnem(PInst, MNEM_PALIGNR); 268 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 269 | {$ENDIF NEED_DISPLAY} 270 | end; 271 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/TBM.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is TBM.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_TBM_BEXTR_Gy_Ey_Id(PInst: PInstruction); 25 | begin 26 | // BEXTR Gy,Ey,Id 27 | PInst^.InstGroups := INST_GRP_TBM; 28 | PInst^.InstCategory := INST_CATEGORY_BMI1; 29 | PInst^.FlagsIndex := $00; 30 | PInst^.InstID := INST_ID_BEXTR; 31 | Decode_Gy_Ey_Id(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_BEXTR); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_TBM_BLCFILL_By_Ey(PInst: PInstruction); 39 | begin 40 | // BLCFILL By,Ey 41 | PInst^.InstGroups := INST_GRP_TBM; 42 | PInst^.FlagsIndex := $00; 43 | PInst^.InstID := INST_ID_BLCFILL; 44 | Decode_By_Ey(PInst); 45 | {$IFDEF NEED_DISPLAY} 46 | MoveMnem(PInst, MNEM_BLCFILL); 47 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 48 | {$ENDIF NEED_DISPLAY} 49 | end; 50 | 51 | procedure Decode_TBM_BLSFILL_By_Ey(PInst: PInstruction); 52 | begin 53 | // BLSFILL By,Ey 54 | PInst^.InstGroups := INST_GRP_TBM; 55 | PInst^.FlagsIndex := $00; 56 | PInst^.InstID := INST_ID_BLSFILL; 57 | Decode_By_Ey(PInst); 58 | {$IFDEF NEED_DISPLAY} 59 | MoveMnem(PInst, MNEM_BLSFILL); 60 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 61 | {$ENDIF NEED_DISPLAY} 62 | end; 63 | 64 | procedure Decode_TBM_BLCS_By_Ey(PInst: PInstruction); 65 | begin 66 | // BLCS By,Ey 67 | PInst^.InstGroups := INST_GRP_TBM; 68 | PInst^.FlagsIndex := $00; 69 | PInst^.InstID := INST_ID_BLCS; 70 | Decode_By_Ey(PInst); 71 | {$IFDEF NEED_DISPLAY} 72 | MoveMnem(PInst, MNEM_BLCS); 73 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 74 | {$ENDIF NEED_DISPLAY} 75 | end; 76 | 77 | procedure Decode_TBM_TZMSK_By_Ey(PInst: PInstruction); 78 | begin 79 | // TZMSK By,Ey 80 | PInst^.InstGroups := INST_GRP_TBM; 81 | PInst^.FlagsIndex := $00; 82 | PInst^.InstID := INST_ID_TZMSK; 83 | Decode_By_Ey(PInst); 84 | {$IFDEF NEED_DISPLAY} 85 | MoveMnem(PInst, MNEM_TZMSK); 86 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 87 | {$ENDIF NEED_DISPLAY} 88 | end; 89 | 90 | procedure Decode_TBM_BLCIC_By_Ey(PInst: PInstruction); 91 | begin 92 | // BLCIC By,Ey 93 | PInst^.InstGroups := INST_GRP_TBM; 94 | PInst^.FlagsIndex := $00; 95 | PInst^.InstID := INST_ID_BLCIC; 96 | Decode_By_Ey(PInst); 97 | {$IFDEF NEED_DISPLAY} 98 | MoveMnem(PInst, MNEM_BLCIC); 99 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 100 | {$ENDIF NEED_DISPLAY} 101 | end; 102 | 103 | procedure Decode_TBM_BLSIC_By_Ey(PInst: PInstruction); 104 | begin 105 | // BLSIC By,Ey 106 | PInst^.InstGroups := INST_GRP_TBM; 107 | PInst^.FlagsIndex := $00; 108 | PInst^.InstID := INST_ID_BLSIC; 109 | Decode_By_Ey(PInst); 110 | {$IFDEF NEED_DISPLAY} 111 | MoveMnem(PInst, MNEM_BLSIC); 112 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 113 | {$ENDIF NEED_DISPLAY} 114 | end; 115 | 116 | procedure Decode_TBM_T1MSKC_By_Ey(PInst: PInstruction); 117 | begin 118 | // T1MSKC By,Ey 119 | PInst^.InstGroups := INST_GRP_TBM; 120 | PInst^.FlagsIndex := $00; 121 | PInst^.InstID := INST_ID_T1MSKC; 122 | Decode_By_Ey(PInst); 123 | {$IFDEF NEED_DISPLAY} 124 | MoveMnem(PInst, MNEM_T1MSKC); 125 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 126 | {$ENDIF NEED_DISPLAY} 127 | end; 128 | 129 | procedure Decode_TBM_BLCMSK_By_Ey(PInst: PInstruction); 130 | begin 131 | // BLCMSK By,Ey 132 | PInst^.InstGroups := INST_GRP_TBM; 133 | PInst^.FlagsIndex := $00; 134 | PInst^.InstID := INST_ID_BLCMSK; 135 | Decode_By_Ey(PInst); 136 | {$IFDEF NEED_DISPLAY} 137 | MoveMnem(PInst, MNEM_BLCMSK); 138 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 139 | {$ENDIF NEED_DISPLAY} 140 | end; 141 | 142 | procedure Decode_TBM_BLCI_By_Ey(PInst: PInstruction); 143 | begin 144 | // BLCI By,Ey 145 | PInst^.InstGroups := INST_GRP_TBM; 146 | PInst^.FlagsIndex := $00; 147 | PInst^.InstID := INST_ID_BLCI; 148 | Decode_By_Ey(PInst); 149 | {$IFDEF NEED_DISPLAY} 150 | MoveMnem(PInst, MNEM_BLCI); 151 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 152 | {$ENDIF NEED_DISPLAY} 153 | end; 154 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/TSX.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is TSX.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_TSX_XABORT_Ib(PInst: PInstruction); 25 | begin 26 | // XABORT Ib 27 | PInst^.InstGroups := INST_GRP_TSX; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | PInst^.InstID := INST_ID_XABORT; 31 | Decode_Ib(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_XABORT); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_TSX_XBEGIN_Jz(PInst: PInstruction); 39 | begin 40 | // XBEGIN Jz 41 | PInst^.InstGroups := INST_GRP_TSX; 42 | PInst^.InstCategory := INST_CATEGORY_NIL; 43 | PInst^.FlagsIndex := $00; 44 | PInst^.InstID := INST_ID_XBEGIN; 45 | Decode_Jz(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_XBEGIN); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_TSX_XEND_void(PInst: PInstruction); 53 | begin 54 | // XEND void 55 | PInst^.InstGroups := INST_GRP_TSX; 56 | PInst^.InstCategory := INST_CATEGORY_NIL; 57 | PInst^.FlagsIndex := $00; 58 | PInst^.InstID := INST_ID_XEND; 59 | Decode_void(PInst); 60 | {$IFDEF NEED_DISPLAY} 61 | MoveMnem(PInst, MNEM_XEND); 62 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 63 | {$ENDIF NEED_DISPLAY} 64 | end; 65 | 66 | procedure Decode_TSX_XTEST_void(PInst: PInstruction); 67 | begin 68 | // XTEST void 69 | PInst^.InstGroups := INST_GRP_TSX; 70 | PInst^.InstCategory := INST_CATEGORY_NIL; 71 | PInst^.FlagsIndex := $00; 72 | PInst^.InstID := INST_ID_XTEST; 73 | Decode_void(PInst); 74 | {$IFDEF NEED_DISPLAY} 75 | MoveMnem(PInst, MNEM_XTEST); 76 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 77 | {$ENDIF NEED_DISPLAY} 78 | end; 79 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/VME.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is VME.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_VME_VMREAD_Ey_Gy(PInst: PInstruction); 25 | begin 26 | // VMREAD Ey,Gy 27 | PInst^.InstGroups := INST_GRP_VME; 28 | PInst^.InstCategory := INST_CATEGORY_STORE; 29 | PInst^.FlagsIndex := $00; 30 | PInst^.InstID := INST_ID_VMREAD; 31 | Decode_Ey_Gy(PInst); 32 | {$IFDEF NEED_DISPLAY} 33 | MoveMnem(PInst, MNEM_VMREAD); 34 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 35 | {$ENDIF NEED_DISPLAY} 36 | end; 37 | 38 | procedure Decode_VME_VMWRITE_Gy_Ey(PInst: PInstruction); 39 | begin 40 | // VMWRITE Gy,Ey 41 | PInst^.InstGroups := INST_GRP_VME; 42 | PInst^.InstCategory := INST_CATEGORY_NIL; 43 | PInst^.FlagsIndex := $00; 44 | PInst^.InstID := INST_ID_VMWRITE; 45 | Decode_Gy_Ey(PInst); 46 | {$IFDEF NEED_DISPLAY} 47 | MoveMnem(PInst, MNEM_VMWRITE); 48 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 49 | {$ENDIF NEED_DISPLAY} 50 | end; 51 | 52 | procedure Decode_VME_VMCALL_void(PInst: PInstruction); 53 | begin 54 | // VMCALL void 55 | PInst^.InstGroups := INST_GRP_VME; 56 | PInst^.InstCategory := INST_CATEGORY_NIL; 57 | PInst^.FlagsIndex := $00; 58 | PInst^.DstAddr.Flags := JF_BRANCH; 59 | PInst^.InstID := INST_ID_VMCALL; 60 | DecodeBranch_void(PInst); 61 | {$IFDEF NEED_DISPLAY} 62 | MoveMnem(PInst, MNEM_VMCALL); 63 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 64 | {$ENDIF NEED_DISPLAY} 65 | end; 66 | 67 | procedure Decode_VME_VMLAUNCH_void(PInst: PInstruction); 68 | begin 69 | // VMLAUNCH void 70 | PInst^.InstGroups := INST_GRP_VME; 71 | PInst^.InstCategory := INST_CATEGORY_NIL; 72 | PInst^.FlagsIndex := $00; 73 | PInst^.InstID := INST_ID_VMLAUNCH; 74 | Decode_void(PInst); 75 | {$IFDEF NEED_DISPLAY} 76 | MoveMnem(PInst, MNEM_VMLAUNCH); 77 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 78 | {$ENDIF NEED_DISPLAY} 79 | end; 80 | 81 | procedure Decode_VME_VMRESUME_void(PInst: PInstruction); 82 | begin 83 | // VMRESUME void 84 | PInst^.InstGroups := INST_GRP_VME; 85 | PInst^.InstCategory := INST_CATEGORY_NIL; 86 | PInst^.FlagsIndex := $00; 87 | PInst^.InstID := INST_ID_VMRESUME; 88 | Decode_void(PInst); 89 | {$IFDEF NEED_DISPLAY} 90 | MoveMnem(PInst, MNEM_VMRESUME); 91 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 92 | {$ENDIF NEED_DISPLAY} 93 | end; 94 | 95 | procedure Decode_VME_VMXOFF_void(PInst: PInstruction); 96 | begin 97 | // VMXOFF void 98 | PInst^.InstGroups := INST_GRP_VME; 99 | PInst^.InstCategory := INST_CATEGORY_NIL; 100 | PInst^.FlagsIndex := $00; 101 | PInst^.InstID := INST_ID_VMXOFF; 102 | Decode_void(PInst); 103 | {$IFDEF NEED_DISPLAY} 104 | MoveMnem(PInst, MNEM_VMXOFF); 105 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 106 | {$ENDIF NEED_DISPLAY} 107 | end; 108 | 109 | procedure Decode_VME_VMFUNC_void(PInst: PInstruction); 110 | begin 111 | // VMFUNC void 112 | PInst^.InstGroups := INST_GRP_VME; 113 | PInst^.InstCategory := INST_CATEGORY_NIL; 114 | PInst^.FlagsIndex := $00; 115 | PInst^.InstID := INST_ID_VMFUNC; 116 | Decode_void(PInst); 117 | {$IFDEF NEED_DISPLAY} 118 | MoveMnem(PInst, MNEM_VMFUNC); 119 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 120 | {$ENDIF NEED_DISPLAY} 121 | end; 122 | 123 | procedure Decode_VME_VMRUN_void(PInst: PInstruction); 124 | begin 125 | // VMRUN void 126 | PInst^.InstGroups := INST_GRP_VME; 127 | PInst^.FlagsIndex := $00; 128 | PInst^.InstID := INST_ID_VMRUN; 129 | Decode_void(PInst); 130 | {$IFDEF NEED_DISPLAY} 131 | MoveMnem(PInst, MNEM_VMRUN); 132 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 133 | {$ENDIF NEED_DISPLAY} 134 | end; 135 | 136 | procedure Decode_VME_VMMCALL_void(PInst: PInstruction); 137 | begin 138 | // VMMCALL void 139 | PInst^.InstGroups := INST_GRP_VME; 140 | PInst^.FlagsIndex := $00; 141 | PInst^.DstAddr.Flags := JF_BRANCH; 142 | PInst^.InstID := INST_ID_VMMCALL; 143 | DecodeBranch_void(PInst); 144 | {$IFDEF NEED_DISPLAY} 145 | MoveMnem(PInst, MNEM_VMMCALL); 146 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 147 | {$ENDIF NEED_DISPLAY} 148 | end; 149 | 150 | procedure Decode_VME_VMLOAD_void(PInst: PInstruction); 151 | begin 152 | // VMLOAD void 153 | PInst^.InstGroups := INST_GRP_VME; 154 | PInst^.FlagsIndex := $00; 155 | PInst^.InstID := INST_ID_VMLOAD; 156 | Decode_void(PInst); 157 | {$IFDEF NEED_DISPLAY} 158 | MoveMnem(PInst, MNEM_VMLOAD); 159 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 160 | {$ENDIF NEED_DISPLAY} 161 | end; 162 | 163 | procedure Decode_VME_VMSAVE_void(PInst: PInstruction); 164 | begin 165 | // VMSAVE void 166 | PInst^.InstGroups := INST_GRP_VME; 167 | PInst^.FlagsIndex := $00; 168 | PInst^.InstID := INST_ID_VMSAVE; 169 | Decode_void(PInst); 170 | {$IFDEF NEED_DISPLAY} 171 | MoveMnem(PInst, MNEM_VMSAVE); 172 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 173 | {$ENDIF NEED_DISPLAY} 174 | end; 175 | 176 | procedure Decode_VME_VMCLEAR_Mq(PInst: PInstruction); 177 | begin 178 | // VMCLEAR Mq 179 | PInst^.InstGroups := INST_GRP_VME; 180 | PInst^.InstCategory := INST_CATEGORY_NIL; 181 | PInst^.FlagsIndex := $00; 182 | MakeMndPrefix66(PInst); 183 | PInst^.InstID := INST_ID_VMCLEAR; 184 | Decode_Mq(PInst); 185 | {$IFDEF NEED_DISPLAY} 186 | MoveMnem(PInst, MNEM_VMCLEAR); 187 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 188 | {$ENDIF NEED_DISPLAY} 189 | end; 190 | 191 | procedure Decode_VME_VMXON_Mq(PInst: PInstruction); 192 | begin 193 | // VMXON Mq 194 | PInst^.InstGroups := INST_GRP_VME; 195 | PInst^.InstCategory := INST_CATEGORY_NIL; 196 | PInst^.FlagsIndex := $00; 197 | MakeMndPrefixF3(PInst); 198 | PInst^.InstID := INST_ID_VMXON; 199 | Decode_Mq(PInst); 200 | {$IFDEF NEED_DISPLAY} 201 | MoveMnem(PInst, MNEM_VMXON); 202 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 203 | {$ENDIF NEED_DISPLAY} 204 | end; 205 | 206 | procedure Decode_VME_VMPTRLD_Mq(PInst: PInstruction); 207 | begin 208 | // VMPTRLD Mq 209 | PInst^.InstGroups := INST_GRP_VME; 210 | PInst^.InstCategory := INST_CATEGORY_NIL; 211 | PInst^.FlagsIndex := $00; 212 | PInst^.InstID := INST_ID_VMPTRLD; 213 | Decode_Mq(PInst); 214 | {$IFDEF NEED_DISPLAY} 215 | MoveMnem(PInst, MNEM_VMPTRLD); 216 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 217 | {$ENDIF NEED_DISPLAY} 218 | end; 219 | 220 | procedure Decode_VME_VMPTRST_Mq(PInst: PInstruction); 221 | begin 222 | // VMPTRST Mq 223 | PInst^.InstGroups := INST_GRP_VME; 224 | PInst^.InstCategory := INST_CATEGORY_NIL; 225 | PInst^.FlagsIndex := $00; 226 | PInst^.InstID := INST_ID_VMPTRST; 227 | Decode_Mq(PInst); 228 | {$IFDEF NEED_DISPLAY} 229 | MoveMnem(PInst, MNEM_VMPTRST); 230 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 231 | {$ENDIF NEED_DISPLAY} 232 | end; 233 | -------------------------------------------------------------------------------- /Common/UnivDisasm/Includes/VMX.inc: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is VMX.inc 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | procedure Decode_VMX_INVEPT_Gy_Mo(PInst: PInstruction); 25 | begin 26 | // INVEPT Gy,Mo 27 | PInst^.InstGroups := INST_GRP_VMX; 28 | PInst^.InstCategory := INST_CATEGORY_NIL; 29 | PInst^.FlagsIndex := $00; 30 | MakeMndPrefix66(PInst); 31 | PInst^.InstID := INST_ID_INVEPT; 32 | Decode_Gy_Mo(PInst); 33 | {$IFDEF NEED_DISPLAY} 34 | MoveMnem(PInst, MNEM_INVEPT); 35 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 36 | {$ENDIF NEED_DISPLAY} 37 | end; 38 | 39 | procedure Decode_VMX_INVVPID_Gy_Mo(PInst: PInstruction); 40 | begin 41 | // INVVPID Gy,Mo 42 | PInst^.InstGroups := INST_GRP_VMX; 43 | PInst^.InstCategory := INST_CATEGORY_NIL; 44 | PInst^.FlagsIndex := $00; 45 | MakeMndPrefix66(PInst); 46 | PInst^.InstID := INST_ID_INVVPID; 47 | Decode_Gy_Mo(PInst); 48 | {$IFDEF NEED_DISPLAY} 49 | MoveMnem(PInst, MNEM_INVVPID); 50 | SyntaxManager.SyntaxDecoderArray[PInst.InternalData.SyntaxID](PInst); 51 | {$ENDIF NEED_DISPLAY} 52 | end; 53 | -------------------------------------------------------------------------------- /Common/UnivDisasm/UnivDisasm.Internal.Escape.pas: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is UnivDisasm.Internal.Escape.pas 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | unit UnivDisasm.Internal.Escape; 25 | 26 | interface 27 | 28 | {$I Config.inc} 29 | 30 | uses UnivDisasm.Disasm; 31 | procedure Decode_ESCAPE_TABLE_2_void(PInst: PInstruction); 32 | procedure Decode_ESCAPE_TABLE_38_void(PInst: PInstruction); 33 | procedure Decode_ESCAPE_TABLE_3A_void(PInst: PInstruction); 34 | procedure Decode_ESCAPE_3DNow_F_void(PInst: PInstruction); 35 | procedure Decode_ESCAPE_SSE5A_24_void(PInst: PInstruction); 36 | procedure Decode_ESCAPE_SSE5A_25_void(PInst: PInstruction); 37 | procedure Decode_ESCAPE_SSE5A_7A_void(PInst: PInstruction); 38 | procedure Decode_ESCAPE_SSE5A_7B_void(PInst: PInstruction); 39 | procedure Decode_ESCAPE_FPU_D8_void(PInst: PInstruction); 40 | procedure Decode_ESCAPE_FPU_D9_void(PInst: PInstruction); 41 | procedure Decode_ESCAPE_FPU_DA_void(PInst: PInstruction); 42 | procedure Decode_ESCAPE_FPU_DB_void(PInst: PInstruction); 43 | procedure Decode_ESCAPE_FPU_DC_void(PInst: PInstruction); 44 | procedure Decode_ESCAPE_FPU_DD_void(PInst: PInstruction); 45 | procedure Decode_ESCAPE_FPU_DE_void(PInst: PInstruction); 46 | procedure Decode_ESCAPE_FPU_DF_void(PInst: PInstruction); 47 | 48 | implementation 49 | 50 | uses 51 | UnivDisasm.Internal.Common, 52 | UnivDisasm.Cnsts; 53 | 54 | procedure Decode_ESCAPE_TABLE_2_void(PInst: PInstruction); 55 | begin 56 | PInst^.SetTable(GF_TABLE_2); 57 | TABLE_2[PInst^.NextInst^](PInst); 58 | end; 59 | 60 | procedure Decode_ESCAPE_TABLE_38_void(PInst: PInstruction); 61 | begin 62 | // TABLE_38 void 63 | PInst^.SetTable(GF_TABLE_38); 64 | TABLE_38[PInst^.NextInst^](PInst); 65 | end; 66 | 67 | procedure Decode_ESCAPE_TABLE_3A_void(PInst: PInstruction); 68 | begin 69 | // TABLE_3A void 70 | PInst^.SetTable(GF_TABLE_3A); 71 | TABLE_3A[PInst^.NextInst^](PInst); 72 | end; 73 | 74 | procedure Decode_ESCAPE_3DNow_F_void(PInst: PInstruction); 75 | begin 76 | // 3DNow_F void 77 | PInst^.SetTable(GF_TABLE_3DNOW); 78 | DecodeModRm(PInst); 79 | TABLE_3DNOW[PInst^.NextInst^](PInst); 80 | end; 81 | 82 | procedure Decode_ESCAPE_SSE5A_24_void(PInst: PInstruction); 83 | var 84 | Op: Byte; 85 | begin 86 | // SSE5A void 87 | PInst^.SetTable(GF_TABLE_SSE5_24); 88 | Op := PInst^.NextInst^; // Opcode3. 89 | if not PInst^.Next() then 90 | Exit; 91 | PInst^.InternalData.DRex := True; 92 | DecodeModRm(PInst); 93 | TABLE_SSE5A24[Op](PInst); 94 | end; 95 | 96 | procedure Decode_ESCAPE_SSE5A_25_void(PInst: PInstruction); 97 | var 98 | Op: Byte; 99 | begin 100 | // SSE5A void 101 | PInst^.SetTable(GF_TABLE_SSE5_25); 102 | Op := PInst^.NextInst^; // Opcode3. 103 | if not PInst^.Next() then 104 | Exit; 105 | PInst^.InternalData.DRex := True; 106 | DecodeModRm(PInst); 107 | TABLE_SSE5A25[Op](PInst); 108 | end; 109 | 110 | procedure Decode_ESCAPE_SSE5A_7A_void(PInst: PInstruction); 111 | var 112 | Op: Byte; 113 | begin 114 | // SSE5A void 115 | PInst^.SetTable(GF_TABLE_SSE5_7A); 116 | Op := PInst^.NextInst^; // Opcode3. 117 | if not PInst^.Next() then 118 | Exit; 119 | PInst^.InternalData.DRex := True; 120 | DecodeModRm(PInst); 121 | TABLE_SSE5A7A[Op](PInst); 122 | end; 123 | 124 | procedure Decode_ESCAPE_SSE5A_7B_void(PInst: PInstruction); 125 | var 126 | Op: Byte; 127 | begin 128 | // SSE5A void 129 | PInst^.SetTable(GF_TABLE_SSE5_7B); 130 | Op := PInst^.NextInst^; // Opcode3. 131 | if not PInst^.Next() then 132 | Exit; 133 | PInst^.InternalData.DRex := True; 134 | DecodeModRm(PInst); 135 | TABLE_SSE5A7B[Op](PInst); 136 | end; 137 | 138 | procedure Decode_ESCAPE_FPU_D8_void(PInst: PInstruction); 139 | begin 140 | PInst^.SetTable(GF_TABLE_FPU_D8); 141 | DecodeModRm(PInst); 142 | TABLE_FPU0[PInst^.ModRm.Value](PInst); 143 | end; 144 | 145 | procedure Decode_ESCAPE_FPU_D9_void(PInst: PInstruction); 146 | begin 147 | PInst^.SetTable(GF_TABLE_FPU_D9); 148 | DecodeModRm(PInst); 149 | TABLE_FPU1[PInst^.ModRm.Value](PInst); 150 | end; 151 | 152 | procedure Decode_ESCAPE_FPU_DA_void(PInst: PInstruction); 153 | begin 154 | PInst^.SetTable(GF_TABLE_FPU_DA); 155 | DecodeModRm(PInst); 156 | TABLE_FPU2[PInst^.ModRm.Value](PInst); 157 | end; 158 | 159 | procedure Decode_ESCAPE_FPU_DB_void(PInst: PInstruction); 160 | begin 161 | PInst^.SetTable(GF_TABLE_FPU_DB); 162 | DecodeModRm(PInst); 163 | TABLE_FPU3[PInst^.ModRm.Value](PInst); 164 | end; 165 | 166 | procedure Decode_ESCAPE_FPU_DC_void(PInst: PInstruction); 167 | begin 168 | PInst^.SetTable(GF_TABLE_FPU_DC); 169 | DecodeModRm(PInst); 170 | TABLE_FPU4[PInst^.ModRm.Value](PInst); 171 | end; 172 | 173 | procedure Decode_ESCAPE_FPU_DD_void(PInst: PInstruction); 174 | begin 175 | PInst^.SetTable(GF_TABLE_FPU_DD); 176 | DecodeModRm(PInst); 177 | TABLE_FPU5[PInst^.ModRm.Value](PInst); 178 | end; 179 | 180 | procedure Decode_ESCAPE_FPU_DE_void(PInst: PInstruction); 181 | begin 182 | PInst^.SetTable(GF_TABLE_FPU_DE); 183 | DecodeModRm(PInst); 184 | TABLE_FPU6[PInst^.ModRm.Value](PInst); 185 | end; 186 | 187 | procedure Decode_ESCAPE_FPU_DF_void(PInst: PInstruction); 188 | begin 189 | PInst^.SetTable(GF_TABLE_FPU_DF); 190 | DecodeModRm(PInst); 191 | TABLE_FPU7[PInst^.ModRm.Value](PInst); 192 | end; 193 | 194 | end. 195 | -------------------------------------------------------------------------------- /Common/UnivDisasm/UnivDisasm.Syntax.NilSyntax.pas: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is UnivDisasm.Syntax.NilSyntax.pas 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | unit UnivDisasm.Syntax.NilSyntax; 25 | 26 | interface 27 | 28 | {$I Config.inc} 29 | 30 | uses 31 | UnivDisasm.Disasm; 32 | 33 | procedure NilSyntax(PInst: PInstruction); 34 | 35 | const 36 | SX_NIL_SYNTAX = $01; 37 | 38 | implementation 39 | 40 | uses UnivDisasm.Cnsts; 41 | 42 | procedure NilSyntax(PInst: PInstruction); 43 | begin 44 | { Nothing !!! } 45 | FillChar(PInst^.InstStr, 4, #$00); 46 | end; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /Common/UnivDisasm/UnivDisasm.Syntax.Utils.pas: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is UnivDisasm.Syntax.Utils.pas 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | unit UnivDisasm.Syntax.Utils; 25 | 26 | interface 27 | 28 | {$I Config.inc} 29 | 30 | uses UnivDisasm.Disasm; 31 | 32 | procedure fMoveChar(PInst: PInstruction; const c: UnivChar); {$IFDEF MustInline} inline; {$ENDIF} 33 | procedure fMoveChars(PInst: PInstruction; const S: UnivString); 34 | procedure MoveMnem(PInst: PInstruction; const Mnem: UnivString); 35 | function GetRegName(ASyntax: Integer; Reg: TReg): UnivString; 36 | 37 | implementation 38 | 39 | uses 40 | UnivDisasm.SyntaxManager, 41 | UnivDisasm.Cnsts, 42 | UnivDisasm.Cnsts.Regs, 43 | UnivDisasm.Utils; 44 | 45 | procedure fMoveChars(PInst: PInstruction; const S: UnivString); 46 | var 47 | L: Integer; 48 | begin 49 | L := Length(S); 50 | fMove(PByte(@PUnivChar(S)[0])^, Pointer(PInst^.InstStr)^, L); 51 | Inc(PInst^.InstStr, L); 52 | end; 53 | 54 | procedure fMoveChar(PInst: PInstruction; const c: UnivChar); 55 | begin 56 | if c = #00 then 57 | Exit; 58 | PInst^.InstStr^ := c; 59 | Inc(PInst^.InstStr); 60 | end; 61 | 62 | procedure MoveMnem(PInst: PInstruction; const Mnem: UnivString); 63 | var 64 | L: Integer; 65 | P: PByte; 66 | begin 67 | L := Length(Mnem); 68 | P := PByte(PInst^.Mnem); 69 | fMove(PByte(@PUnivChar(Mnem)[0])^, Pointer(PInst^.Mnem)^, L); 70 | Inc(P, L); 71 | P^ := $00; 72 | end; 73 | 74 | function GetRegName(ASyntax: Integer; Reg: TReg): UnivString; 75 | var 76 | id: Word; 77 | RegName: Pointer; 78 | PArray: PStrArray; 79 | P: PByte; 80 | PData: PSyntaxData; 81 | begin 82 | PData := SyntaxManager.FData[ASyntax]; 83 | if Reg and MagicRexMask <> 0 then 84 | begin 85 | P := PData^.UserRegsData^.LegacyRegs8R; 86 | end 87 | else if Reg and REGS_TYPE_MASK = REGS_GP then 88 | begin 89 | id := (Reg shr $8) and $F; 90 | P := PData^.LegacyRegs[id]; 91 | end 92 | else 93 | begin 94 | id := Reg shr $C; 95 | P := PData^.RegsName[id]; 96 | end; 97 | id := Reg and $1F; 98 | PArray := PStrArray(P); 99 | RegName := Pointer(PArray[id]); 100 | Result := UnivString(RegName); 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Common/UnivDisasm/UnivDisasm.SyntaxManager.pas: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is UnivDisasm.SyntaxManager.pas 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | unit UnivDisasm.SyntaxManager; 25 | 26 | interface 27 | 28 | {$I Config.inc} 29 | {$HINTS Off} 30 | 31 | uses 32 | Generics.Collections, 33 | UnivDisasm.Disasm; 34 | 35 | const 36 | { Max allowed syntax } 37 | MAX_SYNTAX_DECODER = $10; 38 | 39 | { SyntaxManager ERRORS } 40 | SME_INDEX_NOT_FOUND = -1; 41 | SME_SYNTAX_ALREADY_EXISTS = -2; 42 | SME_REGISTER_SYNTAX_FAILED = -3; 43 | SME_EXCEEDED_MAX_SYNTAX_DECODER = -3; 44 | 45 | type 46 | 47 | TRegistersData = record 48 | LegacyRegs8: PByte; 49 | LegacyRegs8R: PByte; 50 | LegacyRegs16: PByte; 51 | LegacyRegs32: PByte; 52 | LegacyRegs64: PByte; 53 | FPURegs: PByte; 54 | CntrlRegs: PByte; 55 | DbgRegs: PByte; 56 | MMXRegs: PByte; 57 | XMMRegs: PByte; 58 | YMMRegs: PByte; 59 | ZMMRegs: PByte; 60 | KRegs: PByte; 61 | MaskRegs: PByte; 62 | BoundRegs: PByte; 63 | TableRegs: PByte; 64 | SegRegs: PByte; 65 | InvalidRegs: PByte; 66 | end; 67 | 68 | PRegistersData = ^TRegistersData; 69 | 70 | TSyntaxData = record 71 | UserRegsData: PRegistersData; 72 | LegacyRegs: array [0 .. 8] of PByte; 73 | RegsName: array [0 .. 14] of PByte; 74 | end; 75 | 76 | PSyntaxData = ^TSyntaxData; 77 | 78 | TSyntaxManager = record 79 | private 80 | FLock: TObject; 81 | FNextSyntax: Integer; 82 | FRegisteredSyntax: TDictionary; 83 | procedure Init; 84 | procedure Die; 85 | public 86 | FData: TDictionary; 87 | SyntaxDecoderArray: array [0 .. MAX_SYNTAX_DECODER] of TDecoderProc; 88 | function GetSyntaxIndex(ASyntax: Integer): Integer; 89 | function RegisterSyntax(ASyntax: Integer; SyntaxProc: TDecoderProc; PRegsData: PRegistersData): Integer; 90 | procedure Enter; 91 | procedure Leave; 92 | end; 93 | 94 | var 95 | SyntaxManager: TSyntaxManager = (FNextSyntax: - 1); 96 | 97 | implementation 98 | 99 | uses 100 | UnivDisasm.Syntax.UnivSyntax, 101 | UnivDisasm.Syntax.NilSyntax; 102 | 103 | { TSyntaxManager } 104 | 105 | procedure TSyntaxManager.Die; 106 | var 107 | Value: PSyntaxData; 108 | begin 109 | FLock.Free; 110 | FRegisteredSyntax.Free; 111 | for Value in FData.Values do 112 | begin 113 | FreeMem(Value); 114 | end; 115 | FData.Free; 116 | end; 117 | 118 | procedure TSyntaxManager.Enter; 119 | begin 120 | TMonitor.Enter(FLock); 121 | end; 122 | 123 | function TSyntaxManager.GetSyntaxIndex(ASyntax: Integer): Integer; 124 | begin 125 | Result := SME_INDEX_NOT_FOUND; 126 | if FRegisteredSyntax.ContainsKey(ASyntax) then 127 | Result := FRegisteredSyntax[ASyntax]; 128 | end; 129 | 130 | procedure TSyntaxManager.Init; 131 | begin 132 | FLock := TObject.Create; 133 | FRegisteredSyntax := TDictionary.Create(); 134 | FData := TDictionary.Create(); 135 | FNextSyntax := 0; 136 | end; 137 | 138 | procedure TSyntaxManager.Leave; 139 | begin 140 | TMonitor.Exit(FLock); 141 | end; 142 | 143 | function TSyntaxManager.RegisterSyntax(ASyntax: Integer; SyntaxProc: TDecoderProc; PRegsData: PRegistersData): Integer; 144 | var 145 | PData: PSyntaxData; 146 | begin 147 | Result := SME_REGISTER_SYNTAX_FAILED; 148 | if FNextSyntax < 0 then 149 | Init; 150 | if FNextSyntax > MAX_SYNTAX_DECODER then 151 | Exit(SME_EXCEEDED_MAX_SYNTAX_DECODER); 152 | try 153 | Enter; 154 | if FRegisteredSyntax.ContainsKey(ASyntax) then 155 | Exit(SME_SYNTAX_ALREADY_EXISTS); 156 | SyntaxDecoderArray[FNextSyntax] := SyntaxProc; 157 | FRegisteredSyntax.Add(ASyntax, FNextSyntax); 158 | PData := AllocMem(SizeOf(TSyntaxData)); 159 | PData^.UserRegsData := PRegsData; 160 | if Assigned(PRegsData) then 161 | begin 162 | PData^.LegacyRegs[0] := PRegsData^.InvalidRegs; 163 | PData^.LegacyRegs[1] := PRegsData^.LegacyRegs8; 164 | PData^.LegacyRegs[2] := PRegsData^.LegacyRegs16; 165 | PData^.LegacyRegs[3] := PRegsData^.InvalidRegs; 166 | PData^.LegacyRegs[4] := PRegsData^.LegacyRegs32; 167 | PData^.LegacyRegs[5] := PRegsData^.InvalidRegs; 168 | PData^.LegacyRegs[6] := PRegsData^.InvalidRegs; 169 | PData^.LegacyRegs[7] := PRegsData^.InvalidRegs; 170 | PData^.LegacyRegs[8] := PRegsData^.LegacyRegs64; 171 | 172 | PData^.RegsName[00] := PRegsData^.InvalidRegs; 173 | PData^.RegsName[01] := PRegsData^.InvalidRegs; 174 | PData^.RegsName[02] := PRegsData^.FPURegs; 175 | PData^.RegsName[03] := PRegsData^.KRegs; 176 | PData^.RegsName[04] := PRegsData^.MMXRegs; 177 | PData^.RegsName[05] := PRegsData^.XMMRegs; 178 | PData^.RegsName[06] := PRegsData^.YMMRegs; 179 | PData^.RegsName[07] := PRegsData^.ZMMRegs; 180 | PData^.RegsName[08] := PRegsData^.CntrlRegs; 181 | PData^.RegsName[09] := PRegsData^.DbgRegs; 182 | PData^.RegsName[10] := PRegsData^.TableRegs; 183 | PData^.RegsName[11] := PRegsData^.BoundRegs; 184 | PData^.RegsName[12] := PRegsData^.SegRegs; 185 | PData^.RegsName[13] := PRegsData^.InvalidRegs; 186 | PData^.RegsName[14] := PRegsData^.InvalidRegs; 187 | end; 188 | FData.Add(ASyntax, PData); 189 | Result := FNextSyntax; 190 | Inc(FNextSyntax); 191 | finally 192 | Leave; 193 | end; 194 | end; 195 | 196 | initialization 197 | 198 | SyntaxManager.RegisterSyntax(SX_UNIV_SYNTAX, UnivSyntax, GetUnivSyntaxData); 199 | SyntaxManager.RegisterSyntax(SX_NIL_SYNTAX, NilSyntax, nil); 200 | 201 | finalization 202 | 203 | SyntaxManager.Die; 204 | 205 | end. 206 | -------------------------------------------------------------------------------- /Common/UnivDisasm/UnivDisasm.Utils.pas: -------------------------------------------------------------------------------- 1 | // 2 | // *************************************************************************** // 3 | // This Source Code Form is subject to the terms of the Mozilla Public 4 | // License, v. 2.0. If a copy of the MPL was not distributed with this 5 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | // *************************************************************************** // 7 | // 8 | // 9 | // *************************************************************************** // 10 | // UnivDisasm library. 11 | // 12 | // This file is a part of UnivDisasm library. 13 | // 14 | // https://github.com/MahdiSafsafi/UnivDisasm 15 | // 16 | // The Original Code is UnivDisasm.Utils.pas 17 | // 18 | // The Initial Developer of the Original Code is Mahdi Safsafi. 19 | // Portions created by Mahdi Safsafi . are Copyright (C) 2015-2019 Mahdi Safsafi. 20 | // All Rights Reserved. 21 | // *************************************************************************** // 22 | // 23 | 24 | unit UnivDisasm.Utils; 25 | 26 | interface 27 | 28 | {$I Config.inc} 29 | 30 | uses UnivDisasm.Disasm; 31 | 32 | function fIntToHex(Value: Integer; Digits: Integer; Buffer: PUnivChar): Integer; overload; 33 | function fIntToHex(Value: Int64; Digits: Integer; Buffer: PUnivChar): Integer; overload; 34 | function fIntToHex(Value: UInt64; Digits: Integer; Buffer: PUnivChar): Integer; overload; 35 | procedure fMove(const Source; var Dest; Count: NativeInt); {$IF DEFINED(PUREPASCAL) AND DEFINED(MustInline)}inline; {$ENDIF} 36 | 37 | implementation 38 | 39 | const 40 | TwoHexLookup: packed array [0 .. 255] of array [1 .. 2] of UnivChar = ( // 41 | '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', 42 | '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', 43 | '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 44 | 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 45 | 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff'); 46 | 47 | function _fIntToHex(Value: UInt64; Digits: Integer; Pc: PUnivChar): Integer; 48 | var 49 | I32: Integer; 50 | I, J: UInt64; 51 | P: Integer; 52 | NewLen: Integer; 53 | begin 54 | NewLen := 1; 55 | I := Value shr 4; 56 | while I > 0 do 57 | begin 58 | Inc(NewLen); 59 | I := I shr 4; 60 | end; 61 | if Digits > NewLen then 62 | begin 63 | Result := Digits; 64 | for I32 := 0 to (Digits - NewLen) - 1 do 65 | Pc[I32] := '0'; 66 | P := Digits - NewLen; 67 | end 68 | else 69 | begin 70 | Result := NewLen; 71 | P := 0; 72 | end; 73 | I := Value; 74 | while NewLen > 2 do 75 | begin 76 | J := I and $FF; 77 | I := I shr 8; 78 | Dec(NewLen, 2); 79 | Pc[P + NewLen] := TwoHexLookup[J][1]; 80 | Pc[P + NewLen + 1] := TwoHexLookup[J][2]; 81 | end; 82 | if NewLen = 2 then 83 | begin 84 | Pc[P] := TwoHexLookup[I][1]; 85 | Pc[P + 1] := TwoHexLookup[I][2]; 86 | end 87 | else 88 | Pc[P] := TwoHexLookup[I][2]; 89 | end; 90 | 91 | function fIntToHex(Value: Integer; Digits: Integer; Buffer: PUnivChar): Integer; 92 | begin 93 | Result := _fIntToHex(Cardinal(Value), Digits, Buffer); 94 | end; 95 | 96 | function fIntToHex(Value: Int64; Digits: Integer; Buffer: PUnivChar): Integer; 97 | begin 98 | Result := _fIntToHex(Value, Digits, Buffer); 99 | end; 100 | 101 | function fIntToHex(Value: UInt64; Digits: Integer; Buffer: PUnivChar): Integer; 102 | begin 103 | Result := _fIntToHex(Value, Digits, Buffer); 104 | end; 105 | 106 | procedure fMove(const Source; var Dest; Count: NativeInt); 107 | {$IFDEF PUREPASCAL} 108 | begin 109 | Move(Source, Dest, Count); 110 | end; 111 | {$ELSE !PUREPASCAL} 112 | asm 113 | {$IFDEF CPUX86} 114 | { EAX = Source 115 | ECX = Count 116 | EDX = Dest } 117 | push ebx 118 | cmp ecx,8 119 | jle @less_eq_8 120 | jmp @large_8 121 | @less_eq_8: 122 | shl ecx,2 123 | add ecx,offset @@jmp_address_data 124 | jmp [ecx] 125 | jmp @end 126 | 127 | @mov1: { Move one byte } 128 | mov eax,[eax] 129 | mov byte[edx],al 130 | jmp @end 131 | 132 | @mov2: { Move two bytes } 133 | mov eax,[eax] 134 | mov word[edx],ax 135 | jmp @end 136 | 137 | @mov3: { Move 3 Bytes } 138 | mov eax,[eax] 139 | mov byte[edx],al 140 | shr eax,8 141 | mov word[edx+1],ax 142 | jmp @end 143 | 144 | @mov4: { Move dword (4 Bytes) } 145 | mov eax,[eax] 146 | mov dword[edx],eax 147 | jmp @end 148 | 149 | @mov5: { Move 5 Bytes } 150 | mov ebx,[eax+4] 151 | mov eax,[eax] 152 | mov dword[edx],eax 153 | mov byte[edx+4],bl 154 | jmp @end 155 | 156 | @mov6: { Move 6 Bytes } 157 | mov ebx,[eax+4] 158 | mov eax,[eax] 159 | mov dword[edx],eax 160 | mov word[edx+4],bx 161 | jmp @end 162 | 163 | @mov7: { Move 7 Bytes } 164 | mov ebx,[eax+4] 165 | mov eax,[eax] 166 | mov dword[edx],eax 167 | mov word[edx+4],bx 168 | shr ebx,16 169 | mov byte[edx+6],bl 170 | jmp @end 171 | 172 | @mov8: { Move qword (8 Bytes) } 173 | movq mm0,qword[eax] 174 | movq qword[edx],mm0 175 | emms 176 | jmp @end 177 | 178 | @large_8:{ Bigger than 8 bytes ! } 179 | movq mm0,qword[eax+ecx*1-8] 180 | movq qword[edx+ecx*1-8],mm0 181 | add ecx,-8 182 | cmp ecx,8 183 | jge @large_8 184 | emms 185 | shl ecx,2 186 | add ecx,offset @@jmp_address_data 187 | jmp [ecx] // Process the rest ! 188 | jmp @end 189 | 190 | @@jmp_address_data: 191 | dd @end 192 | dd @mov1 193 | dd @mov2 194 | dd @mov3 195 | dd @mov4 196 | dd @mov5 197 | dd @mov6 198 | dd @mov7 199 | dd @mov8 200 | dd @end 201 | @end: 202 | pop ebx 203 | {$ELSE !CPUX86} 204 | { RCX = Source 205 | R8 = Count 206 | RDX = Dest } 207 | push r9 208 | and r8,$FFFFFFFF 209 | cmp r8,8 210 | jle @less_eq_8 211 | jmp @large_8 212 | @less_eq_8: 213 | shl r8,3 214 | mov r9,offset @@jmp_address_data 215 | add r9,r8 216 | jmp [r9] 217 | jmp @end 218 | 219 | @mov1: { Move one byte } 220 | mov rcx,qword[rcx] 221 | mov byte[rdx],cl 222 | jmp @end 223 | 224 | @mov2: { Move two bytes } 225 | mov rcx,qword[rcx] 226 | mov word[rdx],cx 227 | jmp @end 228 | 229 | @mov3: { Move 3 bytes } 230 | mov rcx,qword[rcx] 231 | mov byte[rdx],cl 232 | shr ecx,8 233 | mov word[rdx+1],cx 234 | jmp @end 235 | 236 | @mov4: { Move 4 bytes } 237 | mov rcx,qword[rcx] 238 | mov dword[rdx],ecx 239 | jmp @end 240 | 241 | @mov5: { Move 5 bytes } 242 | mov rcx,qword[rcx] 243 | mov dword[rdx],ecx 244 | shr rcx,32 245 | mov byte[rdx+4],cl 246 | jmp @end 247 | 248 | @mov6: { Move 6 bytes } 249 | mov rcx,qword[rcx] 250 | mov dword[rdx],ecx 251 | shr rcx,32 252 | mov word[rdx+4],cx 253 | jmp @end 254 | 255 | @mov7: { Move 7 bytes } 256 | mov rcx,qword[rcx] 257 | mov dword[rdx],ecx 258 | shr rcx,32 259 | mov word[rdx+4],cx 260 | shr rcx,16 261 | mov byte[rdx+6],cl 262 | jmp @end 263 | 264 | @mov8: { Move 8 bytes } 265 | mov rcx,qword[rcx] 266 | mov qword[rdx],rcx 267 | jmp @end 268 | 269 | @large_8: 270 | mov r9,qword[rcx+r8*1-8] 271 | mov qword[rdx+r8*1-8],r9 272 | add r8,-8 273 | cmp r8,8 274 | jge @large_8 275 | shl r8,3 276 | mov r9,offset @@jmp_address_data 277 | add r9,r8 278 | jmp [r9] // Process the rest ! 279 | 280 | @@jmp_address_data: 281 | dq @end 282 | dq @mov1 283 | dq @mov2 284 | dq @mov3 285 | dq @mov4 286 | dq @mov5 287 | dq @mov6 288 | dq @mov7 289 | dq @mov8 290 | dq @end 291 | 292 | @end: 293 | pop r9 294 | {$ENDIF CPUX86} 295 | end; 296 | {$ENDIF PUREPASCAL} 297 | 298 | end. 299 | -------------------------------------------------------------------------------- /Demo/DebugEngineDemo.dpr: -------------------------------------------------------------------------------- 1 | program DebugEngineDemo; 2 | 3 | uses 4 | Vcl.Forms, 5 | uMain in 'uMain.pas' {Main}, 6 | DebugEngine.AsmRegUtils in '..\Source\DebugEngine.AsmRegUtils.pas', 7 | DebugEngine.Core in '..\Source\DebugEngine.Core.pas', 8 | DebugEngine.DebugInfo in '..\Source\DebugEngine.DebugInfo.pas', 9 | DebugEngine.DebugUtils in '..\Source\DebugEngine.DebugUtils.pas', 10 | DebugEngine.Disasm in '..\Source\DebugEngine.Disasm.pas', 11 | DebugEngine.HookException in '..\Source\DebugEngine.HookException.pas', 12 | DebugEngine.MemoryHack in '..\Source\DebugEngine.MemoryHack.pas', 13 | DebugEngine.PeUtils in '..\Source\DebugEngine.PeUtils.pas', 14 | DebugEngine.Trace in '..\Source\DebugEngine.Trace.pas', 15 | UnivDisasm.Cnsts.Instructions in '..\Common\UnivDisasm\UnivDisasm.Cnsts.Instructions.pas', 16 | UnivDisasm.Cnsts.Mnemonics in '..\Common\UnivDisasm\UnivDisasm.Cnsts.Mnemonics.pas', 17 | UnivDisasm.Cnsts in '..\Common\UnivDisasm\UnivDisasm.Cnsts.pas', 18 | UnivDisasm.Cnsts.Regs in '..\Common\UnivDisasm\UnivDisasm.Cnsts.Regs.pas', 19 | UnivDisasm.Disasm in '..\Common\UnivDisasm\UnivDisasm.Disasm.pas', 20 | UnivDisasm.Internal.Common in '..\Common\UnivDisasm\UnivDisasm.Internal.Common.pas', 21 | UnivDisasm.Internal.Escape in '..\Common\UnivDisasm\UnivDisasm.Internal.Escape.pas', 22 | UnivDisasm.Internal.Prefixes in '..\Common\UnivDisasm\UnivDisasm.Internal.Prefixes.pas', 23 | UnivDisasm.Syntax.NilSyntax in '..\Common\UnivDisasm\UnivDisasm.Syntax.NilSyntax.pas', 24 | UnivDisasm.Syntax.UnivSyntax in '..\Common\UnivDisasm\UnivDisasm.Syntax.UnivSyntax.pas', 25 | UnivDisasm.Syntax.Utils in '..\Common\UnivDisasm\UnivDisasm.Syntax.Utils.pas', 26 | UnivDisasm.SyntaxManager in '..\Common\UnivDisasm\UnivDisasm.SyntaxManager.pas', 27 | UnivDisasm.Utils in '..\Common\UnivDisasm\UnivDisasm.Utils.pas'; 28 | 29 | {$R *.res} 30 | 31 | begin 32 | Application.Initialize; 33 | Application.MainFormOnTaskbar := True; 34 | Application.CreateForm(TMain, Main); 35 | Application.Run; 36 | end. 37 | -------------------------------------------------------------------------------- /Demo/DebugEngineDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Demo/DebugEngineDemo.res -------------------------------------------------------------------------------- /Demo/uMain.dfm: -------------------------------------------------------------------------------- 1 | object Main: TMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'DebugEngineDemo' 5 | ClientHeight = 387 6 | ClientWidth = 547 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object LogMem: TMemo 18 | Left = 0 19 | Top = 0 20 | Width = 547 21 | Height = 219 22 | Align = alClient 23 | Lines.Strings = ( 24 | 'LogMem') 25 | ScrollBars = ssVertical 26 | TabOrder = 0 27 | end 28 | object Panel1: TPanel 29 | Left = 0 30 | Top = 219 31 | Width = 547 32 | Height = 168 33 | Align = alBottom 34 | Caption = 'Panel1' 35 | ShowCaption = False 36 | TabOrder = 1 37 | object BtnStackTrace: TButton 38 | Left = 368 39 | Top = 22 40 | Width = 163 41 | Height = 25 42 | Caption = 'Stack Trace' 43 | TabOrder = 0 44 | OnClick = BtnStackTraceClick 45 | end 46 | object BtnTryTrace: TButton 47 | Left = 368 48 | Top = 53 49 | Width = 163 50 | Height = 25 51 | Caption = 'Trace try blocks' 52 | TabOrder = 1 53 | OnClick = BtnTryTraceClick 54 | end 55 | object BtnLegRegSnap: TButton 56 | Left = 8 57 | Top = 22 58 | Width = 185 59 | Height = 25 60 | Caption = 'Snapshot of legacy registers' 61 | TabOrder = 2 62 | OnClick = BtnLegRegSnapClick 63 | end 64 | object BtnDisasm: TButton 65 | Left = 8 66 | Top = 85 67 | Width = 185 68 | Height = 25 69 | Caption = 'Disasm and comment' 70 | TabOrder = 3 71 | OnClick = BtnDisasmClick 72 | end 73 | object BtnAddrInfo: TButton 74 | Left = 199 75 | Top = 22 76 | Width = 163 77 | Height = 25 78 | Caption = 'Address info' 79 | TabOrder = 4 80 | OnClick = BtnAddrInfoClick 81 | end 82 | object BtnEnumTryBlocks: TButton 83 | Left = 368 84 | Top = 84 85 | Width = 163 86 | Height = 25 87 | Caption = 'Enum try blocks' 88 | TabOrder = 5 89 | OnClick = BtnEnumTryBlocksClick 90 | end 91 | object BtnInsertDbgInfo: TButton 92 | Left = 199 93 | Top = 85 94 | Width = 163 95 | Height = 25 96 | Caption = 'Insert debug info' 97 | TabOrder = 6 98 | OnClick = BtnInsertDbgInfoClick 99 | end 100 | object BtnVectorSnap: TButton 101 | Left = 8 102 | Top = 54 103 | Width = 185 104 | Height = 25 105 | Caption = 'Snapshot of vector registers' 106 | TabOrder = 7 107 | OnClick = BtnVectorSnapClick 108 | end 109 | object BtnRemoveDbgInfo: TButton 110 | Left = 199 111 | Top = 116 112 | Width = 163 113 | Height = 25 114 | Caption = 'Remove debug info' 115 | TabOrder = 8 116 | OnClick = BtnRemoveDbgInfoClick 117 | end 118 | object BtnTest: TButton 119 | Left = 368 120 | Top = 116 121 | Width = 163 122 | Height = 25 123 | Caption = 'Test exception' 124 | TabOrder = 9 125 | OnClick = BtnTestClick 126 | end 127 | object BtnSymAddr: TButton 128 | Left = 199 129 | Top = 54 130 | Width = 163 131 | Height = 25 132 | Caption = 'Address of symbol' 133 | TabOrder = 10 134 | OnClick = BtnSymAddrClick 135 | end 136 | object BtnSizeOfProc: TButton 137 | Left = 8 138 | Top = 116 139 | Width = 185 140 | Height = 25 141 | Caption = 'Size of proc' 142 | TabOrder = 11 143 | OnClick = BtnSizeOfProcClick 144 | end 145 | end 146 | end 147 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DebugEngine 2 | ## What is DebugEngine ? 3 | DebugEngine is a collection of utilities related to debug stuff (stack trace, CPU registers snapshot, debug info, ...). 4 | Basically, I started to write a commercial error log plugin for Delphi, then I noticed that my internal framework got bigger and bigger. So I decided to share it with the community in hope it will be useful. 5 | 6 | ## Features: 7 | DebugEngine has a lot of functions and utilities allowing to you to do for example: 8 | - Support x86 and x64 architecture. 9 | - Accessing Delphi debug info. 10 | - [Getting address of symbol from its name](https://github.com/MahdiSafsafi/DebugEngine/wiki/Getting-started#getting-address-of-symbol). 11 | - Delphi map parsing and map converter to binary format. 12 | - Remove and restore Delphi debug info from PE file. 13 | - Smart [stack trace](https://github.com/MahdiSafsafi/DebugEngine/wiki/Stack-trace). 14 | - Try blocks trace. 15 | - Updatting resource of Delphi app even if it was linked with debug info. 16 | - [Inserting custom debug info into PE file](https://github.com/MahdiSafsafi/DebugEngine/wiki/Getting-started#linking-smap-file-into-your-executable). 17 | - CPU registers snapshot. 18 | - Accessing vector registers. 19 | - [Disasm and comment function with Debug info](https://github.com/MahdiSafsafi/DebugEngine/wiki/Getting-started#disasm-and-comment-function). 20 | - Enumerating exception handlers. 21 | - Delphi exception stack trace hook. 22 | - Delphi string detection. 23 | - PE utils. 24 | - Disasm utils. 25 | - ... 26 | 27 | ## Getting started: 28 | Please refer to the [Wiki page](https://github.com/MahdiSafsafi/DebugEngine/wiki) and see [Demo](https://github.com/MahdiSafsafi/DebugEngine/tree/master/Demo) included with the library. 29 | Note that all public functions are documented (XML doc). However if you don't understand something, please feel free to contact me. 30 | 31 | 32 | -------------------------------------------------------------------------------- /Script/MXCSRGen.pl: -------------------------------------------------------------------------------- 1 | 2 | # Author = Mahdi Safsafi. 3 | 4 | my $MXCSRType = 'TMXCSR'; 5 | my $MXCSRHlp = 'TMXCSRHlp'; 6 | 7 | my @mxcsr = qw/FZ 0 0 PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE/; 8 | @mxcsr = reverse @mxcsr; 9 | 10 | open( F, '>', 'mxcsr.inc' ); 11 | print F "\n"; 12 | print F" { Do not edit ! => $MXCSRHlp was auto generated by $0 }\n"; 13 | print F"type\n $MXCSRHlp = record helper for $MXCSRType\n private\n"; 14 | 15 | foreach (@mxcsr) { 16 | next if (/0|1/); 17 | print F" function Get$_:Boolean;\n"; 18 | print F" procedure Set$_(Value:Boolean);\n"; 19 | } 20 | 21 | # custom GetRC/SetRC ! 22 | print F" function GetRC:ShortInt;\n"; 23 | print F" procedure SetRC(Value:ShortInt);\n"; 24 | 25 | print F" public\n"; 26 | 27 | foreach (@mxcsr) { 28 | next if (/0|1/); 29 | print F" property $_:Boolean read Get$_ write Set$_;\n"; 30 | } 31 | print F" property RC:ShortInt read GetRC write SetRC;\n"; 32 | print F"end;\n\n"; 33 | 34 | print F "{ $MXCSRHlp }\n\n"; 35 | 36 | my $i = -1; 37 | foreach (@mxcsr) { 38 | $i++; 39 | next if (/0|1/); 40 | 41 | # Implement GetX 42 | print F"function $MXCSRHlp.Get$_:Boolean;\n"; 43 | print F"begin\n"; 44 | my $mask = 1 << $i; 45 | printf F" Result:= (Self and \$%.6X <> \$00);\n", $mask; 46 | print F"end;\n\n"; 47 | 48 | # Implement SetX 49 | print F"procedure $MXCSRHlp.Set$_(Value:Boolean);\n"; 50 | print F"begin\n"; 51 | $mask = ( ~$mask ) & 0xFFFFFFFF; 52 | printf F " Self:= (Self and \$%X) or (Cardinal(Value) shl \$%.2X);\n", 53 | $mask, $i; 54 | print F"end;\n\n"; 55 | } 56 | 57 | my $RC = <<"__@__"; 58 | function $MXCSRHlp.GetRC: ShortInt; 59 | begin 60 | Result := (Self and \$006000) shr \$0D; 61 | end; 62 | 63 | procedure $MXCSRHlp.SetRC(Value: ShortInt); 64 | begin 65 | Self := (Self and \$FFFF9FFF) or (Cardinal(Value and \$03) shl \$0D); 66 | end; 67 | __@__ 68 | 69 | print F $RC; 70 | 71 | close(F); 72 | print "Done.\n"; 73 | -------------------------------------------------------------------------------- /Script/RFlagsGen.pl: -------------------------------------------------------------------------------- 1 | 2 | # Author = Mahdi Safsafi. 3 | 4 | my $RFlagsType = 'TRFlags'; 5 | my $RFlagsHlp = 'TRFlagsHlp'; 6 | 7 | my @rflags = qw/ID VIP VIF AC VM RF 0 NT 0 0 OF DF IF TF SF ZF 0 AF 0 PF 1 CF/; 8 | @rflags = reverse @rflags; 9 | 10 | open( F, '>', 'rflags.inc' ); 11 | print F "\n"; 12 | print F" { Do not edit ! => $RFlagsHlp was auto generated by $0 }\n"; 13 | print F"type\n $RFlagsHlp = record helper for $RFlagsType\n private\n"; 14 | 15 | foreach (@rflags) { 16 | next if (/0|1/); 17 | print F" function Get$_:Boolean;\n"; 18 | print F" procedure Set$_(Value:Boolean);\n"; 19 | } 20 | print F" function GetIOPL:ShortInt;\n"; 21 | print F" procedure SetIOPL(Value:ShortInt);\n"; 22 | 23 | print F" public\n"; 24 | foreach (@rflags) { 25 | next if (/0|1/); 26 | my $propertyname = $_; 27 | $propertyname =~ s/^(if|of)/&$1/i; # pascal reserved words. 28 | print F" property $propertyname:Boolean read Get$_ write Set$_;\n"; 29 | } 30 | print F" property IOPL:ShortInt read GetIOPL write SetIOPL;\n"; 31 | print F"end;\n\n"; 32 | print F"{ $RFlagsHlp }\n\n"; 33 | 34 | my $i = -1; 35 | foreach (@rflags) { 36 | $i++; 37 | next if (/0|1/); 38 | print F"function $RFlagsHlp.Get$_:Boolean;\n"; 39 | print F"begin\n"; 40 | my $mask = 1 << $i; 41 | printf F" Result:= (Self and \$%.6X <> \$00);\n", $mask; 42 | print F"end;\n\n"; 43 | 44 | print F"procedure $RFlagsHlp.Set$_ (Value:Boolean);\n"; 45 | print F"begin\n"; 46 | $mask = ~$mask; 47 | printf F 48 | " Self:= (Self and NativeUInt(\$%X)) or (NativeUInt(Value) shl \$%.2X);\n", 49 | $mask, $i; 50 | print F"end;\n\n"; 51 | 52 | } 53 | 54 | my $IOPL = <<"__@__"; 55 | function $RFlagsHlp.GetIOPL: ShortInt; 56 | begin 57 | Result := (Self and \$003000) shr \$0C; 58 | end; 59 | 60 | procedure $RFlagsHlp.SetIOPL(Value: ShortInt); 61 | begin 62 | Self := (Self and NativeUInt(\$FFFFFFFFFFFFCFFF)) or (NativeUInt(Value and \$03) shl \$0C); 63 | end; 64 | __@__ 65 | 66 | print F $IOPL; 67 | 68 | close(F); 69 | print "Done.\n"; 70 | -------------------------------------------------------------------------------- /Snapshot/dbg_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Snapshot/dbg_info.png -------------------------------------------------------------------------------- /Snapshot/map_gen.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Snapshot/map_gen.PNG -------------------------------------------------------------------------------- /Source/DebugEngine.HookException.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // Delphi DebugEngine. 3 | // Unit DebugEngine.HookException 4 | // https://github.com/MahdiSafsafi/DebugEngine 5 | 6 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 7 | // you may not use this file except in compliance with the License. You may obtain a copy of the 8 | // License at http://www.mozilla.org/MPL/ 9 | // 10 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 11 | // ANY KIND, either express or implied. See the License for the specific language governing rights 12 | // and limitations under the License. 13 | // 14 | // The Original Code is DebugEngine.HookException.pas. 15 | // 16 | // 17 | // The Initial Developer of the Original Code is Mahdi Safsafi. 18 | // Portions created by Mahdi Safsafi . are Copyright (C) 2016-2019 Mahdi Safsafi. 19 | // All Rights Reserved. 20 | // 21 | // ************************************************************************************************** 22 | 23 | unit DebugEngine.HookException; 24 | 25 | interface 26 | 27 | uses 28 | System.Classes, 29 | System.SysUtils; 30 | 31 | procedure InstallExceptionHook; 32 | procedure RemoveExceptionHook; 33 | 34 | implementation 35 | 36 | uses 37 | DebugEngine.Core, 38 | DebugEngine.Trace; 39 | 40 | function GetStackInfoString(Info: Pointer): string; 41 | begin 42 | Result := string(PChar(Info)); 43 | end; 44 | 45 | function GetExceptionStackInfo(P: PExceptionRecord): Pointer; 46 | var 47 | SL: TStringList; 48 | S: String; 49 | L: Integer; 50 | StackTrace: TCallTrace; 51 | StackInfo: TStackInfo; 52 | PItem: PStackItem; 53 | Item: TStackItem; 54 | LExceptionAddress: Pointer; 55 | I: Integer; 56 | begin 57 | GetStackInfo(StackInfo); 58 | SL := TStringList.Create; 59 | S := ''; 60 | LExceptionAddress := P^.ExceptionAddress; 61 | if GetStackTraceError = 0 then 62 | begin 63 | { First caller is exception address. } 64 | FillChar(Item, SizeOf(Item), #00); 65 | Item.CallAddress := LExceptionAddress; 66 | Item.Info.Address := LExceptionAddress; 67 | SL.Add(LogCall(@Item)); 68 | StackTrace := TCallTrace.Create; 69 | StackTrace.Options:= [soUseFirstCallOnEbp{,soRebuildBrokenEbpChain,soDropCurrentEbpChain}]; 70 | try 71 | StackTrace.StackInfo := StackInfo; 72 | StackTrace.Trace; 73 | for I := 0 to StackTrace.Count - 1 do 74 | begin 75 | PItem := StackTrace.Items[I]; 76 | SL.Add(LogCall(PItem)); 77 | end; 78 | finally 79 | StackTrace.Free; 80 | end; 81 | S := SL.Text; 82 | end; 83 | L := ((S.Length + 1) * 2); 84 | GetMem(Result, L); 85 | Move(PChar(S)^, Result^, L); 86 | SL.Free; 87 | end; 88 | 89 | procedure CleanUpStackInfo(Info: Pointer); 90 | begin 91 | FreeMem(Info); 92 | end; 93 | 94 | procedure InstallExceptionHook; 95 | begin 96 | Exception.GetExceptionStackInfoProc := GetExceptionStackInfo; 97 | Exception.GetStackInfoStringProc := GetStackInfoString; 98 | Exception.CleanUpStackInfoProc := CleanUpStackInfo; 99 | end; 100 | 101 | procedure RemoveExceptionHook; 102 | begin 103 | Exception.GetExceptionStackInfoProc := nil; 104 | Exception.GetStackInfoStringProc := nil; 105 | Exception.CleanUpStackInfoProc := nil; 106 | end; 107 | 108 | initialization 109 | 110 | InstallExceptionHook; 111 | 112 | finalization 113 | 114 | RemoveExceptionHook; 115 | 116 | end. 117 | -------------------------------------------------------------------------------- /Source/DebugEngine.MemoryHack.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // Delphi DebugEngine. 3 | // Unit DebugEngine.MemoryHack 4 | // https://github.com/MahdiSafsafi/DebugEngine 5 | 6 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 7 | // you may not use this file except in compliance with the License. You may obtain a copy of the 8 | // License at http://www.mozilla.org/MPL/ 9 | // 10 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 11 | // ANY KIND, either express or implied. See the License for the specific language governing rights 12 | // and limitations under the License. 13 | // 14 | // The Original Code is DebugEngine.MemoryHack.pas. 15 | // 16 | // 17 | // The Initial Developer of the Original Code is Mahdi Safsafi. 18 | // Portions created by Mahdi Safsafi . are Copyright (C) 2016-2019 Mahdi Safsafi. 19 | // All Rights Reserved. 20 | // 21 | // ************************************************************************************************** 22 | 23 | unit DebugEngine.MemoryHack; 24 | 25 | interface 26 | 27 | {$I DebugEngine.inc} 28 | 29 | uses WinApi.Windows; 30 | 31 | type 32 | TStrType = (stUnknown, stPAnsiChar, stPChar, stAnsiString, stString); 33 | 34 | /// Get string type from address. 35 | /// 36 | /// The address where the string is located. 37 | /// 38 | /// Minimum string length to accept. 39 | /// 40 | /// Maximum string length to accept. 41 | /// 42 | /// Return string type . 43 | /// 44 | /// The function will use MinLength and MaxLength only if the string type is PAnsiChar or PChar. 45 | /// 46 | function GetStrType(Address: Pointer; const MinLength: Integer = 0; const MaxLength: Integer = 0): TStrType; 47 | 48 | /// Check if a pointer points out to a class. 49 | /// 50 | function IsPtrClass(Ptr: Pointer): Boolean; 51 | 52 | implementation 53 | 54 | type 55 | 56 | { From System.pas } 57 | StrRec = packed record 58 | {$IF defined(CPU64BITS)} 59 | _Padding: Integer; // Make 16 byte align for payload.. 60 | {$ENDIF} 61 | codePage: Word; 62 | elemSize: Word; 63 | refCnt: Integer; 64 | length: Integer; 65 | end; 66 | 67 | PStrRec = ^StrRec; 68 | 69 | function GetRawStrType(Ptr: Pointer; const MinLength: Integer = 0; const MaxLength: Integer = 0): TStrType; 70 | var 71 | PStart: PByte; 72 | nZero: Integer; 73 | nb: Integer; 74 | SafeRange: Integer; 75 | begin 76 | Result := stUnknown; 77 | if not Assigned(Ptr) then 78 | Exit; 79 | PStart := Ptr; 80 | nZero := 0; 81 | if MaxLength <= 0 then 82 | SafeRange := High(Integer) - 1 83 | else 84 | SafeRange := MaxLength; 85 | nb := 0; // Processed bytes. 86 | try 87 | // We're going to read from memory 88 | // Access violation error can occur ! 89 | while True do 90 | begin 91 | if (PStart^ = $00) then 92 | begin 93 | if PWord(PStart)^ = $00 then 94 | begin 95 | if (PDWORD(PStart)^ and $00FFFFFF = $00) then 96 | Result := stPChar // Sure it's Unicode ! 97 | else if nZero > 0 then 98 | Result := stPChar 99 | else 100 | Result := stPAnsiChar; 101 | Break; 102 | end; 103 | if nb > 1 then 104 | begin 105 | if nZero = 0 then 106 | begin 107 | Result := stPAnsiChar; 108 | Break; 109 | end; 110 | end; 111 | Inc(nZero); 112 | end; 113 | Inc(PStart); 114 | Inc(nb); 115 | if nb >= SafeRange then 116 | Break; 117 | end; 118 | if (Result <> stUnknown) then 119 | begin 120 | if Result = stPChar then 121 | nb := nb shr 1; 122 | if (MinLength > 0) and (nb < MinLength) then 123 | Result := stUnknown; 124 | if (MaxLength > 0) and (nb > MaxLength) then 125 | Result := stUnknown; 126 | end; 127 | except 128 | Result := stUnknown; 129 | end; 130 | end; 131 | 132 | function GetStrType(Address: Pointer; const MinLength: Integer = 0; const MaxLength: Integer = 0): TStrType; 133 | var 134 | P: PByte; 135 | LPStrRec: PStrRec; 136 | begin 137 | Result := stUnknown; 138 | try 139 | P := Address; 140 | LPStrRec := PStrRec(P - SizeOf(StrRec)); 141 | // Check if is null terminated string. 142 | case LPStrRec^.elemSize of 143 | SizeOf(WideChar): 144 | begin 145 | if (LPStrRec^.codePage = DefaultUnicodeCodePage) and (PWord(P + (LPStrRec^.length * SizeOf(WideChar)))^ = $00) then 146 | Result := stString; 147 | end; 148 | SizeOf(AnsiChar): 149 | begin 150 | if (LPStrRec^.codePage = DefaultSystemCodePage) and (PByte(P + (LPStrRec^.length * SizeOf(AnsiChar)))^ = $00) then 151 | Result := stAnsiString; 152 | end; 153 | end; 154 | if (Result = stUnknown) then 155 | Result := GetRawStrType(Address, MinLength, MaxLength); 156 | except 157 | Exit(stUnknown); 158 | end; 159 | end; 160 | 161 | function IsPtrClass(Ptr: Pointer): Boolean; 162 | var 163 | LClass: TClass; 164 | function GetLastClassParent(AClass: TClass): TClass; 165 | begin 166 | Result := AClass; 167 | try 168 | while True do 169 | begin 170 | if Result.ClassParent = nil then 171 | Exit; 172 | Result := Result.ClassParent; 173 | end; 174 | except 175 | Result := nil; 176 | end; 177 | end; 178 | function IsObjClass(AClass: TClass): Boolean; 179 | begin 180 | Result := (AClass.ClassInfo = TObject.ClassInfo) and (AClass.ClassNameIs(TObject.ClassName)); 181 | end; 182 | 183 | begin 184 | { We don't know if the pointer is a valid class 185 | Thus, we must handle any AV error and reject Ptr to be a class. } 186 | try 187 | LClass := GetLastClassParent(TClass(PPointer(Ptr)^)); 188 | Result := LClass <> nil; 189 | if Result then 190 | Result := IsObjClass(LClass); 191 | except 192 | Exit(False); 193 | end; 194 | end; 195 | 196 | end. 197 | -------------------------------------------------------------------------------- /Source/DebugEngine.PeUtils.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // Delphi DebugEngine. 3 | // Unit DebugEngine.PeUtils 4 | // https://github.com/MahdiSafsafi/DebugEngine 5 | 6 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 7 | // you may not use this file except in compliance with the License. You may obtain a copy of the 8 | // License at http://www.mozilla.org/MPL/ 9 | // 10 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 11 | // ANY KIND, either express or implied. See the License for the specific language governing rights 12 | // and limitations under the License. 13 | // 14 | // The Original Code is DebugEngine.PeUtils.pas. 15 | // 16 | // 17 | // The Initial Developer of the Original Code is Mahdi Safsafi. 18 | // Portions created by Mahdi Safsafi . are Copyright (C) 2016-2019 Mahdi Safsafi. 19 | // All Rights Reserved. 20 | // 21 | // ************************************************************************************************** 22 | 23 | unit DebugEngine.PeUtils; 24 | 25 | interface 26 | 27 | {$I DebugEngine.inc} 28 | 29 | uses 30 | WinApi.Windows, 31 | System.SysUtils; 32 | 33 | type 34 | TMachineType = (mtUnknown, mt32, mt64); 35 | 36 | function PeMapImageDosHeader(BaseAddress: Pointer): PImageDosHeader; 37 | function PeMapImageNtHeaders32(BaseAddress: PByte): PImageNtHeaders32; 38 | function PeMapImageNtHeaders64(BaseAddress: PByte): PImageNtHeaders64; 39 | function PeMapImageNtHeaders(BaseAddress: PByte): PImageNtHeaders; 40 | function PeMapImageFileHeader(NtHeadersX: Pointer): PImageFileHeader; 41 | function PeMapImageMachine(PFileHeader: PImageFileHeader): TMachineType; 42 | function PeMapImageSectionHeader(NtHeadersX: Pointer): PImageSectionHeader; 43 | function PeFindSection(NtHeadersX: Pointer; const Section: String): PImageSectionHeader; 44 | function FindDebugSection32(NtHeaders: PImageNtHeaders32): PImageSectionHeader; 45 | function FindDebugSection64(NtHeaders: PImageNtHeaders64): PImageSectionHeader; 46 | 47 | implementation 48 | 49 | function PeMapImageDosHeader(BaseAddress: Pointer): PImageDosHeader; 50 | begin 51 | Result := BaseAddress; 52 | end; 53 | 54 | function PeMapImageNtHeaders32(BaseAddress: PByte): PImageNtHeaders32; 55 | begin 56 | Result := Pointer(BaseAddress + PeMapImageDosHeader(BaseAddress)^._lfanew); 57 | if Result^.Signature <> IMAGE_NT_SIGNATURE then 58 | Result := nil; 59 | end; 60 | 61 | function PeMapImageNtHeaders64(BaseAddress: PByte): PImageNtHeaders64; 62 | begin 63 | Result := Pointer(BaseAddress + PeMapImageDosHeader(BaseAddress)^._lfanew); 64 | if Result^.Signature <> IMAGE_NT_SIGNATURE then 65 | Result := nil; 66 | end; 67 | 68 | function PeMapImageNtHeaders(BaseAddress: PByte): PImageNtHeaders; 69 | begin 70 | {$IFDEF CPUX86} 71 | Result := PeMapImageNtHeaders32(BaseAddress); 72 | {$ELSE !CPUX86} 73 | Result := PeMapImageNtHeaders64(BaseAddress); 74 | {$ENDIF CPUX86} 75 | end; 76 | 77 | function PeMapImageFileHeader(NtHeadersX: Pointer): PImageFileHeader; 78 | begin 79 | { NtHeadersX could be PImageNtHeaders32 or PImageNtHeaders64 ! 80 | In both case they share the same FileHeader location. } 81 | Result := @PImageNtHeaders32(NtHeadersX)^.FileHeader; 82 | end; 83 | 84 | function PeMapImageMachine(PFileHeader: PImageFileHeader): TMachineType; 85 | begin 86 | case PFileHeader^.Machine of 87 | IMAGE_FILE_MACHINE_I386: Exit(mt32); 88 | IMAGE_FILE_MACHINE_AMD64: Exit(mt64); 89 | else Result := mtUnknown; 90 | end; 91 | end; 92 | 93 | function PeMapImageSectionHeader(NtHeadersX: Pointer): PImageSectionHeader; 94 | begin 95 | Result := Pointer(PByte(@PImageNtHeaders(NtHeadersX)^.OptionalHeader) + PImageNtHeaders(NtHeadersX)^.FileHeader.SizeOfOptionalHeader); 96 | end; 97 | 98 | function PeFindSection(NtHeadersX: Pointer; const Section: String): PImageSectionHeader; 99 | var 100 | nSections: Integer; 101 | LSectionName: AnsiString; 102 | begin 103 | nSections := PImageNtHeaders32(NtHeadersX)^.FileHeader.NumberOfSections; 104 | Result := PeMapImageSectionHeader(NtHeadersX); 105 | while nSections > 0 do 106 | begin 107 | LSectionName := AnsiString(PAnsiChar(@Result^.Name[0])); 108 | if SameText(Section, String(LSectionName)) then 109 | Exit; 110 | Inc(Result); 111 | Dec(nSections); 112 | end; 113 | Result := nil; 114 | end; 115 | 116 | function FindDebugSection32(NtHeaders: PImageNtHeaders32): PImageSectionHeader; 117 | var 118 | I: Integer; 119 | VA: Cardinal; 120 | begin 121 | Result := PeMapImageSectionHeader(NtHeaders); 122 | VA := NtHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; 123 | for I := 1 to NtHeaders^.FileHeader.NumberOfSections do 124 | begin 125 | if Result^.VirtualAddress = VA then 126 | Exit; 127 | Inc(Result); 128 | end; 129 | Result := nil; 130 | end; 131 | 132 | function FindDebugSection64(NtHeaders: PImageNtHeaders64): PImageSectionHeader; 133 | var 134 | I: Integer; 135 | VA: Cardinal; 136 | begin 137 | Result := PeMapImageSectionHeader(NtHeaders); 138 | VA := NtHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; 139 | for I := 1 to NtHeaders^.FileHeader.NumberOfSections do 140 | begin 141 | if Result^.VirtualAddress = VA then 142 | Exit; 143 | Inc(Result); 144 | end; 145 | Result := nil; 146 | end; 147 | 148 | end. 149 | -------------------------------------------------------------------------------- /Source/DebugEngine.inc: -------------------------------------------------------------------------------- 1 | {$IF DEFINED (CPUX86)} 2 | {$IFNDEF CPU32BITS} 3 | {$DEFINE CPU32BITS} 4 | {$ENDIF !CPU32BITS} 5 | {$DEFINE STACK_BASED_EXCEPTIONS} 6 | {$ELSEIF DEFINED (CPUX64)} 7 | {$IFNDEF CPU64BITS} 8 | {$DEFINE CPU64BITS} 9 | {$ENDIF !CPU64BITS} 10 | {$DEFINE TABLE_BASED_EXCEPTIONS} 11 | {$ENDIF} -------------------------------------------------------------------------------- /Tools/Source/DD/DD.dpr: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // DD command line. 3 | // 4 | // https://github.com/MahdiSafsafi/DebugEngine 5 | 6 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 7 | // you may not use this file except in compliance with the License. You may obtain a copy of the 8 | // License at http://www.mozilla.org/MPL/ 9 | // 10 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 11 | // ANY KIND, either express or implied. See the License for the specific language governing rights 12 | // and limitations under the License. 13 | // 14 | // 15 | // 16 | // The Initial Developer of the Original Code is Mahdi Safsafi. 17 | // Portions created by Mahdi Safsafi . are Copyright (C) 2016-2019 Mahdi Safsafi. 18 | // All Rights Reserved. 19 | // 20 | // ************************************************************************************************** 21 | 22 | program DD; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | DebugEngine.Core in '..\..\..\Source\DebugEngine.Core.pas', 30 | DebugEngine.DebugInfo in '..\..\..\Source\DebugEngine.DebugInfo.pas', 31 | DebugEngine.DebugUtils in '..\..\..\Source\DebugEngine.DebugUtils.pas', 32 | DebugEngine.PeUtils in '..\..\..\Source\DebugEngine.PeUtils.pas'; 33 | 34 | procedure DoHelp; 35 | begin 36 | Writeln('-----------------------------------------------'); 37 | Writeln('DD command line tool.'); 38 | Writeln('https://github.com/MahdiSafsafi/DebugEngine'); 39 | Writeln('-----------------------------------------------'); 40 | 41 | Writeln('Usage: DD [Command][Options][AppFile,MapFile]'); 42 | Writeln('Command:'); 43 | Writeln('-h = Display help.'); 44 | Writeln('-c = Convert Delphi map to smap file format.'); 45 | Writeln('-i = Insert debug info (smap) into the target application.'); 46 | Writeln('-r = Remove Delphi debug info from the target application.'); 47 | Writeln('Options:'); 48 | Writeln('-p = Compress the smap file.'); 49 | Writeln('-s = If possible, insert debug info into a new section.'); 50 | Writeln('AppFile = Executable file.'); 51 | Writeln('MapFile = If the command is -c then this should be a Delphi map file. If the -i is used then it should be a SMAP file.'); 52 | 53 | Writeln(''); 54 | Writeln('Example:'); 55 | Writeln('Conver Delphi map to smap file:'); 56 | Writeln('DD -c -p "MyApp.map"'); 57 | Writeln('Inserting debug info:'); 58 | Writeln('DD -i "MyApp.exe" "MyApp.smap"'); 59 | end; 60 | 61 | const 62 | COMMAND_CONVERT = 1; 63 | COMMAND_DBG_INSERT = 2; 64 | COMMAND_DBG_REMOVE = 3; 65 | 66 | var 67 | I: Integer; 68 | Param: string; 69 | Options: TSMapOptions; 70 | Command: Integer; 71 | F1: string; 72 | F2: string; 73 | SectionFlavor: Boolean; 74 | 75 | begin 76 | Options := []; 77 | Command := 0; 78 | F1 := EmptyStr; 79 | F2 := EmptyStr; 80 | SectionFlavor := False; 81 | try 82 | for I := 1 to ParamCount do 83 | begin 84 | Param := ParamStr(I).Trim; 85 | if Param = '-h' then 86 | begin 87 | DoHelp; 88 | Exit; 89 | end; 90 | if Param = '-c' then 91 | begin 92 | Command := COMMAND_CONVERT; 93 | Continue; 94 | end; 95 | if Param = '-i' then 96 | begin 97 | Command := COMMAND_DBG_INSERT; 98 | Continue; 99 | end; 100 | if Param = '-r' then 101 | begin 102 | Command := COMMAND_DBG_REMOVE; 103 | Continue; 104 | end; 105 | if Param = '-p' then 106 | begin 107 | Options := [moCompress]; 108 | Continue; 109 | end; 110 | if Param = '-s' then 111 | begin 112 | SectionFlavor := True; 113 | Continue; 114 | end; 115 | if F1.IsEmpty then 116 | begin 117 | F1 := Param; 118 | Continue; 119 | end; 120 | if F2.IsEmpty then 121 | begin 122 | F2 := Param; 123 | Continue; 124 | end; 125 | end; 126 | 127 | if (Command > 0) and (not FileExists(F1)) then 128 | begin 129 | Writeln(Format('"%s does not exist."', [F1])); 130 | Exit; 131 | end; 132 | 133 | case Command of 134 | COMMAND_CONVERT: 135 | begin 136 | if ConvertMapToSMap(F1, Options) > 0 then 137 | Writeln('smap file generated successfully.') 138 | else 139 | Writeln('Failed to generate smap file.'); 140 | Exit; 141 | end; 142 | COMMAND_DBG_INSERT: 143 | begin 144 | if FileExists(F2) then 145 | begin 146 | if InsertDebugInfo(F1, F2, SectionFlavor) then 147 | Writeln('Debug info inserted successfully.') 148 | else 149 | Writeln('Failed to insert debug info.'); 150 | end 151 | else 152 | Writeln(Format('"%s does not exist."', [F2])); 153 | Exit; 154 | end; 155 | COMMAND_DBG_REMOVE: 156 | begin 157 | if RemoveDebugInfo(F1, nil) then 158 | Writeln('Delphi debug info removed successfully from app.') 159 | else 160 | Writeln('Failed to remove debug info.'); 161 | Exit; 162 | end 163 | else 164 | begin 165 | DoHelp; 166 | Exit; 167 | end; 168 | end; 169 | except 170 | on E: Exception do 171 | Writeln(E.ClassName, ': ', E.Message); 172 | end; 173 | 174 | end. 175 | -------------------------------------------------------------------------------- /Tools/Source/DD/DD.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Tools/Source/DD/DD.res -------------------------------------------------------------------------------- /Tools/bin/DD.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Tools/bin/DD.exe -------------------------------------------------------------------------------- /Tools/bin64/DD.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiSafsafi/DebugEngine/30ad5ede69d5c083ff396f88eec2b508d6bb2482/Tools/bin64/DD.exe --------------------------------------------------------------------------------