├── .gitignore ├── BeaEngine.c ├── CodMake.aps ├── CodMake.cpp ├── CodMake.h ├── CodMake.rc ├── CodMake.sln ├── CodMake.vcxproj ├── CodMake.vcxproj.filters ├── CodMake.vcxproj.user ├── CodMakeDlg.cpp ├── CodMakeDlg.h ├── Elib.h ├── Includes ├── BeaEngineVersion.c ├── Routines_Disasm.c ├── Routines_ModRM.c ├── instr_set │ ├── Data_opcode.h │ ├── opcodes_AES.c │ ├── opcodes_A_M.c │ ├── opcodes_CLMUL.c │ ├── opcodes_FPU.c │ ├── opcodes_Grp1.c │ ├── opcodes_Grp12.c │ ├── opcodes_Grp13.c │ ├── opcodes_Grp14.c │ ├── opcodes_Grp15.c │ ├── opcodes_Grp16.c │ ├── opcodes_Grp17.c │ ├── opcodes_Grp2.c │ ├── opcodes_Grp3.c │ ├── opcodes_Grp4.c │ ├── opcodes_Grp5.c │ ├── opcodes_Grp6.c │ ├── opcodes_Grp7.c │ ├── opcodes_Grp8.c │ ├── opcodes_Grp9.c │ ├── opcodes_MMX.c │ ├── opcodes_N_Z.c │ ├── opcodes_SSE.c │ └── opcodes_prefixes.c ├── internal_datas.h └── protos.h ├── LICENSE ├── README.md ├── ReadMe.txt ├── Resource.h ├── beaengine ├── basic_types.h ├── beaengine.h ├── export.h └── macros.h ├── res ├── CodMake.ico └── CodMake.rc2 ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── update.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | .vs/ 11 | Debug/ 12 | ipch/ 13 | Release/ 14 | *.esig 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | *.sdf 20 | 21 | # Compiled Dynamic libraries 22 | *.so 23 | *.dylib 24 | *.dll 25 | 26 | # Fortran module files 27 | *.mod 28 | *.smod 29 | 30 | # Compiled Static libraries 31 | *.lai 32 | *.la 33 | *.a 34 | *.lib 35 | 36 | # Executables 37 | *.exe 38 | *.out 39 | *.app 40 | *.db 41 | *.opendb 42 | -------------------------------------------------------------------------------- /BeaEngine.c: -------------------------------------------------------------------------------- 1 | /* 2 | * BeaEngine 4 - x86 & x86-64 disassembler library 3 | * 4 | * Copyright 2006-2010, BeatriX 5 | * File coded by BeatriX 6 | * 7 | * This file is part of BeaEngine. 8 | * 9 | * BeaEngine is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * BeaEngine is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with BeaEngine. If not, see . */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "beaengine/BeaEngine.h" 27 | #include "Includes/protos.h" 28 | #include "Includes/internal_datas.h" 29 | #include "Includes/instr_set/Data_opcode.h" 30 | #include "Includes/instr_set/opcodes_A_M.c" 31 | #include "Includes/instr_set/opcodes_N_Z.c" 32 | #include "Includes/instr_set/opcodes_Grp1.c" 33 | #include "Includes/instr_set/opcodes_Grp2.c" 34 | #include "Includes/instr_set/opcodes_Grp3.c" 35 | #include "Includes/instr_set/opcodes_Grp4.c" 36 | #include "Includes/instr_set/opcodes_Grp5.c" 37 | #include "Includes/instr_set/opcodes_Grp6.c" 38 | #include "Includes/instr_set/opcodes_Grp7.c" 39 | #include "Includes/instr_set/opcodes_Grp8.c" 40 | #include "Includes/instr_set/opcodes_Grp9.c" 41 | #include "Includes/instr_set/opcodes_Grp12.c" 42 | #include "Includes/instr_set/opcodes_Grp13.c" 43 | #include "Includes/instr_set/opcodes_Grp14.c" 44 | #include "Includes/instr_set/opcodes_Grp15.c" 45 | #include "Includes/instr_set/opcodes_Grp16.c" 46 | #include "Includes/instr_set/opcodes_Grp17.c" 47 | #include "Includes/instr_set/opcodes_FPU.c" 48 | #include "Includes/instr_set/opcodes_MMX.c" 49 | #include "Includes/instr_set/opcodes_SSE.c" 50 | #include "Includes/instr_set/opcodes_AES.c" 51 | #include "Includes/instr_set/opcodes_CLMUL.c" 52 | #include "Includes/instr_set/opcodes_prefixes.c" 53 | #include "Includes/Routines_ModRM.c" 54 | #include "Includes/Routines_Disasm.c" 55 | #include "Includes/BeaEngineVersion.c" 56 | 57 | void BeaEngine(void){return;} 58 | -------------------------------------------------------------------------------- /CodMake.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMake.aps -------------------------------------------------------------------------------- /CodMake.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMake.cpp -------------------------------------------------------------------------------- /CodMake.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMake.h -------------------------------------------------------------------------------- /CodMake.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMake.rc -------------------------------------------------------------------------------- /CodMake.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodMake", "CodMake.vcxproj", "{76307C52-E996-4B27-86EA-5A48F76E3D45}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {76307C52-E996-4B27-86EA-5A48F76E3D45}.Debug|x86.ActiveCfg = Debug|Win32 15 | {76307C52-E996-4B27-86EA-5A48F76E3D45}.Debug|x86.Build.0 = Debug|Win32 16 | {76307C52-E996-4B27-86EA-5A48F76E3D45}.Release|x86.ActiveCfg = Release|Win32 17 | {76307C52-E996-4B27-86EA-5A48F76E3D45}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /CodMake.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {76307C52-E996-4B27-86EA-5A48F76E3D45} 15 | CodMake 16 | MFCProj 17 | 18 | 19 | 20 | Application 21 | true 22 | v140 23 | Unicode 24 | Static 25 | 26 | 27 | Application 28 | false 29 | v140_xp 30 | true 31 | Unicode 32 | Static 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | NotUsing 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;BEA_ENGINE_STATIC;%(PreprocessorDefinitions) 56 | 57 | 58 | Windows 59 | true 60 | afxnmcdD.lib;uafxcwD.lib;LIBCMTD.lib 61 | 62 | 63 | 64 | 65 | false 66 | true 67 | _DEBUG;%(PreprocessorDefinitions) 68 | 69 | 70 | 0x0804 71 | _DEBUG;%(PreprocessorDefinitions) 72 | $(IntDir);%(AdditionalIncludeDirectories) 73 | 74 | 75 | 76 | 77 | Level3 78 | NotUsing 79 | MaxSpeed 80 | true 81 | false 82 | WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;BEA_ENGINE_STATIC;%(PreprocessorDefinitions) 83 | true 84 | 85 | 86 | Windows 87 | true 88 | true 89 | true 90 | afxnmcd.lib;uafxcw.lib;LIBCMT.lib 91 | 92 | 93 | 94 | 95 | false 96 | true 97 | NDEBUG;%(PreprocessorDefinitions) 98 | 99 | 100 | 0x0804 101 | NDEBUG;%(PreprocessorDefinitions) 102 | $(IntDir);%(AdditionalIncludeDirectories) 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Create 121 | Create 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /CodMake.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 头文件 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 38 | 39 | 源文件 40 | 41 | 42 | 源文件 43 | 44 | 45 | 源文件 46 | 47 | 48 | 源文件 49 | 50 | 51 | 52 | 53 | 资源文件 54 | 55 | 56 | 57 | 58 | 资源文件 59 | 60 | 61 | 62 | 63 | 资源文件 64 | 65 | 66 | -------------------------------------------------------------------------------- /CodMake.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CodMakeDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMakeDlg.cpp -------------------------------------------------------------------------------- /CodMakeDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/CodMakeDlg.h -------------------------------------------------------------------------------- /Elib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/Elib.h -------------------------------------------------------------------------------- /Includes/BeaEngineVersion.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2010, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | const__ char* __bea_callspec__ BeaEngineVersion(void) { 19 | return "5.0"; 20 | } 21 | const__ char* __bea_callspec__ BeaEngineRevision(void) { 22 | return "dev"; 23 | } 24 | -------------------------------------------------------------------------------- /Includes/instr_set/Data_opcode.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* =============================================================================== */ 20 | /* */ 21 | /* */ 22 | /* 1 BYTE OPCODE MAP */ 23 | /* */ 24 | /* */ 25 | /* =============================================================================== */ 26 | 27 | void (__bea_callspec__ * opcode_map1[])(PDISASM) = { 28 | add_EbGb , add_EvGv , add_GbEb , add_GvEv , add_ALIb , add_eAX_Iv, push_es , pop_es , or_EbGb , or_EvGv , or_GbEb , or_GvEv , or_ALIb , or_eAX_Iv , push_cs , Esc_2byte , 29 | adc_EbGb , adc_EvGv , adc_GbEb , adc_GvEv , adc_ALIb , adc_eAX_Iv, push_ss , pop_ss , sbb_EbGb , sbb_EvGv , sbb_GbEb , sbb_GvEv , sbb_ALIb , sbb_eAX_Iv, push_ds , pop_ds , 30 | and_EbGb , and_EvGv , and_GbEb , and_GvEv , and_ALIb , and_eAX_Iv, PrefSEGES , daa_ , sub_EbGb , sub_EvGv , sub_GbEb , sub_GvEv , sub_ALIb , sub_eAX_Iv, PrefSEGCS , das_ , 31 | xor_EbGb , xor_EvGv , xor_GbEb , xor_GvEv , xor_ALIb , xor_eAX_Iv, PrefSEGSS , aaa_ , cmp_EbGb , cmp_EvGv , cmp_GbEb , cmp_GvEv , cmp_ALIb , cmp_eAX_Iv, PrefSEGDS , aas_ , 32 | inc_eax , inc_ecx , inc_edx , inc_ebx , inc_esp , inc_ebp , inc_esi , inc_edi , dec_eax , dec_ecx , dec_edx , dec_ebx , dec_esp , dec_ebp , dec_esi , dec_edi , 33 | push_eax , push_ecx , push_edx , push_ebx , push_esp , push_ebp , push_esi , push_edi , pop_eax , pop_ecx , pop_edx , pop_ebx , pop_esp , pop_ebp , pop_esi , pop_edi , 34 | pushad_ , popad_ , bound_ , arpl_ , PrefSEGFS , PrefSEGGS , PrefOpSize, PrefAdSize, push_Iv ,imul_GvEvIv, push_Ib ,imul_GvEvIb, insb_ , ins_ , outsb_ , outsw_ , 35 | jo_ , jno_ , jc_ , jnc_ , je_ , jne_ , jbe_ , jnbe_ , js_ , jns_ , jp_ , jnp_ , jl_ , jnl_ , jle_ , jnle_ , 36 | G1_EbIb , G1_EvIv , G1_EbIb2 , G1_EvIb , test_EbGb , test_EvGv , xchg_EbGb , xchg_EvGv , mov_EbGb , mov_EvGv , mov_GbEb , mov_GvEv , mov_EwSreg, lea_GvM , mov_SregEw, pop_Ev , 37 | nop_ , xchg_ecx , xchg_edx , xchg_ebx , xchg_esp , xchg_ebp , xchg_esi , xchg_edi , cwde_ , cdq_ , callf_ , wait_ , pushfd_ , popfd_ , sahf_ , lahf_ , 38 | mov_ALOb , mov_eAXOv , mov_ObAL , mov_OveAX , movs_ , movsw_ , cmpsb_ , cmps_ , test_ALIb ,test_eAX_Iv, stos_ , stosw_ , lodsb_ , lodsw_ , scasb_ , scas_ , 39 | mov_ALIb , mov_CLIb , mov_DLIb , mov_BLIb , mov_AHIb , mov_CHIb , mov_DHIb , mov_BHIb , mov_EAX , mov_ECX , mov_EDX , mov_EBX , mov_ESP , mov_EBP , mov_ESI , mov_EDI , 40 | G2_EbIb , G2_EvIb , retn_ , ret_ , les_GvM , lds_GvM , mov_EbIb , mov_EvIv , enter_ , leave_ , retf_Iw , retf_ , int3_ , int_ , into_ , iret_ , 41 | G2_Eb1 , G2_Ev1 , G2_EbCL , G2_EvCL , aam_ , aad_ , salc_ , xlat_ , D8_ , D9_ , DA_ , DB_ , DC_ , DD_ , DE_ , DF_ , 42 | loopne_ , loope_ , loop_ , jecxz_ , in_ALIb , in_eAX_Ib , out_IbAL , out_Ib_eAX, call_ , jmp_near , jmp_far , jmp_short , in_ALDX , in_eAX , out_DXAL , out_DXeAX , 43 | PrefLock , int1_ , PrefREPNE , PrefREPE , hlt_ , cmc_ , G3_Eb , G3_Ev , clc_ , stc_ , cli_ , sti_ , cld_ , std_ , G4_Eb , G5_Ev , 44 | }; 45 | 46 | /* =============================================================================== */ 47 | /* */ 48 | /* */ 49 | /* 2 BYTES OPCODE MAP --> 0F xx */ 50 | /* */ 51 | /* */ 52 | /* =============================================================================== */ 53 | void (__bea_callspec__ *opcode_map2[])(PDISASM) = { 54 | G6_ , G7_ , lar_GvEw , lsl_GvEw , FailDecode, syscall_ , clts_ , sysret_ , invd_ , wbinvd_ , FailDecode, ud2_ , FailDecode, nop_Ev , femms_ , FailDecode, 55 | movups_VW , movups_WV , movlps_VM , movlps_MV , unpcklps_ , unpckhps_ , movhps_VM , movhps_MV , G16_ , hint_nop , bndcl_GvEv, bndcn_GvEv, hint_nop , hint_nop , hint_nop , nop_Ev , 56 | mov_RdCd , mov_RdDd , mov_CdRd , mov_DdRd , FailDecode, FailDecode, FailDecode, FailDecode, movaps_VW , movaps_WV , cvtpi2ps_ , movntps_ , cvttps2pi_, cvtps2pi_ , ucomiss_VW, comiss_VW , 57 | wrmsr_ , rdtsc_ , rdmsr_ , rdpmc_ , sysenter_ , sysexit_ , FailDecode, FailDecode,Esc_tableA4, FailDecode,Esc_tableA5, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 58 | cmovo_ , cmovno_ , cmovb_ , cmovnb_ , cmove_ , cmovne_ , cmovbe_ , cmovnbe_ , cmovs_ , cmovns_ , cmovp_ , cmovnp_ , cmovl_ , cmovnl_ , cmovle_ , cmovnle_ , 59 | movmskps_ , sqrtps_VW , rsqrtps_ , rcpps_ , andps_VW , andnps_VW , orps_VW , xorps_VW , addps_VW , mulps_VW , cvtps2pd_ , cvtdq2ps_ , subps_VW , minps_VW , divps_VW , maxps_VW , 60 | punpcklbw_, punpcklwd_, punpckldq_, packsswb_ , pcmpgtb_ , pcmpgtw_ , pcmpgtd_ , packuswb_ , punpckhbw_, punpckhwd_, punpckhdq_, packssdw_ ,punpcklqdq_,punpckhqdq_, movd_PE , movq_PQ , 61 | pshufw_ , G12_ , G13_ , G14_ , pcmpeqb_ , pcmpeqw_ , pcmpeqd_ , emms_ , vmread_ , vmwrite_ , FailDecode, FailDecode, haddpd_VW , hsubpd_VW , movd_EP , movq_QP , 62 | jo_near , jno_near , jc_near , jnc_near , je_near , jne_near , jbe_near , ja_near , js_near , jns_near , jp_near , jnp_near , jl_near , jnl_near , jle_near , jnle_near , 63 | seto_ , setno_ , setb_ , setnb_ , sete_ , setne_ , setbe_ , setnbe_ , sets_ , setns_ , setp_ , setnp_ , setnge_ , setge_ , setle_ , setnle_ , 64 | push_fs , pop_fs , cpuid_ , bt_EvGv ,shld_EvGvIb,shld_EvGvCL, FailDecode, FailDecode, push_gs , pop_gs , rsm_ , bts_EvGv ,shrd_EvGvIb,shrd_EvGvCL, G15_ , imul_GvEv , 65 | cmpx_EbGb , cmpx_EvGv , lss_Mp , btr_EvGv , lfs_Mp , lgs_Mp , movzx_GvEb, movzx_GvEw, popcnt_ , ud2_ , G8_EvIb , btc_EvGv , bsf_GvEv , bsr_GvEv , movsx_GvEb, movsx_GvEw, 66 | xadd_EbGb , xadd_EvGv , cmpps_VW , movnti_ , pinsrw_ , pextrw_ , shufps_ , G9_ , bswap_eax , bswap_ecx , bswap_edx , bswap_ebx , bswap_esp , bswap_ebp , bswap_esi , bswap_edi , 67 | addsubpd_ , psrlw_ , psrld_ , psrlq_ , paddq_ , pmullw_ , movq_WV , pmovmskb_ , psubusb_ , psubusw_ , pminub_ , pand_ , paddusb_ , paddusw_ , pmaxub_ , pandn_ , 68 | pavgb_ , psraw_ , psrad_ , pavgw_ , pmulhuw_ , pmulhw_ , cvtpd2dq_ , movntq_ , psubsb_ , psubsw_ , pminsw_ , por_ , paddsb_ , paddsw_ , pmaxsw_ , pxor_ , 69 | lddqu_ , psllw_ , pslld_ , psllq_ , pmuludq_ , pmaddwd_ , psadbw_ , maskmovq_ , psubb_ , psubw_ , psubd_ , psubq_ , paddb_ , paddw_ , paddd_ , FailDecode, 70 | }; 71 | 72 | /* =============================================================================== */ 73 | /* */ 74 | /* */ 75 | /* 3 BYTES OPCODE MAP --> 0F 38 xx */ 76 | /* */ 77 | /* */ 78 | /* =============================================================================== */ 79 | void (__bea_callspec__ *opcode_map3[])(PDISASM) = { 80 | pshufb_ , phaddw_ , phaddd_ , phaddsw_ , pmaddubsw_, phsubw_ , phsubd_ , phsubsw_ , psignb_ , psignw_ , psignd_ , pmulhrsw_ , FailDecode, FailDecode, FailDecode, FailDecode, 81 | pblendvb_ , FailDecode, FailDecode, FailDecode, blendvps_ , blendvpd_ , FailDecode, ptest_ , FailDecode, FailDecode, FailDecode, FailDecode, pabsb_ , pabsw_ , pabsd_ , FailDecode, 82 | pmovsxbw_ , pmovsxbd_ , pmovsxbq_ , pmovsxwd_ , pmovsxwq_ , pmovsxdq_ , FailDecode, FailDecode, pmuldq_ , pcmpeqq_ , movntdqa_ , packusdw_ , FailDecode, FailDecode, FailDecode, FailDecode, 83 | pmovzxbw_ , pmovzxbd_ , pmovzxbq_ , pmovzxwd_ , pmovzxwq_ , pmovzxdq_ , FailDecode, pcmpgtq_ , pminsb_ , pminsd_ , pminuw_ , pminud_ , pmaxsb_ , pmaxsd_ , pmaxuw_ , pmaxud_ , 84 | pmulld_ ,phminposuw_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 85 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 86 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 87 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 88 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 89 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 90 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 91 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 92 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 93 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aesimc , aesenc , aesenclast, aesdec , aesdeclast, 94 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 95 | crc32_GvEb, crc32_GvEv, andn_GyEy , G17_ , FailDecode, bzhi_GyEy , adcx_GyEy , bextr_GyEy, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 96 | }; 97 | 98 | /* =============================================================================== */ 99 | /* */ 100 | /* */ 101 | /* 3 BYTES OPCODE MAP --> 0F 3A xx */ 102 | /* */ 103 | /* */ 104 | /* =============================================================================== */ 105 | void (__bea_callspec__ *opcode_map4[])(PDISASM) = { 106 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, roundps_ , roundpd_ , roundss_ , roundsd_ , blendps_ , blendpd_ , pblendw_ , palignr_ , 107 | FailDecode, FailDecode, FailDecode, FailDecode, pextrb_ , pextrw2_ , pextrd_ , extractps_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 108 | pinsrb_ , insertps_ , pinsrd_ , FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 109 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 110 | dpps_ , dppd_ , mpsadbw_ , FailDecode, pclmulqdq_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 111 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 112 | pcmpestrm_, pcmpestri_, pcmpistrm_, pcmpistri_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 113 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 114 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 115 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 116 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 117 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 118 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 119 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aeskeygen , 120 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 121 | FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, 122 | }; 123 | 124 | 125 | void (__bea_callspec__ *ModRM_0[])(ARGTYPE*, PDISASM) = { 126 | Addr_EAX, 127 | Addr_ECX, 128 | Addr_EDX, 129 | Addr_EBX, 130 | Addr_SIB, 131 | Addr_disp32, 132 | Addr_ESI, 133 | Addr_EDI, 134 | }; 135 | 136 | void (__bea_callspec__ *ModRM_1[])(ARGTYPE*, PDISASM) = { 137 | Addr_EAX_disp8, 138 | Addr_ECX_disp8, 139 | Addr_EDX_disp8, 140 | Addr_EBX_disp8, 141 | Addr_SIB_disp8, 142 | Addr_EBP_disp8, 143 | Addr_ESI_disp8, 144 | Addr_EDI_disp8, 145 | }; 146 | 147 | void (__bea_callspec__ *ModRM_2[])(ARGTYPE*, PDISASM) = { 148 | Addr_EAX_disp32, 149 | Addr_ECX_disp32, 150 | Addr_EDX_disp32, 151 | Addr_EBX_disp32, 152 | Addr_SIB_disp32, 153 | Addr_EBP_disp32, 154 | Addr_ESI_disp32, 155 | Addr_EDI_disp32, 156 | }; 157 | 158 | void (__bea_callspec__ *ModRM_3[])(ARGTYPE*, PDISASM) = { 159 | _rEAX, 160 | _rECX, 161 | _rEDX, 162 | _rEBX, 163 | _rESP, 164 | _rEBP, 165 | _rESI, 166 | _rEDI, 167 | }; 168 | 169 | size_t (__bea_callspec__ *SIB[])(ARGTYPE*, size_t, PDISASM) = { 170 | SIB_0, 171 | SIB_1, 172 | SIB_2, 173 | SIB_3, 174 | }; 175 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_AES.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 38 db 21 | * ==================================================================== */ 22 | void __bea_callspec__ aesimc(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | if (GV.VEX.state == InUsePrefix) { 27 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 28 | #ifndef BEA_LIGHT_DISASSEMBLY 29 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesimc "); 30 | #endif 31 | 32 | GV.SSE_ = 1; 33 | GxEx(pMyDisasm); 34 | GV.MemDecoration = Arg2_m128i_xmm; 35 | GV.SSE_ = 0; 36 | } 37 | else { 38 | GV.OperandSize = GV.OriginalOperandSize; 39 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 40 | GV.MemDecoration = Arg2_m128i_xmm; 41 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 42 | #ifndef BEA_LIGHT_DISASSEMBLY 43 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesimc "); 44 | #endif 45 | GV.SSE_ = 1; 46 | GxEx(pMyDisasm); 47 | GV.SSE_ = 0; 48 | (*pMyDisasm).Argument2.ArgSize = 128; 49 | } 50 | } 51 | else { 52 | FailDecode(pMyDisasm); 53 | } 54 | } 55 | 56 | /* ==================================================================== 57 | * 0x 0f 38 dc 58 | * ==================================================================== */ 59 | void __bea_callspec__ aesenc(PDISASM pMyDisasm) 60 | { 61 | /* ========== 0x66 */ 62 | if (GV.OperandSize == 16) { 63 | 64 | if (GV.VEX.state == InUsePrefix) { 65 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 66 | #ifndef BEA_LIGHT_DISASSEMBLY 67 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesenc "); 68 | #endif 69 | 70 | GV.SSE_ = 1; 71 | GyEy(pMyDisasm); 72 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); 73 | GV.MemDecoration = Arg3_m128i_xmm; 74 | GV.SSE_ = 0; 75 | 76 | } 77 | else { 78 | GV.OperandSize = GV.OriginalOperandSize; 79 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 80 | GV.MemDecoration = Arg2_m128i_xmm; 81 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 82 | #ifndef BEA_LIGHT_DISASSEMBLY 83 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenc "); 84 | #endif 85 | GV.SSE_ = 1; 86 | GxEx(pMyDisasm); 87 | GV.SSE_ = 0; 88 | } 89 | } 90 | else { 91 | FailDecode(pMyDisasm); 92 | } 93 | } 94 | 95 | /* ==================================================================== 96 | * 0x 0f 38 dd 97 | * ==================================================================== */ 98 | void __bea_callspec__ aesenclast(PDISASM pMyDisasm) 99 | { 100 | /* ========== 0x66 */ 101 | if (GV.OperandSize == 16) { 102 | if (GV.VEX.state == InUsePrefix) { 103 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 104 | #ifndef BEA_LIGHT_DISASSEMBLY 105 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesenclast "); 106 | #endif 107 | 108 | GV.SSE_ = 1; 109 | GyEy(pMyDisasm); 110 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); 111 | GV.MemDecoration = Arg3_m128i_xmm; 112 | GV.SSE_ = 0; 113 | 114 | } 115 | else { 116 | GV.OperandSize = GV.OriginalOperandSize; 117 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 118 | GV.MemDecoration = Arg2_m128i_xmm; 119 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 120 | #ifndef BEA_LIGHT_DISASSEMBLY 121 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenclast "); 122 | #endif 123 | GV.SSE_ = 1; 124 | GxEx(pMyDisasm); 125 | GV.SSE_ = 0; 126 | } 127 | } 128 | else { 129 | FailDecode(pMyDisasm); 130 | } 131 | } 132 | 133 | /* ==================================================================== 134 | * 0x 0f 38 de 135 | * ==================================================================== */ 136 | void __bea_callspec__ aesdec(PDISASM pMyDisasm) 137 | { 138 | /* ========== 0x66 */ 139 | if (GV.OperandSize == 16) { 140 | if (GV.VEX.state == InUsePrefix) { 141 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 142 | #ifndef BEA_LIGHT_DISASSEMBLY 143 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesdec "); 144 | #endif 145 | 146 | GV.SSE_ = 1; 147 | GyEy(pMyDisasm); 148 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); 149 | GV.MemDecoration = Arg3_m128i_xmm; 150 | GV.SSE_ = 0; 151 | 152 | } 153 | else { 154 | GV.OperandSize = GV.OriginalOperandSize; 155 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 156 | GV.MemDecoration = Arg2_m128i_xmm; 157 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 158 | #ifndef BEA_LIGHT_DISASSEMBLY 159 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdec "); 160 | #endif 161 | GV.SSE_ = 1; 162 | GxEx(pMyDisasm); 163 | GV.SSE_ = 0; 164 | } 165 | } 166 | else { 167 | FailDecode(pMyDisasm); 168 | } 169 | } 170 | 171 | /* ==================================================================== 172 | * 0x 0f 38 df 173 | * ==================================================================== */ 174 | void __bea_callspec__ aesdeclast(PDISASM pMyDisasm) 175 | { 176 | /* ========== 0x66 */ 177 | if (GV.OperandSize == 16) { 178 | if (GV.VEX.state == InUsePrefix) { 179 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 180 | #ifndef BEA_LIGHT_DISASSEMBLY 181 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesdeclast "); 182 | #endif 183 | 184 | GV.SSE_ = 1; 185 | GyEy(pMyDisasm); 186 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); 187 | GV.MemDecoration = Arg3_m128i_xmm; 188 | GV.SSE_ = 0; 189 | 190 | } 191 | else { 192 | GV.OperandSize = GV.OriginalOperandSize; 193 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 194 | GV.MemDecoration = Arg2_m128i_xmm; 195 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 196 | #ifndef BEA_LIGHT_DISASSEMBLY 197 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdeclast "); 198 | #endif 199 | GV.SSE_ = 1; 200 | GxEx(pMyDisasm); 201 | GV.SSE_ = 0; 202 | } 203 | } 204 | else { 205 | FailDecode(pMyDisasm); 206 | } 207 | } 208 | 209 | /* ==================================================================== 210 | * 0x 0f 3a df 211 | * ==================================================================== */ 212 | void __bea_callspec__ aeskeygen(PDISASM pMyDisasm) 213 | { 214 | /* ========== 0x66 */ 215 | if (GV.OperandSize == 16) { 216 | if (GV.VEX.state == InUsePrefix) { 217 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; 218 | #ifndef BEA_LIGHT_DISASSEMBLY 219 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaeskeygenassist "); 220 | #endif 221 | 222 | GV.SSE_ = 1; 223 | GxEx(pMyDisasm); 224 | /*fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm);*/ 225 | GV.MemDecoration = Arg2_m128i_xmm; 226 | GV.SSE_ = 0; 227 | GV.ImmediatSize = 8; 228 | GV.EIP_++; 229 | if (!Security(0, pMyDisasm)) return; 230 | GV.third_arg = 1; 231 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 232 | #ifndef BEA_LIGHT_DISASSEMBLY 233 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 234 | #endif 235 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 236 | (*pMyDisasm).Argument3.ArgSize = 8; 237 | } 238 | else { 239 | GV.OperandSize = GV.OriginalOperandSize; 240 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 241 | GV.MemDecoration = Arg2_m128i_xmm; 242 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 243 | #ifndef BEA_LIGHT_DISASSEMBLY 244 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aeskeygenassist "); 245 | #endif 246 | GV.ImmediatSize = 8; 247 | GV.SSE_ = 1; 248 | GxEx(pMyDisasm); 249 | GV.SSE_ = 0; 250 | GV.EIP_++; 251 | if (!Security(0, pMyDisasm)) return; 252 | GV.third_arg = 1; 253 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 254 | #ifndef BEA_LIGHT_DISASSEMBLY 255 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 256 | #endif 257 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 258 | (*pMyDisasm).Argument3.ArgSize = 8; 259 | } 260 | 261 | } 262 | else { 263 | FailDecode(pMyDisasm); 264 | } 265 | 266 | } 267 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_CLMUL.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 3a 44 21 | * ==================================================================== */ 22 | void __bea_callspec__ pclmulqdq_(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 27 | GV.MemDecoration = Arg2dqword; 28 | (*pMyDisasm).Instruction.Category = CLMUL_INSTRUCTION; 29 | 30 | GV.ImmediatSize = 8; 31 | GV.SSE_ = 1; 32 | GxEx(pMyDisasm); 33 | GV.SSE_ = 0; 34 | GV.EIP_++; 35 | if (!Security(0, pMyDisasm)) return; 36 | 37 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 38 | 39 | if ((*pMyDisasm).Instruction.Immediat == 0) { 40 | #ifndef BEA_LIGHT_DISASSEMBLY 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqlqdq "); 42 | #endif 43 | } 44 | else if ((*pMyDisasm).Instruction.Immediat == 0x01 ) { 45 | #ifndef BEA_LIGHT_DISASSEMBLY 46 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqlqdq "); 47 | #endif 48 | } 49 | else if ((*pMyDisasm).Instruction.Immediat == 0x10 ) { 50 | #ifndef BEA_LIGHT_DISASSEMBLY 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqhqdq "); 52 | #endif 53 | } 54 | else if ((*pMyDisasm).Instruction.Immediat == 0x011 ) { 55 | #ifndef BEA_LIGHT_DISASSEMBLY 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqhqdq "); 57 | #endif 58 | } 59 | else { 60 | #ifndef BEA_LIGHT_DISASSEMBLY 61 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulqdq "); 62 | #endif 63 | GV.third_arg = 1; 64 | #ifndef BEA_LIGHT_DISASSEMBLY 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 66 | #endif 67 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument3.ArgSize = 8; 69 | } 70 | } 71 | else { 72 | FailDecode(pMyDisasm); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp1.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 80h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G1_EbIb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | EbIb(pMyDisasm); 26 | if (GV.REGOPCODE == 0) { 27 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 28 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 29 | } 30 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 31 | #ifndef BEA_LIGHT_DISASSEMBLY 32 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); 33 | #endif 34 | FillFlags(pMyDisasm, 5); 35 | } 36 | else if (GV.REGOPCODE == 1) { 37 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 38 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 39 | } 40 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 41 | #ifndef BEA_LIGHT_DISASSEMBLY 42 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); 43 | #endif 44 | FillFlags(pMyDisasm, 74); 45 | } 46 | else if (GV.REGOPCODE == 2) { 47 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 48 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 49 | } 50 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 51 | #ifndef BEA_LIGHT_DISASSEMBLY 52 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); 53 | #endif 54 | FillFlags(pMyDisasm, 4); 55 | } 56 | else if (GV.REGOPCODE == 3) { 57 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 58 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 59 | } 60 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 61 | #ifndef BEA_LIGHT_DISASSEMBLY 62 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); 63 | #endif 64 | FillFlags(pMyDisasm, 93); 65 | } 66 | else if (GV.REGOPCODE == 4) { 67 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 68 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 69 | } 70 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 71 | #ifndef BEA_LIGHT_DISASSEMBLY 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); 73 | #endif 74 | FillFlags(pMyDisasm, 6); 75 | } 76 | else if (GV.REGOPCODE == 5) { 77 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 78 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 79 | } 80 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 81 | #ifndef BEA_LIGHT_DISASSEMBLY 82 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); 83 | #endif 84 | FillFlags(pMyDisasm, 103); 85 | } 86 | 87 | else if (GV.REGOPCODE == 6) { 88 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 89 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 90 | } 91 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 92 | #ifndef BEA_LIGHT_DISASSEMBLY 93 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); 94 | #endif 95 | FillFlags(pMyDisasm, 113); 96 | } 97 | 98 | else if (GV.REGOPCODE == 7) { 99 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 100 | #ifndef BEA_LIGHT_DISASSEMBLY 101 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); 102 | #endif 103 | FillFlags(pMyDisasm, 20); 104 | (*pMyDisasm).Argument1.AccessMode = READ; 105 | } 106 | } 107 | 108 | /* ==================================================================== 109 | * 82h 110 | * ==================================================================== */ 111 | void __bea_callspec__ G1_EbIb2(PDISASM pMyDisasm) 112 | { 113 | if (GV.Architecture == 64) { 114 | FailDecode(pMyDisasm); 115 | } 116 | else { 117 | G1_EbIb(pMyDisasm); 118 | } 119 | } 120 | 121 | /* ==================================================================== 122 | * 81h 123 | * ==================================================================== */ 124 | void __bea_callspec__ G1_EvIv(PDISASM pMyDisasm) 125 | { 126 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 127 | EvIv(pMyDisasm); 128 | if (GV.REGOPCODE == 0) { 129 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 130 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 131 | } 132 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 133 | #ifndef BEA_LIGHT_DISASSEMBLY 134 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); 135 | #endif 136 | FillFlags(pMyDisasm, 5); 137 | } 138 | else if (GV.REGOPCODE == 1) { 139 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 140 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 141 | } 142 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 143 | #ifndef BEA_LIGHT_DISASSEMBLY 144 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); 145 | #endif 146 | FillFlags(pMyDisasm, 74); 147 | } 148 | else if (GV.REGOPCODE == 2) { 149 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 150 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 151 | } 152 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 153 | #ifndef BEA_LIGHT_DISASSEMBLY 154 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); 155 | #endif 156 | FillFlags(pMyDisasm, 4); 157 | } 158 | else if (GV.REGOPCODE == 3) { 159 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 160 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 161 | } 162 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 163 | #ifndef BEA_LIGHT_DISASSEMBLY 164 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); 165 | #endif 166 | FillFlags(pMyDisasm, 93); 167 | } 168 | else if (GV.REGOPCODE == 4) { 169 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 170 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 171 | } 172 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 173 | #ifndef BEA_LIGHT_DISASSEMBLY 174 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); 175 | #endif 176 | FillFlags(pMyDisasm, 6); 177 | } 178 | else if (GV.REGOPCODE == 5) { 179 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 180 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 181 | } 182 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 183 | #ifndef BEA_LIGHT_DISASSEMBLY 184 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); 185 | #endif 186 | FillFlags(pMyDisasm, 103); 187 | } 188 | 189 | else if (GV.REGOPCODE == 6) { 190 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 191 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 192 | } 193 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 194 | #ifndef BEA_LIGHT_DISASSEMBLY 195 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); 196 | #endif 197 | FillFlags(pMyDisasm, 113); 198 | } 199 | 200 | else if (GV.REGOPCODE == 7) { 201 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 202 | #ifndef BEA_LIGHT_DISASSEMBLY 203 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); 204 | #endif 205 | FillFlags(pMyDisasm, 20); 206 | (*pMyDisasm).Argument1.AccessMode = READ; 207 | } 208 | } 209 | 210 | /* ==================================================================== 211 | * 83h 212 | * ==================================================================== */ 213 | void __bea_callspec__ G1_EvIb(PDISASM pMyDisasm) 214 | { 215 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 216 | EvIb(pMyDisasm); 217 | if (GV.REGOPCODE == 0) { 218 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 219 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 220 | } 221 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 222 | #ifndef BEA_LIGHT_DISASSEMBLY 223 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); 224 | #endif 225 | FillFlags(pMyDisasm, 5); 226 | } 227 | else if (GV.REGOPCODE == 1) { 228 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 229 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 230 | } 231 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 232 | #ifndef BEA_LIGHT_DISASSEMBLY 233 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); 234 | #endif 235 | FillFlags(pMyDisasm, 74); 236 | } 237 | else if (GV.REGOPCODE == 2) { 238 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 239 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 240 | } 241 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 242 | #ifndef BEA_LIGHT_DISASSEMBLY 243 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); 244 | #endif 245 | FillFlags(pMyDisasm, 4); 246 | } 247 | else if (GV.REGOPCODE == 3) { 248 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 249 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 250 | } 251 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 252 | #ifndef BEA_LIGHT_DISASSEMBLY 253 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); 254 | #endif 255 | FillFlags(pMyDisasm, 93); 256 | } 257 | else if (GV.REGOPCODE == 4) { 258 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 259 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 260 | } 261 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 262 | #ifndef BEA_LIGHT_DISASSEMBLY 263 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); 264 | #endif 265 | FillFlags(pMyDisasm, 6); 266 | } 267 | else if (GV.REGOPCODE == 5) { 268 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 269 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 270 | } 271 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 272 | #ifndef BEA_LIGHT_DISASSEMBLY 273 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); 274 | #endif 275 | FillFlags(pMyDisasm, 103); 276 | } 277 | 278 | else if (GV.REGOPCODE == 6) { 279 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 280 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 281 | } 282 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 283 | #ifndef BEA_LIGHT_DISASSEMBLY 284 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); 285 | #endif 286 | FillFlags(pMyDisasm, 113); 287 | } 288 | 289 | else if (GV.REGOPCODE == 7) { 290 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 291 | #ifndef BEA_LIGHT_DISASSEMBLY 292 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); 293 | #endif 294 | FillFlags(pMyDisasm, 20); 295 | (*pMyDisasm).Argument1.AccessMode = READ; 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp12.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G12_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.ImmediatSize = 8; 32 | GV.SSE_ = 1; 33 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 34 | GV.SSE_ = 0; 35 | if (GV.MOD_== 0x3) { 36 | #ifndef BEA_LIGHT_DISASSEMBLY 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 38 | #endif 39 | } 40 | else { 41 | FailDecode(pMyDisasm); 42 | } 43 | GV.EIP_ += GV.DECALAGE_EIP+3; 44 | if (!Security(0, pMyDisasm)) return; 45 | 46 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 47 | #ifndef BEA_LIGHT_DISASSEMBLY 48 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 49 | #endif 50 | (*pMyDisasm).Instruction.Immediat = MyNumber; 51 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 52 | (*pMyDisasm).Argument2.ArgSize = 8; 53 | } 54 | else { 55 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 56 | GV.MemDecoration = Arg1qword; 57 | GV.ImmediatSize = 8; 58 | GV.MMX_ = 1; 59 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 60 | GV.MMX_ = 0; 61 | if (GV.MOD_== 0x3) { 62 | #ifndef BEA_LIGHT_DISASSEMBLY 63 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 64 | #endif 65 | } 66 | else { 67 | FailDecode(pMyDisasm); 68 | } 69 | GV.EIP_ += GV.DECALAGE_EIP+3; 70 | if (!Security(0, pMyDisasm)) return; 71 | 72 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 73 | #ifndef BEA_LIGHT_DISASSEMBLY 74 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 75 | #endif 76 | (*pMyDisasm).Instruction.Immediat = MyNumber; 77 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 78 | (*pMyDisasm).Argument2.ArgSize = 8; 79 | } 80 | } 81 | else if (GV.REGOPCODE == 4) { 82 | if (GV.OperandSize == 16) { 83 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 84 | GV.MemDecoration = Arg1dqword; 85 | GV.ImmediatSize = 8; 86 | GV.SSE_ = 1; 87 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 88 | GV.SSE_ = 0; 89 | if (GV.MOD_== 0x3) { 90 | #ifndef BEA_LIGHT_DISASSEMBLY 91 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 92 | #endif 93 | } 94 | else { 95 | FailDecode(pMyDisasm); 96 | } 97 | GV.EIP_ += GV.DECALAGE_EIP+3; 98 | if (!Security(0, pMyDisasm)) return; 99 | 100 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 101 | #ifndef BEA_LIGHT_DISASSEMBLY 102 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 103 | #endif 104 | (*pMyDisasm).Instruction.Immediat = MyNumber; 105 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 106 | (*pMyDisasm).Argument2.ArgSize = 8; 107 | } 108 | else { 109 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 110 | GV.MemDecoration = Arg1qword; 111 | GV.ImmediatSize = 8; 112 | GV.MMX_ = 1; 113 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 114 | GV.MMX_ = 0; 115 | if (GV.MOD_== 0x3) { 116 | #ifndef BEA_LIGHT_DISASSEMBLY 117 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 118 | #endif 119 | } 120 | else { 121 | FailDecode(pMyDisasm); 122 | } 123 | GV.EIP_ += GV.DECALAGE_EIP+3; 124 | if (!Security(0, pMyDisasm)) return; 125 | 126 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 127 | #ifndef BEA_LIGHT_DISASSEMBLY 128 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 129 | #endif 130 | (*pMyDisasm).Instruction.Immediat = MyNumber; 131 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 132 | (*pMyDisasm).Argument2.ArgSize = 8; 133 | } 134 | 135 | } 136 | else if (GV.REGOPCODE == 6) { 137 | if (GV.OperandSize == 16) { 138 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 139 | GV.MemDecoration = Arg1dqword; 140 | GV.ImmediatSize = 8; 141 | GV.SSE_ = 1; 142 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 143 | GV.SSE_ = 0; 144 | if (GV.MOD_== 0x3) { 145 | #ifndef BEA_LIGHT_DISASSEMBLY 146 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 147 | #endif 148 | } 149 | else { 150 | FailDecode(pMyDisasm); 151 | } 152 | GV.EIP_ += GV.DECALAGE_EIP+3; 153 | if (!Security(0, pMyDisasm)) return; 154 | 155 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 156 | #ifndef BEA_LIGHT_DISASSEMBLY 157 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 158 | #endif 159 | (*pMyDisasm).Instruction.Immediat = MyNumber; 160 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 161 | (*pMyDisasm).Argument2.ArgSize = 8; 162 | } 163 | else { 164 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 165 | GV.MemDecoration = Arg1qword; 166 | GV.ImmediatSize = 8; 167 | GV.MMX_ = 1; 168 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 169 | GV.MMX_ = 0; 170 | if (GV.MOD_== 0x3) { 171 | #ifndef BEA_LIGHT_DISASSEMBLY 172 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 173 | #endif 174 | } 175 | else { 176 | FailDecode(pMyDisasm); 177 | } 178 | GV.EIP_ += GV.DECALAGE_EIP+3; 179 | if (!Security(0, pMyDisasm)) return; 180 | 181 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 182 | #ifndef BEA_LIGHT_DISASSEMBLY 183 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 184 | #endif 185 | (*pMyDisasm).Instruction.Immediat = MyNumber; 186 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 187 | (*pMyDisasm).Argument2.ArgSize = 8; 188 | } 189 | } 190 | 191 | else { 192 | FailDecode(pMyDisasm); 193 | } 194 | 195 | } 196 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp13.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G13_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.ImmediatSize = 8; 32 | GV.SSE_ = 1; 33 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 34 | GV.SSE_ = 0; 35 | if (GV.MOD_== 0x3) { 36 | #ifndef BEA_LIGHT_DISASSEMBLY 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 38 | #endif 39 | } 40 | else { 41 | FailDecode(pMyDisasm); 42 | } 43 | GV.EIP_ += GV.DECALAGE_EIP+3; 44 | if (!Security(0, pMyDisasm)) return; 45 | 46 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 47 | #ifndef BEA_LIGHT_DISASSEMBLY 48 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 49 | #endif 50 | (*pMyDisasm).Instruction.Immediat = MyNumber; 51 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 52 | (*pMyDisasm).Argument2.ArgSize = 8; 53 | } 54 | else { 55 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 56 | GV.MemDecoration = Arg1qword; 57 | GV.ImmediatSize = 8; 58 | GV.MMX_ = 1; 59 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 60 | GV.MMX_ = 0; 61 | if (GV.MOD_== 0x3) { 62 | #ifndef BEA_LIGHT_DISASSEMBLY 63 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 64 | #endif 65 | } 66 | else { 67 | FailDecode(pMyDisasm); 68 | } 69 | GV.EIP_ += GV.DECALAGE_EIP+3; 70 | if (!Security(0, pMyDisasm)) return; 71 | 72 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 73 | #ifndef BEA_LIGHT_DISASSEMBLY 74 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 75 | #endif 76 | (*pMyDisasm).Instruction.Immediat = MyNumber; 77 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 78 | (*pMyDisasm).Argument2.ArgSize = 8; 79 | } 80 | } 81 | else if (GV.REGOPCODE == 4) { 82 | if (GV.OperandSize == 16) { 83 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 84 | GV.MemDecoration = Arg1dqword; 85 | GV.ImmediatSize = 8; 86 | GV.SSE_ = 1; 87 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 88 | GV.SSE_ = 0; 89 | if (GV.MOD_== 0x3) { 90 | #ifndef BEA_LIGHT_DISASSEMBLY 91 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 92 | #endif 93 | } 94 | else { 95 | FailDecode(pMyDisasm); 96 | } 97 | GV.EIP_ += GV.DECALAGE_EIP+3; 98 | if (!Security(0, pMyDisasm)) return; 99 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 100 | #ifndef BEA_LIGHT_DISASSEMBLY 101 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 102 | #endif 103 | (*pMyDisasm).Instruction.Immediat = MyNumber; 104 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 105 | (*pMyDisasm).Argument2.ArgSize = 8; 106 | } 107 | else { 108 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 109 | GV.MemDecoration = Arg1qword; 110 | GV.ImmediatSize = 8; 111 | GV.MMX_ = 1; 112 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 113 | GV.MMX_ = 0; 114 | if (GV.MOD_== 0x3) { 115 | #ifndef BEA_LIGHT_DISASSEMBLY 116 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 117 | #endif 118 | } 119 | else { 120 | FailDecode(pMyDisasm); 121 | } 122 | GV.EIP_ += GV.DECALAGE_EIP+3; 123 | if (!Security(0, pMyDisasm)) return; 124 | 125 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 126 | #ifndef BEA_LIGHT_DISASSEMBLY 127 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 128 | #endif 129 | (*pMyDisasm).Instruction.Immediat = MyNumber; 130 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 131 | (*pMyDisasm).Argument2.ArgSize = 8; 132 | } 133 | 134 | } 135 | else if (GV.REGOPCODE == 6) { 136 | if (GV.OperandSize == 16) { 137 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 138 | GV.MemDecoration = Arg1dqword; 139 | GV.ImmediatSize = 8; 140 | GV.SSE_ = 1; 141 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 142 | GV.SSE_ = 0; 143 | if (GV.MOD_== 0x3) { 144 | #ifndef BEA_LIGHT_DISASSEMBLY 145 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 146 | #endif 147 | } 148 | else { 149 | FailDecode(pMyDisasm); 150 | } 151 | GV.EIP_ += GV.DECALAGE_EIP+3; 152 | if (!Security(0, pMyDisasm)) return; 153 | 154 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 155 | #ifndef BEA_LIGHT_DISASSEMBLY 156 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 157 | #endif 158 | (*pMyDisasm).Instruction.Immediat = MyNumber; 159 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 160 | (*pMyDisasm).Argument2.ArgSize = 8; 161 | } 162 | else { 163 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 164 | GV.MemDecoration = Arg1qword; 165 | GV.ImmediatSize = 8; 166 | GV.MMX_ = 1; 167 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 168 | GV.MMX_ = 0; 169 | if (GV.MOD_== 0x3) { 170 | #ifndef BEA_LIGHT_DISASSEMBLY 171 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 172 | #endif 173 | } 174 | else { 175 | FailDecode(pMyDisasm); 176 | } 177 | GV.EIP_ += GV.DECALAGE_EIP+3; 178 | if (!Security(0, pMyDisasm)) return; 179 | 180 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 181 | #ifndef BEA_LIGHT_DISASSEMBLY 182 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 183 | #endif 184 | (*pMyDisasm).Instruction.Immediat = MyNumber; 185 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 186 | (*pMyDisasm).Argument2.ArgSize = 8; 187 | } 188 | } 189 | 190 | else { 191 | FailDecode(pMyDisasm); 192 | } 193 | 194 | } 195 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp14.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G14_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.ImmediatSize = 8; 32 | GV.SSE_ = 1; 33 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 34 | GV.SSE_ = 0; 35 | if (GV.MOD_== 0x3) { 36 | #ifndef BEA_LIGHT_DISASSEMBLY 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 38 | #endif 39 | } 40 | else { 41 | FailDecode(pMyDisasm); 42 | } 43 | GV.EIP_ += GV.DECALAGE_EIP+3; 44 | if (!Security(0, pMyDisasm)) return; 45 | 46 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 47 | #ifndef BEA_LIGHT_DISASSEMBLY 48 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 49 | #endif 50 | (*pMyDisasm).Instruction.Immediat = MyNumber; 51 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 52 | (*pMyDisasm).Argument2.ArgSize = 8; 53 | } 54 | else { 55 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 56 | GV.MemDecoration = Arg1qword; 57 | GV.ImmediatSize = 8; 58 | GV.MMX_ = 1; 59 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 60 | GV.MMX_ = 0; 61 | if (GV.MOD_== 0x3) { 62 | #ifndef BEA_LIGHT_DISASSEMBLY 63 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 64 | #endif 65 | } 66 | else { 67 | FailDecode(pMyDisasm); 68 | } 69 | GV.EIP_ += GV.DECALAGE_EIP+3; 70 | if (!Security(0, pMyDisasm)) return; 71 | 72 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 73 | #ifndef BEA_LIGHT_DISASSEMBLY 74 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 75 | #endif 76 | (*pMyDisasm).Instruction.Immediat = MyNumber; 77 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 78 | (*pMyDisasm).Argument2.ArgSize = 8; 79 | } 80 | } 81 | else if (GV.REGOPCODE == 3) { 82 | if (GV.OperandSize == 16) { 83 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 84 | GV.MemDecoration = Arg1dqword; 85 | GV.ImmediatSize = 8; 86 | GV.SSE_ = 1; 87 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 88 | GV.SSE_ = 0; 89 | if (GV.MOD_== 0x3) { 90 | #ifndef BEA_LIGHT_DISASSEMBLY 91 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrldq "); 92 | #endif 93 | } 94 | else { 95 | FailDecode(pMyDisasm); 96 | } 97 | GV.EIP_ += GV.DECALAGE_EIP+3; 98 | if (!Security(0, pMyDisasm)) return; 99 | 100 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 101 | #ifndef BEA_LIGHT_DISASSEMBLY 102 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 103 | #endif 104 | (*pMyDisasm).Instruction.Immediat = MyNumber; 105 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 106 | (*pMyDisasm).Argument2.ArgSize = 8; 107 | } 108 | else { 109 | FailDecode(pMyDisasm); 110 | } 111 | 112 | } 113 | else if (GV.REGOPCODE == 6) { 114 | if (GV.OperandSize == 16) { 115 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 116 | GV.MemDecoration = Arg1dqword; 117 | GV.ImmediatSize = 8; 118 | GV.SSE_ = 1; 119 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 120 | GV.SSE_ = 0; 121 | if (GV.MOD_== 0x3) { 122 | #ifndef BEA_LIGHT_DISASSEMBLY 123 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 124 | #endif 125 | } 126 | else { 127 | FailDecode(pMyDisasm); 128 | } 129 | GV.EIP_ += GV.DECALAGE_EIP+3; 130 | if (!Security(0, pMyDisasm)) return; 131 | 132 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 133 | #ifndef BEA_LIGHT_DISASSEMBLY 134 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 135 | #endif 136 | (*pMyDisasm).Instruction.Immediat = MyNumber; 137 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 138 | (*pMyDisasm).Argument2.ArgSize = 8; 139 | } 140 | else { 141 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 142 | GV.MemDecoration = Arg1qword; 143 | GV.ImmediatSize = 8; 144 | GV.MMX_ = 1; 145 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 146 | GV.MMX_ = 0; 147 | if (GV.MOD_== 0x3) { 148 | #ifndef BEA_LIGHT_DISASSEMBLY 149 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 150 | #endif 151 | } 152 | else { 153 | FailDecode(pMyDisasm); 154 | } 155 | GV.EIP_ += GV.DECALAGE_EIP+3; 156 | if (!Security(0, pMyDisasm)) return; 157 | 158 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 159 | #ifndef BEA_LIGHT_DISASSEMBLY 160 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 161 | #endif 162 | (*pMyDisasm).Instruction.Immediat = MyNumber; 163 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 164 | (*pMyDisasm).Argument2.ArgSize = 8; 165 | } 166 | } 167 | else if (GV.REGOPCODE == 7) { 168 | if (GV.OperandSize == 16) { 169 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 170 | GV.MemDecoration = Arg1dqword; 171 | GV.ImmediatSize = 8; 172 | GV.SSE_ = 1; 173 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 174 | GV.SSE_ = 0; 175 | if (GV.MOD_== 0x3) { 176 | #ifndef BEA_LIGHT_DISASSEMBLY 177 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslldq "); 178 | #endif 179 | } 180 | else { 181 | FailDecode(pMyDisasm); 182 | } 183 | GV.EIP_ += GV.DECALAGE_EIP+3; 184 | if (!Security(0, pMyDisasm)) return; 185 | 186 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 187 | #ifndef BEA_LIGHT_DISASSEMBLY 188 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 189 | #endif 190 | (*pMyDisasm).Instruction.Immediat = MyNumber; 191 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 192 | (*pMyDisasm).Argument2.ArgSize = 8; 193 | } 194 | else { 195 | FailDecode(pMyDisasm); 196 | } 197 | 198 | } 199 | else { 200 | FailDecode(pMyDisasm); 201 | } 202 | 203 | } 204 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp15.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G15_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg1multibytes; 29 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 30 | #ifndef BEA_LIGHT_DISASSEMBLY 31 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxsave "); 32 | #endif 33 | (*pMyDisasm).Argument1.ArgSize = 512; 34 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 35 | (*pMyDisasm).Argument2.ArgSize = 512; 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | } 41 | else if (GV.REGOPCODE == 1) { 42 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 43 | if (GV.MOD_!= 0x3) { 44 | GV.MemDecoration = Arg2multibytes; 45 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 46 | #ifndef BEA_LIGHT_DISASSEMBLY 47 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxrstor "); 48 | #endif 49 | (*pMyDisasm).Argument2.ArgSize = 512; 50 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 51 | (*pMyDisasm).Argument1.ArgSize = 512; 52 | } 53 | else { 54 | FailDecode(pMyDisasm); 55 | } 56 | 57 | } 58 | else if (GV.REGOPCODE == 2) { 59 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 60 | if (GV.MOD_!= 0x3) { 61 | GV.MemDecoration = Arg2dword; 62 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 63 | #ifndef BEA_LIGHT_DISASSEMBLY 64 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ldmxcsr "); 65 | #endif 66 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 67 | (*pMyDisasm).Argument1.ArgSize = 32; 68 | } 69 | else { 70 | FailDecode(pMyDisasm); 71 | } 72 | 73 | } 74 | else if (GV.REGOPCODE == 3) { 75 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 76 | if (GV.MOD_!= 0x3) { 77 | GV.MemDecoration = Arg1dword; 78 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 79 | #ifndef BEA_LIGHT_DISASSEMBLY 80 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stmxcsr "); 81 | #endif 82 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 83 | (*pMyDisasm).Argument2.ArgSize = 32; 84 | } 85 | else { 86 | FailDecode(pMyDisasm); 87 | } 88 | 89 | } 90 | 91 | else if (GV.REGOPCODE == 4) { 92 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 93 | if (GV.MOD_!= 0x3) { 94 | GV.MemDecoration = Arg1multibytes; 95 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 96 | #ifndef BEA_LIGHT_DISASSEMBLY 97 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsave "); 98 | #endif 99 | (*pMyDisasm).Argument1.ArgSize = 512; 100 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 101 | (*pMyDisasm).Argument2.ArgSize = 512; 102 | } 103 | else { 104 | FailDecode(pMyDisasm); 105 | } 106 | } 107 | 108 | else if (GV.REGOPCODE == 5) { 109 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 110 | if (GV.MOD_== 0x3) { 111 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 112 | #ifndef BEA_LIGHT_DISASSEMBLY 113 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfence "); 114 | #endif 115 | } 116 | else { 117 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 118 | GV.MemDecoration = Arg2multibytes; 119 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 120 | #ifndef BEA_LIGHT_DISASSEMBLY 121 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xrstor "); 122 | #endif 123 | (*pMyDisasm).Argument2.ArgSize = 512; 124 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 125 | (*pMyDisasm).Argument1.ArgSize = 512; 126 | } 127 | 128 | } 129 | else if (GV.REGOPCODE == 6) { 130 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 131 | if (GV.MOD_== 0x3) { 132 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 133 | #ifndef BEA_LIGHT_DISASSEMBLY 134 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mfence "); 135 | #endif 136 | } 137 | else { 138 | FailDecode(pMyDisasm); 139 | } 140 | } 141 | else if (GV.REGOPCODE == 7) { 142 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 143 | if (GV.MOD_== 0x3) { 144 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 145 | #ifndef BEA_LIGHT_DISASSEMBLY 146 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sfence "); 147 | #endif 148 | } 149 | else { 150 | GV.OperandSize = 8; 151 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 152 | GV.OperandSize = 32; 153 | GV.MemDecoration = Arg2byte; 154 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 155 | #ifndef BEA_LIGHT_DISASSEMBLY 156 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clflush "); 157 | #endif 158 | } 159 | 160 | } 161 | 162 | else { 163 | FailDecode(pMyDisasm); 164 | } 165 | GV.EIP_+= GV.DECALAGE_EIP+2; 166 | } 167 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp16.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G16_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg2byte; 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 30 | #ifndef BEA_LIGHT_DISASSEMBLY 31 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchNTA "); 32 | #endif 33 | } 34 | else { 35 | FailDecode(pMyDisasm); 36 | } 37 | } 38 | else if (GV.REGOPCODE == 1) { 39 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 40 | if (GV.MOD_!= 0x3) { 41 | GV.MemDecoration = Arg2byte; 42 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 43 | #ifndef BEA_LIGHT_DISASSEMBLY 44 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT0 "); 45 | #endif 46 | } 47 | else { 48 | FailDecode(pMyDisasm); 49 | } 50 | 51 | } 52 | else if (GV.REGOPCODE == 2) { 53 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 54 | if (GV.MOD_!= 0x3) { 55 | GV.MemDecoration = Arg2byte; 56 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 57 | #ifndef BEA_LIGHT_DISASSEMBLY 58 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT1 "); 59 | #endif 60 | } 61 | else { 62 | FailDecode(pMyDisasm); 63 | } 64 | 65 | } 66 | else if (GV.REGOPCODE == 3) { 67 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 68 | if (GV.MOD_!= 0x3) { 69 | GV.MemDecoration = Arg2byte; 70 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 71 | #ifndef BEA_LIGHT_DISASSEMBLY 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT2 "); 73 | #endif 74 | } 75 | else { 76 | FailDecode(pMyDisasm); 77 | } 78 | 79 | } 80 | 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_+= GV.DECALAGE_EIP+2; 85 | } 86 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp17.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of BeaEngine. 4 | * 5 | * BeaEngine is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * BeaEngine is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with BeaEngine. If not, see . 17 | * 18 | * @author : beaengine@gmail.com 19 | */ 20 | 21 | /* ==================================================================== 22 | * 23 | * ==================================================================== */ 24 | void __bea_callspec__ G17_(PDISASM pMyDisasm) 25 | { 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 1) { 28 | if (GV.VEX.state == InUsePrefix) { 29 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; 30 | #ifndef BEA_LIGHT_DISASSEMBLY 31 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blsr "); 32 | #endif 33 | if (GV.VEX.opcode == 0xc4) { 34 | /* using VEX3Bytes */ 35 | if (GV.REX.W_ == 0x1) { 36 | GV.OperandSize = 64; 37 | GV.MemDecoration = Arg2qword; 38 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 39 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 40 | } 41 | else { 42 | GV.MemDecoration = Arg2dword; 43 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 44 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 45 | } 46 | } 47 | 48 | } 49 | else { 50 | FailDecode(pMyDisasm); 51 | } 52 | } 53 | else if (GV.REGOPCODE == 2) { 54 | if (GV.VEX.state == InUsePrefix) { 55 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; 56 | #ifndef BEA_LIGHT_DISASSEMBLY 57 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blmsk "); 58 | #endif 59 | if (GV.VEX.opcode == 0xc4) { 60 | /* using VEX3Bytes */ 61 | if (GV.REX.W_ == 0x1) { 62 | GV.OperandSize = 64; 63 | GV.MemDecoration = Arg2qword; 64 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 65 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 66 | } 67 | else { 68 | GV.MemDecoration = Arg2dword; 69 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 70 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 71 | } 72 | } 73 | 74 | } 75 | else { 76 | FailDecode(pMyDisasm); 77 | } 78 | } 79 | else if (GV.REGOPCODE == 3) { 80 | if (GV.VEX.state == InUsePrefix) { 81 | (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; 82 | #ifndef BEA_LIGHT_DISASSEMBLY 83 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blsi "); 84 | #endif 85 | if (GV.VEX.opcode == 0xc4) { 86 | /* using VEX3Bytes */ 87 | if (GV.REX.W_ == 0x1) { 88 | GV.OperandSize = 64; 89 | GV.MemDecoration = Arg2qword; 90 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 91 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 92 | } 93 | else { 94 | GV.MemDecoration = Arg2dword; 95 | fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); 96 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 97 | } 98 | } 99 | 100 | } 101 | else { 102 | FailDecode(pMyDisasm); 103 | } 104 | } 105 | else { 106 | FailDecode(pMyDisasm); 107 | } 108 | GV.EIP_+= GV.DECALAGE_EIP + 2; 109 | } 110 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp2.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0c0h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G2_EbIb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | EbIb(pMyDisasm); 26 | if (GV.REGOPCODE == 0) { 27 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 28 | #ifndef BEA_LIGHT_DISASSEMBLY 29 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 30 | #endif 31 | FillFlags(pMyDisasm, 88); 32 | } 33 | else if (GV.REGOPCODE == 1) { 34 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 35 | #ifndef BEA_LIGHT_DISASSEMBLY 36 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 37 | #endif 38 | FillFlags(pMyDisasm, 88); 39 | } 40 | else if (GV.REGOPCODE == 2) { 41 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 42 | #ifndef BEA_LIGHT_DISASSEMBLY 43 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 44 | #endif 45 | FillFlags(pMyDisasm, 81); 46 | } 47 | else if (GV.REGOPCODE == 3) { 48 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 49 | #ifndef BEA_LIGHT_DISASSEMBLY 50 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 51 | #endif 52 | FillFlags(pMyDisasm, 81); 53 | } 54 | else if (GV.REGOPCODE == 4) { 55 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 56 | #ifndef BEA_LIGHT_DISASSEMBLY 57 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 58 | #endif 59 | FillFlags(pMyDisasm, 92); 60 | } 61 | else if (GV.REGOPCODE == 5) { 62 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 63 | #ifndef BEA_LIGHT_DISASSEMBLY 64 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 65 | #endif 66 | FillFlags(pMyDisasm, 92); 67 | } 68 | else if (GV.REGOPCODE == 6) { 69 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 70 | #ifndef BEA_LIGHT_DISASSEMBLY 71 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 72 | #endif 73 | FillFlags(pMyDisasm, 92); 74 | } 75 | else if (GV.REGOPCODE == 7) { 76 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 77 | #ifndef BEA_LIGHT_DISASSEMBLY 78 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 79 | #endif 80 | FillFlags(pMyDisasm, 92); 81 | } 82 | } 83 | 84 | 85 | /* ==================================================================== 86 | * 0c1h 87 | * ==================================================================== */ 88 | void __bea_callspec__ G2_EvIb(PDISASM pMyDisasm) 89 | { 90 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 91 | EvIb(pMyDisasm); 92 | if (GV.REGOPCODE == 0) { 93 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 94 | #ifndef BEA_LIGHT_DISASSEMBLY 95 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 96 | #endif 97 | FillFlags(pMyDisasm, 88); 98 | } 99 | else if (GV.REGOPCODE == 1) { 100 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 101 | #ifndef BEA_LIGHT_DISASSEMBLY 102 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 103 | #endif 104 | FillFlags(pMyDisasm, 88); 105 | } 106 | else if (GV.REGOPCODE == 2) { 107 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 108 | #ifndef BEA_LIGHT_DISASSEMBLY 109 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 110 | #endif 111 | FillFlags(pMyDisasm, 81); 112 | } 113 | else if (GV.REGOPCODE == 3) { 114 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 115 | #ifndef BEA_LIGHT_DISASSEMBLY 116 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 117 | #endif 118 | FillFlags(pMyDisasm, 81); 119 | } 120 | else if (GV.REGOPCODE == 4) { 121 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 122 | #ifndef BEA_LIGHT_DISASSEMBLY 123 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 124 | #endif 125 | FillFlags(pMyDisasm, 92); 126 | } 127 | else if (GV.REGOPCODE == 5) { 128 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 129 | #ifndef BEA_LIGHT_DISASSEMBLY 130 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 131 | #endif 132 | FillFlags(pMyDisasm, 92); 133 | } 134 | else if (GV.REGOPCODE == 6) { 135 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 136 | #ifndef BEA_LIGHT_DISASSEMBLY 137 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 138 | #endif 139 | FillFlags(pMyDisasm, 92); 140 | } 141 | else if (GV.REGOPCODE == 7) { 142 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 143 | #ifndef BEA_LIGHT_DISASSEMBLY 144 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 145 | #endif 146 | FillFlags(pMyDisasm, 92); 147 | } 148 | } 149 | 150 | /* ==================================================================== 151 | * 0d0h 152 | * ==================================================================== */ 153 | void __bea_callspec__ G2_Eb1(PDISASM pMyDisasm) 154 | { 155 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 156 | GV.MemDecoration = Arg1byte; 157 | GV.OperandSize = 8; 158 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 159 | GV.OperandSize = 32; 160 | #ifndef BEA_LIGHT_DISASSEMBLY 161 | (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); 162 | #endif 163 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 164 | (*pMyDisasm).Argument2.ArgSize = 8; 165 | (*pMyDisasm).Instruction.Immediat = 1; 166 | if (GV.REGOPCODE == 0) { 167 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 168 | #ifndef BEA_LIGHT_DISASSEMBLY 169 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 170 | #endif 171 | FillFlags(pMyDisasm, 87); 172 | } 173 | else if (GV.REGOPCODE == 1) { 174 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 175 | #ifndef BEA_LIGHT_DISASSEMBLY 176 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 177 | #endif 178 | FillFlags(pMyDisasm, 87); 179 | } 180 | else if (GV.REGOPCODE == 2) { 181 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 182 | #ifndef BEA_LIGHT_DISASSEMBLY 183 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 184 | #endif 185 | FillFlags(pMyDisasm, 80); 186 | } 187 | else if (GV.REGOPCODE == 3) { 188 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 189 | #ifndef BEA_LIGHT_DISASSEMBLY 190 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 191 | #endif 192 | FillFlags(pMyDisasm, 80); 193 | } 194 | else if (GV.REGOPCODE == 4) { 195 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 196 | #ifndef BEA_LIGHT_DISASSEMBLY 197 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 198 | #endif 199 | FillFlags(pMyDisasm, 91); 200 | } 201 | else if (GV.REGOPCODE == 5) { 202 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 203 | #ifndef BEA_LIGHT_DISASSEMBLY 204 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 205 | #endif 206 | FillFlags(pMyDisasm, 91); 207 | } 208 | else if (GV.REGOPCODE == 6) { 209 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 210 | #ifndef BEA_LIGHT_DISASSEMBLY 211 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 212 | #endif 213 | FillFlags(pMyDisasm, 91); 214 | } 215 | else if (GV.REGOPCODE == 7) { 216 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 217 | #ifndef BEA_LIGHT_DISASSEMBLY 218 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 219 | #endif 220 | FillFlags(pMyDisasm, 91); 221 | } 222 | GV.EIP_ += GV.DECALAGE_EIP+2; 223 | } 224 | 225 | 226 | /* ==================================================================== 227 | * 0d1h 228 | * ==================================================================== */ 229 | void __bea_callspec__ G2_Ev1(PDISASM pMyDisasm) 230 | { 231 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 232 | if (GV.OperandSize == 64) { 233 | GV.MemDecoration = Arg1qword; 234 | } 235 | else if (GV.OperandSize == 32) { 236 | GV.MemDecoration = Arg1dword; 237 | } 238 | else { 239 | GV.MemDecoration = Arg1word; 240 | } 241 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 242 | #ifndef BEA_LIGHT_DISASSEMBLY 243 | (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); 244 | #endif 245 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 246 | (*pMyDisasm).Argument2.ArgSize = 8; 247 | (*pMyDisasm).Instruction.Immediat = 1; 248 | if (GV.REGOPCODE == 0) { 249 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 250 | #ifndef BEA_LIGHT_DISASSEMBLY 251 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 252 | #endif 253 | FillFlags(pMyDisasm, 87); 254 | } 255 | else if (GV.REGOPCODE == 1) { 256 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 257 | #ifndef BEA_LIGHT_DISASSEMBLY 258 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 259 | #endif 260 | FillFlags(pMyDisasm, 87); 261 | } 262 | else if (GV.REGOPCODE == 2) { 263 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 264 | #ifndef BEA_LIGHT_DISASSEMBLY 265 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 266 | #endif 267 | FillFlags(pMyDisasm, 80); 268 | } 269 | else if (GV.REGOPCODE == 3) { 270 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 271 | #ifndef BEA_LIGHT_DISASSEMBLY 272 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 273 | #endif 274 | FillFlags(pMyDisasm, 80); 275 | } 276 | else if (GV.REGOPCODE == 4) { 277 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 278 | #ifndef BEA_LIGHT_DISASSEMBLY 279 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 280 | #endif 281 | FillFlags(pMyDisasm, 91); 282 | } 283 | else if (GV.REGOPCODE == 5) { 284 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 285 | #ifndef BEA_LIGHT_DISASSEMBLY 286 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 287 | #endif 288 | FillFlags(pMyDisasm, 91); 289 | } 290 | else if (GV.REGOPCODE == 6) { 291 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 292 | #ifndef BEA_LIGHT_DISASSEMBLY 293 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 294 | #endif 295 | FillFlags(pMyDisasm, 91); 296 | } 297 | else if (GV.REGOPCODE == 7) { 298 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 299 | #ifndef BEA_LIGHT_DISASSEMBLY 300 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 301 | #endif 302 | FillFlags(pMyDisasm, 91); 303 | } 304 | GV.EIP_ += GV.DECALAGE_EIP+2; 305 | } 306 | 307 | 308 | /* ==================================================================== 309 | * 0d2h 310 | * ==================================================================== */ 311 | void __bea_callspec__ G2_EbCL(PDISASM pMyDisasm) 312 | { 313 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 314 | GV.MemDecoration = Arg1byte; 315 | GV.OperandSize = 8; 316 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 317 | GV.OperandSize = 32; 318 | #ifndef BEA_LIGHT_DISASSEMBLY 319 | (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); 320 | #endif 321 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; 322 | (*pMyDisasm).Argument2.ArgSize = 8; 323 | if (GV.REGOPCODE == 0) { 324 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 325 | #ifndef BEA_LIGHT_DISASSEMBLY 326 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 327 | #endif 328 | FillFlags(pMyDisasm, 88); 329 | } 330 | else if (GV.REGOPCODE == 1) { 331 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 332 | #ifndef BEA_LIGHT_DISASSEMBLY 333 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 334 | #endif 335 | FillFlags(pMyDisasm, 88); 336 | } 337 | else if (GV.REGOPCODE == 2) { 338 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 339 | #ifndef BEA_LIGHT_DISASSEMBLY 340 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 341 | #endif 342 | FillFlags(pMyDisasm, 81); 343 | } 344 | else if (GV.REGOPCODE == 3) { 345 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 346 | #ifndef BEA_LIGHT_DISASSEMBLY 347 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 348 | #endif 349 | FillFlags(pMyDisasm, 81); 350 | } 351 | else if (GV.REGOPCODE == 4) { 352 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 353 | #ifndef BEA_LIGHT_DISASSEMBLY 354 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 355 | #endif 356 | FillFlags(pMyDisasm, 92); 357 | } 358 | else if (GV.REGOPCODE == 5) { 359 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 360 | #ifndef BEA_LIGHT_DISASSEMBLY 361 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 362 | #endif 363 | FillFlags(pMyDisasm, 92); 364 | } 365 | else if (GV.REGOPCODE == 6) { 366 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 367 | #ifndef BEA_LIGHT_DISASSEMBLY 368 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 369 | #endif 370 | FillFlags(pMyDisasm, 92); 371 | } 372 | else if (GV.REGOPCODE == 7) { 373 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 374 | #ifndef BEA_LIGHT_DISASSEMBLY 375 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 376 | #endif 377 | FillFlags(pMyDisasm, 92); 378 | } 379 | GV.EIP_ += GV.DECALAGE_EIP+2; 380 | } 381 | 382 | 383 | /* ==================================================================== 384 | * 0d3h 385 | * ==================================================================== */ 386 | void __bea_callspec__ G2_EvCL(PDISASM pMyDisasm) 387 | { 388 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 389 | if (GV.OperandSize == 64) { 390 | GV.MemDecoration = Arg1qword; 391 | } 392 | else if (GV.OperandSize == 32) { 393 | GV.MemDecoration = Arg1dword; 394 | } 395 | else { 396 | GV.MemDecoration = Arg1word; 397 | } 398 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 399 | #ifndef BEA_LIGHT_DISASSEMBLY 400 | (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); 401 | #endif 402 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; 403 | (*pMyDisasm).Argument2.ArgSize = 8; 404 | if (GV.REGOPCODE == 0) { 405 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 406 | #ifndef BEA_LIGHT_DISASSEMBLY 407 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); 408 | #endif 409 | FillFlags(pMyDisasm, 88); 410 | } 411 | else if (GV.REGOPCODE == 1) { 412 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 413 | #ifndef BEA_LIGHT_DISASSEMBLY 414 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); 415 | #endif 416 | FillFlags(pMyDisasm, 88); 417 | } 418 | else if (GV.REGOPCODE == 2) { 419 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 420 | #ifndef BEA_LIGHT_DISASSEMBLY 421 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); 422 | #endif 423 | FillFlags(pMyDisasm, 81); 424 | } 425 | else if (GV.REGOPCODE == 3) { 426 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 427 | #ifndef BEA_LIGHT_DISASSEMBLY 428 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); 429 | #endif 430 | FillFlags(pMyDisasm, 81); 431 | } 432 | else if (GV.REGOPCODE == 4) { 433 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 434 | #ifndef BEA_LIGHT_DISASSEMBLY 435 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); 436 | #endif 437 | FillFlags(pMyDisasm, 92); 438 | } 439 | else if (GV.REGOPCODE == 5) { 440 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 441 | #ifndef BEA_LIGHT_DISASSEMBLY 442 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); 443 | #endif 444 | FillFlags(pMyDisasm, 92); 445 | } 446 | else if (GV.REGOPCODE == 6) { 447 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 448 | #ifndef BEA_LIGHT_DISASSEMBLY 449 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); 450 | #endif 451 | FillFlags(pMyDisasm, 92); 452 | } 453 | else if (GV.REGOPCODE == 7) { 454 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; 455 | #ifndef BEA_LIGHT_DISASSEMBLY 456 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); 457 | #endif 458 | FillFlags(pMyDisasm, 92); 459 | } 460 | GV.EIP_ += GV.DECALAGE_EIP+2; 461 | } 462 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp3.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0f6h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G3_Eb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 27 | #ifndef BEA_LIGHT_DISASSEMBLY 28 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); 29 | #endif 30 | EbIb(pMyDisasm); 31 | (*pMyDisasm).Argument1.AccessMode = READ; 32 | FillFlags(pMyDisasm, 104); 33 | } 34 | else if (GV.REGOPCODE == 1) { 35 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 36 | #ifndef BEA_LIGHT_DISASSEMBLY 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); 38 | #endif 39 | EbIb(pMyDisasm); 40 | (*pMyDisasm).Argument1.AccessMode = READ; 41 | FillFlags(pMyDisasm, 104); 42 | } 43 | else if (GV.REGOPCODE == 2) { 44 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 45 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 46 | } 47 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 48 | #ifndef BEA_LIGHT_DISASSEMBLY 49 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); 50 | #endif 51 | Eb(pMyDisasm); 52 | FillFlags(pMyDisasm, 73); 53 | } 54 | else if (GV.REGOPCODE == 3) { 55 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 56 | #ifndef BEA_LIGHT_DISASSEMBLY 57 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); 58 | #endif 59 | Eb(pMyDisasm); 60 | FillFlags(pMyDisasm, 71); 61 | } 62 | else if (GV.REGOPCODE == 4) { 63 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 64 | #ifndef BEA_LIGHT_DISASSEMBLY 65 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); 66 | #endif 67 | GV.MemDecoration = Arg2byte; 68 | GV.OperandSize = 8; 69 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 70 | GV.OperandSize = 32; 71 | GV.EIP_ += GV.DECALAGE_EIP+2; 72 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 73 | (*pMyDisasm).Argument1.ArgSize = 8; 74 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; 75 | FillFlags(pMyDisasm, 70); 76 | } 77 | else if (GV.REGOPCODE == 5) { 78 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 79 | #ifndef BEA_LIGHT_DISASSEMBLY 80 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); 81 | #endif 82 | GV.MemDecoration = Arg2byte; 83 | GV.OperandSize = 8; 84 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 85 | GV.OperandSize = 32; 86 | GV.EIP_ += GV.DECALAGE_EIP+2; 87 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 88 | (*pMyDisasm).Argument1.ArgSize = 8; 89 | FillFlags(pMyDisasm, 38); 90 | } 91 | else if (GV.REGOPCODE == 6) { 92 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 93 | #ifndef BEA_LIGHT_DISASSEMBLY 94 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); 95 | #endif 96 | GV.MemDecoration = Arg2byte; 97 | GV.OperandSize = 8; 98 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 99 | GV.OperandSize = 32; 100 | GV.EIP_ += GV.DECALAGE_EIP+2; 101 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 102 | (*pMyDisasm).Argument1.ArgSize = 8; 103 | FillFlags(pMyDisasm, 31); 104 | } 105 | else if (GV.REGOPCODE == 7) { 106 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 107 | #ifndef BEA_LIGHT_DISASSEMBLY 108 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); 109 | #endif 110 | GV.MemDecoration = Arg2byte; 111 | GV.OperandSize = 8; 112 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 113 | GV.OperandSize = 32; 114 | GV.EIP_ += GV.DECALAGE_EIP+2; 115 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 116 | (*pMyDisasm).Argument1.ArgSize = 8; 117 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; 118 | FillFlags(pMyDisasm, 37); 119 | } 120 | } 121 | 122 | /* ==================================================================== 123 | * 0f7h 124 | * ==================================================================== */ 125 | void __bea_callspec__ G3_Ev(PDISASM pMyDisasm) 126 | { 127 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 128 | if (GV.REGOPCODE == 0) { 129 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 130 | #ifndef BEA_LIGHT_DISASSEMBLY 131 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); 132 | #endif 133 | EvIv(pMyDisasm); 134 | (*pMyDisasm).Argument1.AccessMode = READ; 135 | FillFlags(pMyDisasm, 104); 136 | } 137 | else if (GV.REGOPCODE == 1) { 138 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 139 | #ifndef BEA_LIGHT_DISASSEMBLY 140 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); 141 | #endif 142 | EvIv(pMyDisasm); 143 | (*pMyDisasm).Argument1.AccessMode = READ; 144 | FillFlags(pMyDisasm, 104); 145 | } 146 | else if (GV.REGOPCODE == 2) { 147 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 148 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 149 | } 150 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; 151 | #ifndef BEA_LIGHT_DISASSEMBLY 152 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); 153 | #endif 154 | Ev(pMyDisasm); 155 | FillFlags(pMyDisasm, 73); 156 | } 157 | else if (GV.REGOPCODE == 3) { 158 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 159 | #ifndef BEA_LIGHT_DISASSEMBLY 160 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); 161 | #endif 162 | Ev(pMyDisasm); 163 | FillFlags(pMyDisasm, 71); 164 | } 165 | else if (GV.REGOPCODE == 4) { 166 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 167 | #ifndef BEA_LIGHT_DISASSEMBLY 168 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); 169 | #endif 170 | if (GV.OperandSize == 64) { 171 | GV.MemDecoration = Arg2qword; 172 | (*pMyDisasm).Argument1.ArgSize = 64; 173 | } 174 | else if (GV.OperandSize == 32) { 175 | GV.MemDecoration = Arg2dword; 176 | (*pMyDisasm).Argument1.ArgSize = 32; 177 | } 178 | else { 179 | GV.MemDecoration = Arg2word; 180 | (*pMyDisasm).Argument1.ArgSize = 16; 181 | } 182 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 183 | GV.EIP_ += GV.DECALAGE_EIP+2; 184 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; 185 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 186 | FillFlags(pMyDisasm, 70); 187 | } 188 | else if (GV.REGOPCODE == 5) { 189 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 190 | #ifndef BEA_LIGHT_DISASSEMBLY 191 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); 192 | #endif 193 | if (GV.OperandSize == 64) { 194 | GV.MemDecoration = Arg2qword; 195 | (*pMyDisasm).Argument1.ArgSize = 64; 196 | } 197 | else if (GV.OperandSize == 32) { 198 | GV.MemDecoration = Arg2dword; 199 | (*pMyDisasm).Argument1.ArgSize = 32; 200 | } 201 | else { 202 | GV.MemDecoration = Arg2word; 203 | (*pMyDisasm).Argument1.ArgSize = 16; 204 | } 205 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 206 | GV.EIP_ += GV.DECALAGE_EIP+2; 207 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; 208 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 209 | FillFlags(pMyDisasm, 38); 210 | } 211 | else if (GV.REGOPCODE == 6) { 212 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 213 | #ifndef BEA_LIGHT_DISASSEMBLY 214 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); 215 | #endif 216 | if (GV.OperandSize == 64) { 217 | GV.MemDecoration = Arg2qword; 218 | (*pMyDisasm).Argument1.ArgSize = 64; 219 | } 220 | else if (GV.OperandSize == 32) { 221 | GV.MemDecoration = Arg2dword; 222 | (*pMyDisasm).Argument1.ArgSize = 32; 223 | } 224 | else { 225 | GV.MemDecoration = Arg2word; 226 | (*pMyDisasm).Argument1.ArgSize = 16; 227 | } 228 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 229 | GV.EIP_ += GV.DECALAGE_EIP+2; 230 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 231 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 232 | FillFlags(pMyDisasm, 31); 233 | } 234 | else if (GV.REGOPCODE == 7) { 235 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 236 | #ifndef BEA_LIGHT_DISASSEMBLY 237 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); 238 | #endif 239 | if (GV.OperandSize == 64) { 240 | GV.MemDecoration = Arg2qword; 241 | (*pMyDisasm).Argument1.ArgSize = 64; 242 | } 243 | else if (GV.OperandSize == 32) { 244 | GV.MemDecoration = Arg2dword; 245 | (*pMyDisasm).Argument1.ArgSize = 32; 246 | } 247 | else { 248 | GV.MemDecoration = Arg2word; 249 | (*pMyDisasm).Argument1.ArgSize = 16; 250 | } 251 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 252 | GV.EIP_ += GV.DECALAGE_EIP+2; 253 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 254 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 255 | FillFlags(pMyDisasm, 37); 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp4.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0feh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G4_Eb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | #ifndef BEA_LIGHT_DISASSEMBLY 31 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 32 | #endif 33 | Eb(pMyDisasm); 34 | FillFlags(pMyDisasm, 40); 35 | } 36 | else if (GV.REGOPCODE == 1) { 37 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 38 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 39 | } 40 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 41 | #ifndef BEA_LIGHT_DISASSEMBLY 42 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 43 | #endif 44 | Eb(pMyDisasm); 45 | FillFlags(pMyDisasm, 30); 46 | } 47 | else { 48 | FailDecode(pMyDisasm); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp5.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0ffh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G5_Ev(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | #ifndef BEA_LIGHT_DISASSEMBLY 31 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 32 | #endif 33 | Ev(pMyDisasm); 34 | FillFlags(pMyDisasm, 40); 35 | } 36 | else if (GV.REGOPCODE == 1) { 37 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 38 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 39 | } 40 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 41 | #ifndef BEA_LIGHT_DISASSEMBLY 42 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 43 | #endif 44 | Ev(pMyDisasm); 45 | FillFlags(pMyDisasm, 30); 46 | } 47 | else if (GV.REGOPCODE == 2) { 48 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 49 | (*pMyDisasm).Instruction.BranchType = CallType; 50 | #ifndef BEA_LIGHT_DISASSEMBLY 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); 52 | #endif 53 | if (GV.Architecture == 64) { 54 | GV.OperandSize = 64; 55 | } 56 | if (GV.OperandSize == 64) { 57 | GV.MemDecoration = Arg1qword; 58 | } 59 | else if (GV.OperandSize == 32) { 60 | GV.MemDecoration = Arg1dword; 61 | } 62 | else { 63 | GV.MemDecoration = Arg1word; 64 | } 65 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 66 | GV.EIP_ += GV.DECALAGE_EIP+2; 67 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 68 | } 69 | else if (GV.REGOPCODE == 3) { 70 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 71 | (*pMyDisasm).Instruction.BranchType = CallType; 72 | if (GV.SYNTAX_ == ATSyntax) { 73 | #ifndef BEA_LIGHT_DISASSEMBLY 74 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); 75 | #endif 76 | } 77 | else { 78 | #ifndef BEA_LIGHT_DISASSEMBLY 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); 80 | #endif 81 | } 82 | GV.MemDecoration = Arg1fword; 83 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 84 | GV.EIP_ += GV.DECALAGE_EIP+2; 85 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 86 | } 87 | else if (GV.REGOPCODE == 4) { 88 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 89 | (*pMyDisasm).Instruction.BranchType = JmpType; 90 | #ifndef BEA_LIGHT_DISASSEMBLY 91 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); 92 | #endif 93 | if (GV.Architecture == 64) { 94 | GV.OperandSize = 64; 95 | } 96 | if (GV.OperandSize == 64) { 97 | GV.MemDecoration = Arg1qword; 98 | } 99 | else if (GV.OperandSize == 32) { 100 | GV.MemDecoration = Arg1dword; 101 | } 102 | else { 103 | GV.MemDecoration = Arg1word; 104 | } 105 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 106 | GV.EIP_ += GV.DECALAGE_EIP+2; 107 | } 108 | else if (GV.REGOPCODE == 5) { 109 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 110 | (*pMyDisasm).Instruction.BranchType = JmpType; 111 | if (GV.SYNTAX_ == ATSyntax) { 112 | #ifndef BEA_LIGHT_DISASSEMBLY 113 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); 114 | #endif 115 | } 116 | else { 117 | #ifndef BEA_LIGHT_DISASSEMBLY 118 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); 119 | #endif 120 | } 121 | GV.MemDecoration = Arg1fword; 122 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 123 | GV.EIP_ += GV.DECALAGE_EIP+2; 124 | } 125 | else if (GV.REGOPCODE == 6) { 126 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 127 | #ifndef BEA_LIGHT_DISASSEMBLY 128 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); 129 | #endif 130 | if (GV.Architecture == 64) { 131 | GV.OperandSize = 64; 132 | } 133 | if (GV.OperandSize == 64) { 134 | GV.MemDecoration = Arg2qword; 135 | } 136 | else if (GV.OperandSize == 32) { 137 | GV.MemDecoration = Arg2dword; 138 | } 139 | else { 140 | GV.MemDecoration = Arg2word; 141 | } 142 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 143 | GV.EIP_ += GV.DECALAGE_EIP+2; 144 | (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; 145 | (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; 146 | (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; 147 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 148 | } 149 | else { 150 | FailDecode(pMyDisasm); 151 | } 152 | } 153 | 154 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp6.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0f00h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G6_(PDISASM pMyDisasm) 23 | { 24 | Int32 OperandSizeOld = 0; 25 | 26 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 27 | OperandSizeOld = GV.OperandSize; 28 | GV.OperandSize = 16; 29 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 30 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 31 | 32 | if (GV.REGOPCODE == 0) { 33 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 34 | GV.OperandSize = OperandSizeOld; 35 | } 36 | else { 37 | GV.MemDecoration = Arg1word; 38 | } 39 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 40 | #ifndef BEA_LIGHT_DISASSEMBLY 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sldt "); 42 | #endif 43 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 44 | (*pMyDisasm).Argument2.ArgSize = 32; 45 | GV.OperandSize = OperandSizeOld; 46 | GV.EIP_+= GV.DECALAGE_EIP+2; 47 | } 48 | else if (GV.REGOPCODE == 1) { 49 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 50 | GV.OperandSize = OperandSizeOld; 51 | } 52 | else { 53 | GV.MemDecoration = Arg1word; 54 | } 55 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 56 | #ifndef BEA_LIGHT_DISASSEMBLY 57 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "str "); 58 | #endif 59 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 60 | (*pMyDisasm).Argument2.ArgSize = 16; 61 | GV.OperandSize = OperandSizeOld; 62 | GV.EIP_+= GV.DECALAGE_EIP+2; 63 | } 64 | else if (GV.REGOPCODE == 2) { 65 | GV.MemDecoration = Arg2word; 66 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 67 | #ifndef BEA_LIGHT_DISASSEMBLY 68 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lldt "); 69 | #endif 70 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 71 | (*pMyDisasm).Argument1.ArgSize = 16; 72 | GV.OperandSize = OperandSizeOld; 73 | GV.EIP_+= GV.DECALAGE_EIP+2; 74 | } 75 | else if (GV.REGOPCODE == 3) { 76 | GV.MemDecoration = Arg2word; 77 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 78 | #ifndef BEA_LIGHT_DISASSEMBLY 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ltr "); 80 | #endif 81 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 82 | (*pMyDisasm).Argument1.ArgSize = 16; 83 | GV.OperandSize = OperandSizeOld; 84 | GV.EIP_+= GV.DECALAGE_EIP+2; 85 | } 86 | else if (GV.REGOPCODE == 4) { 87 | GV.MemDecoration = Arg1word; 88 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 89 | #ifndef BEA_LIGHT_DISASSEMBLY 90 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verr "); 91 | #endif 92 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 93 | (*pMyDisasm).Argument2.ArgSize = 16; 94 | GV.OperandSize = OperandSizeOld; 95 | GV.EIP_+= GV.DECALAGE_EIP+2; 96 | } 97 | else if (GV.REGOPCODE == 5) { 98 | GV.MemDecoration = Arg1word; 99 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 100 | #ifndef BEA_LIGHT_DISASSEMBLY 101 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verw "); 102 | #endif 103 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 104 | (*pMyDisasm).Argument2.ArgSize = 16; 105 | GV.OperandSize = OperandSizeOld; 106 | GV.EIP_+= GV.DECALAGE_EIP+2; 107 | } 108 | else if (GV.REGOPCODE == 6) { 109 | FailDecode(pMyDisasm); 110 | GV.OperandSize = OperandSizeOld; 111 | } 112 | else { 113 | FailDecode(pMyDisasm); 114 | GV.OperandSize = OperandSizeOld; 115 | } 116 | } 117 | 118 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp7.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0f01h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G7_(PDISASM pMyDisasm) 23 | { 24 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 25 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 26 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 27 | GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7; 28 | if (GV.REGOPCODE == 0) { 29 | if (GV.MOD_== 0x3) { 30 | if (GV.RM_ == 0x1) { 31 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 32 | #ifndef BEA_LIGHT_DISASSEMBLY 33 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmcall "); 34 | #endif 35 | GV.EIP_+= GV.DECALAGE_EIP+2; 36 | } 37 | else if (GV.RM_ == 0x2) { 38 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 39 | #ifndef BEA_LIGHT_DISASSEMBLY 40 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmlaunch "); 41 | #endif 42 | GV.EIP_+= GV.DECALAGE_EIP+2; 43 | } 44 | else if (GV.RM_ == 0x3) { 45 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 46 | #ifndef BEA_LIGHT_DISASSEMBLY 47 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmresume "); 48 | #endif 49 | GV.EIP_+= GV.DECALAGE_EIP+2; 50 | } 51 | else if (GV.RM_ == 0x4) { 52 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 53 | #ifndef BEA_LIGHT_DISASSEMBLY 54 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxoff "); 55 | #endif 56 | GV.EIP_+= GV.DECALAGE_EIP+2; 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | } 62 | else { 63 | GV.MemDecoration = Arg1fword; 64 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 65 | #ifndef BEA_LIGHT_DISASSEMBLY 66 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sgdt "); 67 | #endif 68 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; 69 | (*pMyDisasm).Argument2.ArgSize = 48; 70 | GV.EIP_+= GV.DECALAGE_EIP+2; 71 | } 72 | } 73 | else if (GV.REGOPCODE == 1) { 74 | if (GV.MOD_== 0x3) { 75 | if (GV.RM_ == 0x00) { 76 | (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; 77 | #ifndef BEA_LIGHT_DISASSEMBLY 78 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "monitor "); 79 | #endif 80 | GV.EIP_+= GV.DECALAGE_EIP+2; 81 | } 82 | else if (GV.RM_ == 0x01) { 83 | (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; 84 | #ifndef BEA_LIGHT_DISASSEMBLY 85 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mwait "); 86 | #endif 87 | GV.EIP_+= GV.DECALAGE_EIP+2; 88 | } 89 | else if (GV.RM_ == 0x2) { 90 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; 91 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 92 | #ifndef BEA_LIGHT_DISASSEMBLY 93 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clac "); 94 | #endif 95 | FillFlags(pMyDisasm,129); 96 | GV.EIP_+= GV.DECALAGE_EIP+2; 97 | } 98 | else { 99 | FailDecode(pMyDisasm); 100 | } 101 | } 102 | else { 103 | GV.MemDecoration = Arg1fword; 104 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 105 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 106 | #ifndef BEA_LIGHT_DISASSEMBLY 107 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sidt "); 108 | #endif 109 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; 110 | (*pMyDisasm).Argument2.ArgSize = 48; 111 | GV.EIP_+= GV.DECALAGE_EIP+2; 112 | } 113 | } 114 | else if (GV.REGOPCODE == 2) { 115 | if (GV.MOD_== 0x3) { 116 | if (GV.RM_ == 0x0) { 117 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 118 | #ifndef BEA_LIGHT_DISASSEMBLY 119 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xgetbv "); 120 | #endif 121 | GV.EIP_+= GV.DECALAGE_EIP+2; 122 | } 123 | else if (GV.RM_ == 0x1) { 124 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 125 | #ifndef BEA_LIGHT_DISASSEMBLY 126 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsetbv "); 127 | #endif 128 | GV.EIP_+= GV.DECALAGE_EIP+2; 129 | } 130 | else { 131 | FailDecode(pMyDisasm); 132 | } 133 | } 134 | else { 135 | GV.MemDecoration = Arg2fword; 136 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 137 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 138 | #ifndef BEA_LIGHT_DISASSEMBLY 139 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgdt "); 140 | #endif 141 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; 142 | (*pMyDisasm).Argument1.ArgSize = 48; 143 | GV.EIP_+= GV.DECALAGE_EIP+2; 144 | } 145 | } 146 | else if (GV.REGOPCODE == 3) { 147 | if (GV.MOD_== 0x3) { 148 | if (GV.RM_ == 0x0) { 149 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 150 | #ifndef BEA_LIGHT_DISASSEMBLY 151 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmrun "); 152 | #endif 153 | GV.EIP_+= GV.DECALAGE_EIP+2; 154 | } 155 | else if (GV.RM_ == 0x1) { 156 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 157 | #ifndef BEA_LIGHT_DISASSEMBLY 158 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmmcall "); 159 | #endif 160 | GV.EIP_+= GV.DECALAGE_EIP+2; 161 | } 162 | else if (GV.RM_ == 0x2) { 163 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 164 | #ifndef BEA_LIGHT_DISASSEMBLY 165 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmload "); 166 | #endif 167 | GV.EIP_+= GV.DECALAGE_EIP+2; 168 | } 169 | else if (GV.RM_ == 0x3) { 170 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 171 | #ifndef BEA_LIGHT_DISASSEMBLY 172 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmsave "); 173 | #endif 174 | GV.EIP_+= GV.DECALAGE_EIP+2; 175 | } 176 | else if (GV.RM_ == 0x4) { 177 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 178 | #ifndef BEA_LIGHT_DISASSEMBLY 179 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stgi "); 180 | #endif 181 | GV.EIP_+= GV.DECALAGE_EIP+2; 182 | } 183 | else if (GV.RM_ == 0x5) { 184 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 185 | #ifndef BEA_LIGHT_DISASSEMBLY 186 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clgi "); 187 | #endif 188 | GV.EIP_+= GV.DECALAGE_EIP+2; 189 | } 190 | else if (GV.RM_ == 0x6) { 191 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 192 | #ifndef BEA_LIGHT_DISASSEMBLY 193 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "skinit "); 194 | #endif 195 | GV.EIP_+= GV.DECALAGE_EIP+2; 196 | } 197 | else if (GV.RM_ == 0x7) { 198 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 199 | #ifndef BEA_LIGHT_DISASSEMBLY 200 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpga "); 201 | #endif 202 | GV.EIP_+= GV.DECALAGE_EIP+2; 203 | } 204 | else { 205 | FailDecode(pMyDisasm); 206 | } 207 | } 208 | else { 209 | GV.MemDecoration = Arg2fword; 210 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 211 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 212 | #ifndef BEA_LIGHT_DISASSEMBLY 213 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lidt "); 214 | #endif 215 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; 216 | (*pMyDisasm).Argument1.ArgSize = 48; 217 | GV.EIP_+= GV.DECALAGE_EIP+2; 218 | } 219 | } 220 | 221 | else if (GV.REGOPCODE == 4) { 222 | GV.MemDecoration = Arg2word; 223 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 224 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 225 | #ifndef BEA_LIGHT_DISASSEMBLY 226 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "smsw "); 227 | #endif 228 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0; 229 | (*pMyDisasm).Argument1.ArgSize = 16; 230 | GV.EIP_+= GV.DECALAGE_EIP+2; 231 | } 232 | 233 | else if (GV.REGOPCODE == 6) { 234 | GV.MemDecoration = Arg1word; 235 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 236 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 237 | #ifndef BEA_LIGHT_DISASSEMBLY 238 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lmsw "); 239 | #endif 240 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+CR_REG+REG0; 241 | (*pMyDisasm).Argument2.ArgSize = 16; 242 | GV.EIP_+= GV.DECALAGE_EIP+2; 243 | } 244 | else if (GV.REGOPCODE == 7) { 245 | if (GV.MOD_== 0x3) { 246 | if (GV.Architecture == 64) { 247 | if (GV.RM_ == 0x0) { 248 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 249 | #ifndef BEA_LIGHT_DISASSEMBLY 250 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "swapgs "); 251 | #endif 252 | GV.EIP_+= GV.DECALAGE_EIP+2; 253 | } 254 | else { 255 | FailDecode(pMyDisasm); 256 | } 257 | } 258 | else { 259 | if (GV.RM_ == 0x1) { 260 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 261 | #ifndef BEA_LIGHT_DISASSEMBLY 262 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtscp "); 263 | #endif 264 | GV.EIP_+= GV.DECALAGE_EIP+2; 265 | } 266 | else { 267 | FailDecode(pMyDisasm); 268 | } 269 | } 270 | } 271 | else { 272 | GV.MemDecoration = Arg2byte; 273 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 274 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 275 | #ifndef BEA_LIGHT_DISASSEMBLY 276 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpg "); 277 | #endif 278 | GV.EIP_+= GV.DECALAGE_EIP+2; 279 | } 280 | } 281 | else { 282 | FailDecode(pMyDisasm); 283 | } 284 | 285 | 286 | } 287 | 288 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp8.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0fbah 21 | * ==================================================================== */ 22 | void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | EvIb(pMyDisasm); 26 | if (GV.REGOPCODE == 4) { 27 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 28 | #ifndef BEA_LIGHT_DISASSEMBLY 29 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); 30 | #endif 31 | (*pMyDisasm).Argument1.AccessMode = READ; 32 | FillFlags(pMyDisasm, 11); 33 | } 34 | else if (GV.REGOPCODE == 5) { 35 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 36 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 37 | } 38 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 39 | #ifndef BEA_LIGHT_DISASSEMBLY 40 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); 41 | #endif 42 | (*pMyDisasm).Argument1.AccessMode = READ; 43 | FillFlags(pMyDisasm, 11); 44 | } 45 | else if (GV.REGOPCODE == 6) { 46 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 47 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 48 | } 49 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 50 | #ifndef BEA_LIGHT_DISASSEMBLY 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); 52 | #endif 53 | (*pMyDisasm).Argument1.AccessMode = READ; 54 | FillFlags(pMyDisasm, 11); 55 | } 56 | else if (GV.REGOPCODE == 7) { 57 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 58 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 59 | } 60 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 61 | #ifndef BEA_LIGHT_DISASSEMBLY 62 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); 63 | #endif 64 | (*pMyDisasm).Argument1.AccessMode = READ; 65 | FillFlags(pMyDisasm, 11); 66 | } 67 | else { 68 | FailDecode(pMyDisasm); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_Grp9.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | 20 | /* ==================================================================== 21 | * 0fc7h 22 | * ==================================================================== */ 23 | void __bea_callspec__ G9_(PDISASM pMyDisasm) 24 | { 25 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 26 | GV.MemDecoration = Arg2qword; 27 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 28 | if (GV.REGOPCODE == 1) { 29 | if (GV.REX.W_ == 1) { 30 | GV.MemDecoration = Arg2dqword; 31 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 32 | #ifndef BEA_LIGHT_DISASSEMBLY 33 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg16b "); 34 | #endif 35 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 36 | (*pMyDisasm).Argument1.ArgSize = 128; 37 | (*pMyDisasm).Argument1.AccessMode = READ; 38 | FillFlags(pMyDisasm, 23); 39 | GV.EIP_ += GV.DECALAGE_EIP+2; 40 | } 41 | else { 42 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 43 | #ifndef BEA_LIGHT_DISASSEMBLY 44 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg8b "); 45 | #endif 46 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 47 | (*pMyDisasm).Argument1.ArgSize = 64; 48 | (*pMyDisasm).Argument1.AccessMode = READ; 49 | FillFlags(pMyDisasm, 23); 50 | GV.EIP_ += GV.DECALAGE_EIP+2; 51 | } 52 | } 53 | else if (GV.REGOPCODE == 6) { 54 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 55 | if (GV.OperandSize == 16) { 56 | #ifndef BEA_LIGHT_DISASSEMBLY 57 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmclear "); 58 | #endif 59 | } 60 | else if (GV.PrefRepe == 1) { 61 | #ifndef BEA_LIGHT_DISASSEMBLY 62 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxon "); 63 | #endif 64 | } 65 | else { 66 | #ifndef BEA_LIGHT_DISASSEMBLY 67 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrld "); 68 | #endif 69 | } 70 | GV.EIP_ += GV.DECALAGE_EIP+2; 71 | 72 | } 73 | else if (GV.REGOPCODE == 7) { 74 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 75 | #ifndef BEA_LIGHT_DISASSEMBLY 76 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrst "); 77 | #endif 78 | GV.EIP_ += GV.DECALAGE_EIP+2; 79 | } 80 | else { 81 | FailDecode(pMyDisasm); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /Includes/instr_set/opcodes_prefixes.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * Legacy Prefix F0h-Group 1 21 | * ==================================================================== */ 22 | void __bea_callspec__ PrefLock(PDISASM pMyDisasm) 23 | { 24 | if (!Security(0, pMyDisasm)) return; 25 | (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix; 26 | GV.EIP_++; 27 | (*pMyDisasm).Prefix.Number++; 28 | GV.NB_PREFIX++; 29 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 30 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 31 | GV.OperandSize = 32; 32 | } 33 | 34 | /* ==================================================================== 35 | * Legacy Prefix F2h-Group 1 36 | * ==================================================================== */ 37 | void __bea_callspec__ PrefREPNE(PDISASM pMyDisasm) 38 | { 39 | if (!Security(0, pMyDisasm)) return; 40 | (*pMyDisasm).Prefix.RepnePrefix = SuperfluousPrefix; 41 | GV.EIP_++; 42 | (*pMyDisasm).Prefix.Number++; 43 | GV.NB_PREFIX++; 44 | GV.PrefRepne = 1; 45 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 46 | if (GV.VEX.state != InUsePrefix) { 47 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 48 | } 49 | else if (GV.VEX.mmmmm == 0x1) { 50 | (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 51 | } 52 | else if (GV.VEX.mmmmm == 0x2) { 53 | (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 54 | } 55 | else if (GV.VEX.mmmmm == 0x3) { 56 | (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 57 | } 58 | else { 59 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 60 | } 61 | GV.PrefRepne = 0; 62 | } 63 | 64 | /* ==================================================================== 65 | * Legacy Prefix F3h-Group 1 66 | * ==================================================================== */ 67 | void __bea_callspec__ PrefREPE(PDISASM pMyDisasm) 68 | { 69 | if (!Security(0, pMyDisasm)) return; 70 | (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix; 71 | GV.EIP_++; 72 | (*pMyDisasm).Prefix.Number++; 73 | GV.NB_PREFIX++; 74 | GV.PrefRepe = 1; 75 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 76 | if (GV.VEX.state != InUsePrefix) { 77 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 78 | } 79 | else if (GV.VEX.mmmmm == 0x1) { 80 | (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 81 | } 82 | else if (GV.VEX.mmmmm == 0x2) { 83 | (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 84 | } 85 | else if (GV.VEX.mmmmm == 0x3) { 86 | (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 87 | } 88 | else { 89 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 90 | } 91 | GV.PrefRepe = 0; 92 | } 93 | 94 | /* ==================================================================== 95 | * Legacy Prefix 2Eh-Group 2 96 | * ==================================================================== */ 97 | void __bea_callspec__ PrefSEGCS(PDISASM pMyDisasm) 98 | { 99 | if (!Security(0, pMyDisasm)) return; 100 | (*pMyDisasm).Prefix.CSPrefix = InUsePrefix; 101 | GV.EIP_++; 102 | (*pMyDisasm).Prefix.Number++; 103 | GV.NB_PREFIX++; 104 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 105 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 106 | } 107 | 108 | /* ==================================================================== 109 | * Legacy Prefix 3Eh-Group 2 110 | * ==================================================================== */ 111 | void __bea_callspec__ PrefSEGDS(PDISASM pMyDisasm) 112 | { 113 | if (!Security(0, pMyDisasm)) return; 114 | (*pMyDisasm).Prefix.DSPrefix = InUsePrefix; 115 | GV.EIP_++; 116 | (*pMyDisasm).Prefix.Number++; 117 | GV.NB_PREFIX++; 118 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 119 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 120 | } 121 | 122 | /* ==================================================================== 123 | * Legacy Prefix 26h-Group 2 124 | * ==================================================================== */ 125 | void __bea_callspec__ PrefSEGES(PDISASM pMyDisasm) 126 | { 127 | if (!Security(0, pMyDisasm)) return; 128 | (*pMyDisasm).Prefix.ESPrefix = InUsePrefix; 129 | GV.EIP_++; 130 | (*pMyDisasm).Prefix.Number++; 131 | GV.NB_PREFIX++; 132 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 133 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 134 | } 135 | 136 | /* ==================================================================== 137 | * Legacy Prefix 64h-Group 2 138 | * ==================================================================== */ 139 | void __bea_callspec__ PrefSEGFS(PDISASM pMyDisasm) 140 | { 141 | if (!Security(0, pMyDisasm)) return; 142 | (*pMyDisasm).Prefix.FSPrefix = InUsePrefix; 143 | GV.EIP_++; 144 | (*pMyDisasm).Prefix.Number++; 145 | GV.NB_PREFIX++; 146 | GV.SEGMENTFS = 1; 147 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 148 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 149 | } 150 | 151 | /* ==================================================================== 152 | * Legacy Prefix 65h-Group 2 153 | * ==================================================================== */ 154 | void __bea_callspec__ PrefSEGGS(PDISASM pMyDisasm) 155 | { 156 | if (!Security(0, pMyDisasm)) return; 157 | (*pMyDisasm).Prefix.GSPrefix = InUsePrefix; 158 | GV.EIP_++; 159 | (*pMyDisasm).Prefix.Number++; 160 | GV.NB_PREFIX++; 161 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 162 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 163 | } 164 | 165 | 166 | /* ==================================================================== 167 | * Legacy Prefix 36h-Group 2 168 | * ==================================================================== */ 169 | void __bea_callspec__ PrefSEGSS(PDISASM pMyDisasm) 170 | { 171 | if (!Security(0, pMyDisasm)) return; 172 | (*pMyDisasm).Prefix.SSPrefix = InUsePrefix; 173 | GV.EIP_++; 174 | (*pMyDisasm).Prefix.Number++; 175 | GV.NB_PREFIX++; 176 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 177 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 178 | } 179 | 180 | /* ==================================================================== 181 | * Legacy Prefix 66h-Group 3 182 | * ==================================================================== */ 183 | void __bea_callspec__ PrefOpSize(PDISASM pMyDisasm) 184 | { 185 | if (!Security(0, pMyDisasm)) return; 186 | (*pMyDisasm).Prefix.OperandSize = InUsePrefix; 187 | GV.EIP_++; 188 | (*pMyDisasm).Prefix.Number++; 189 | GV.NB_PREFIX++; 190 | GV.OriginalOperandSize = GV.OperandSize; /* if GV.OperandSize is used as a mandatory prefix, keep the real operandsize value */ 191 | if (GV.Architecture == 16) { 192 | GV.OperandSize = 32; 193 | } 194 | else { 195 | if (GV.OperandSize != 64) { 196 | GV.OperandSize = 16; 197 | } 198 | } 199 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 200 | if (GV.VEX.state != InUsePrefix) { 201 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 202 | } 203 | else if (GV.VEX.mmmmm == 0x1) { 204 | (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 205 | } 206 | else if (GV.VEX.mmmmm == 0x2) { 207 | (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 208 | } 209 | else if (GV.VEX.mmmmm == 0x3) { 210 | (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 211 | } 212 | else { 213 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 214 | } 215 | if (GV.Architecture == 16) { 216 | GV.OperandSize = 16; 217 | } 218 | else { 219 | GV.OperandSize = 32; 220 | } 221 | } 222 | 223 | /* ==================================================================== 224 | * Legacy Prefix 67h-Group 4 225 | * ==================================================================== */ 226 | void __bea_callspec__ PrefAdSize(PDISASM pMyDisasm) 227 | { 228 | if (!Security(0, pMyDisasm)) return; 229 | (*pMyDisasm).Prefix.AddressSize = InUsePrefix; 230 | GV.EIP_++; 231 | (*pMyDisasm).Prefix.Number++; 232 | GV.NB_PREFIX++; 233 | if (GV.Architecture == 16) { 234 | GV.AddressSize = GV.AddressSize << 1; 235 | } 236 | else { 237 | GV.AddressSize = GV.AddressSize >> 1; 238 | } 239 | 240 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); 241 | (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 242 | if (GV.Architecture == 16) { 243 | GV.AddressSize = GV.AddressSize >> 1; 244 | } 245 | else { 246 | GV.AddressSize = GV.AddressSize << 1; 247 | } 248 | 249 | } 250 | 251 | /* ==================================================================== 252 | * Escape Prefix 0Fh-two bytes opcodes 253 | * ==================================================================== */ 254 | void __bea_callspec__ Esc_2byte(PDISASM pMyDisasm) 255 | { 256 | if (!Security(0, pMyDisasm)) return; 257 | GV.EIP_++; 258 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F00; 259 | (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 260 | } 261 | 262 | /* ==================================================================== 263 | * Escape Prefix 0F38h-three bytes opcodes 264 | * ==================================================================== */ 265 | void __bea_callspec__ Esc_tableA4(PDISASM pMyDisasm) 266 | { 267 | if (!Security(0, pMyDisasm)) return; 268 | GV.EIP_++; 269 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3800; 270 | (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 271 | } 272 | /* ==================================================================== 273 | * Escape Prefix 0F3Ah-three bytes opcodes 274 | * ==================================================================== */ 275 | void __bea_callspec__ Esc_tableA5(PDISASM pMyDisasm) 276 | { 277 | if (!Security(0, pMyDisasm)) return; 278 | GV.EIP_++; 279 | (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3A00; 280 | (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); 281 | } 282 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 fjqisba 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeMake 2 | 开发环境 VS2015 3 | 4 | 本工具用来批量生成易语言的支持库esig文件。 5 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | MICROSOFT 基础类库 : CodMake 项目概述 3 | =============================================================================== 4 | 5 | 应用程序向导已为您创建了此 CodMake 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。 6 | 7 | 本文件概要介绍组成 CodMake 应用程序的每个文件的内容。 8 | 9 | CodMake.vcxproj 10 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 11 | 12 | CodMake.vcxproj.filters 13 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 14 | 15 | CodMake.h 16 | 这是应用程序的主头文件。 17 | 其中包括其他项目特定的标头(包括 Resource.h),并声明 CCodMakeApp 应用程序类。 18 | 19 | CodMake.cpp 20 | 这是包含应用程序类 CCodMakeApp 的主应用程序源文件。 21 | 22 | CodMake.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。 24 | 25 | res\CodMake.ico 26 | 这是用作应用程序图标的图标文件。此图标包括在主资源文件 CodMake.rc 中。 27 | 28 | res\CodMake.rc2 29 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 30 | 31 | 32 | ///////////////////////////////////////////////////////////////////////////// 33 | 34 | 应用程序向导创建一个对话框类: 35 | 36 | CodMakeDlg.h、CodMakeDlg.cpp - 对话框 37 | 这些文件包含 CCodMakeDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 CodMake.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。 38 | 39 | ///////////////////////////////////////////////////////////////////////////// 40 | 41 | 其他功能: 42 | 43 | ActiveX 控件 44 | 该应用程序包含对使用 ActiveX 控件的支持。 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | 48 | 其他标准文件: 49 | 50 | StdAfx.h, StdAfx.cpp 51 | 这些文件用于生成名为 CodMake.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 52 | 53 | Resource.h 54 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 55 | 56 | CodMake.manifest 57 | Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。 58 | ///////////////////////////////////////////////////////////////////////////// 59 | 60 | 其他注释: 61 | 62 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 63 | 64 | 如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。 65 | 有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。 66 | 67 | ///////////////////////////////////////////////////////////////////////////// 68 | -------------------------------------------------------------------------------- /Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/Resource.h -------------------------------------------------------------------------------- /beaengine/basic_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basic_types.h 3 | * @author 4 | * @date Thu Dec 24 19:31:22 2009 5 | * 6 | * @brief Definitions of fixed-size integer types for various platforms 7 | * 8 | * This file is part of BeaEngine. 9 | * 10 | * BeaEngine is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * BeaEngine is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public License 21 | * along with BeaEngine. If not, see . */ 22 | 23 | #ifndef __BEA_BASIC_TYPES_HPP__ 24 | #define __BEA_BASIC_TYPES_HPP__ 25 | 26 | #include 27 | 28 | #if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) 29 | #include 30 | #endif 31 | 32 | #if defined(_MSC_VER) && !defined(__BORLANDC__) 33 | /* 34 | * Windows/Visual C++ 35 | */ 36 | typedef signed char Int8; 37 | typedef unsigned char UInt8; 38 | typedef signed short Int16; 39 | typedef unsigned short UInt16; 40 | typedef signed int Int32; 41 | typedef unsigned int UInt32; 42 | typedef signed __int64 Int64; 43 | typedef unsigned __int64 UInt64; 44 | #if defined(_WIN64) 45 | #define BEA_PTR_IS_64_BIT 1 46 | typedef signed __int64 IntPtr; 47 | typedef unsigned __int64 UIntPtr; 48 | #else 49 | typedef signed long IntPtr; 50 | typedef size_t UIntPtr; 51 | #endif 52 | #define BEA_HAVE_INT64 1 53 | #elif defined(__POCC__) 54 | /* 55 | * PellesC 56 | */ 57 | typedef signed char Int8; 58 | typedef unsigned char UInt8; 59 | typedef signed short Int16; 60 | typedef unsigned short UInt16; 61 | typedef signed int Int32; 62 | typedef unsigned int UInt32; 63 | typedef signed long long Int64; 64 | typedef unsigned long long UInt64; 65 | #if defined(_WIN64) 66 | #define BEA_PTR_IS_64_BIT 1 67 | typedef signed long long IntPtr; 68 | typedef unsigned long long UIntPtr; 69 | #else 70 | typedef signed long IntPtr; 71 | typedef size_t UIntPtr; 72 | #endif 73 | #define BEA_HAVE_INT64 1 74 | #elif defined(__GNUC__) || defined(__LCC__) 75 | /* 76 | * Unix/GCC 77 | */ 78 | typedef signed char Int8; 79 | typedef unsigned char UInt8; 80 | typedef signed short Int16; 81 | typedef unsigned short UInt16; 82 | typedef signed int Int32; 83 | typedef unsigned int UInt32; 84 | typedef intptr_t IntPtr; 85 | typedef uintptr_t UIntPtr; 86 | #if defined(__LP64__) 87 | #define BEA_PTR_IS_64_BIT 1 88 | #define BEA_LONG_IS_64_BIT 1 89 | typedef signed long Int64; 90 | typedef unsigned long UInt64; 91 | #else 92 | #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) 93 | typedef __int64 Int64; 94 | typedef unsigned __int64 UInt64; 95 | #else 96 | typedef signed long long Int64; 97 | typedef unsigned long long UInt64; 98 | #endif 99 | #endif 100 | #define BEA_HAVE_INT64 1 101 | #elif defined(__DECCXX) 102 | /* 103 | * Compaq C++ 104 | */ 105 | typedef signed char Int8; 106 | typedef unsigned char UInt8; 107 | typedef signed short Int16; 108 | typedef unsigned short UInt16; 109 | typedef signed int Int32; 110 | typedef unsigned int UInt32; 111 | typedef signed __int64 Int64; 112 | typedef unsigned __int64 UInt64; 113 | #if defined(__VMS) 114 | #if defined(__32BITS) 115 | typedef signed long IntPtr; 116 | typedef unsigned long UIntPtr; 117 | #else 118 | typedef Int64 IntPtr; 119 | typedef UInt64 UIntPtr; 120 | #define BEA_PTR_IS_64_BIT 1 121 | #endif 122 | #else 123 | typedef signed long IntPtr; 124 | typedef unsigned long UIntPtr; 125 | #define BEA_PTR_IS_64_BIT 1 126 | #define BEA_LONG_IS_64_BIT 1 127 | #endif 128 | #define BEA_HAVE_INT64 1 129 | #elif defined(__HP_aCC) 130 | /* 131 | * HP Ansi C++ 132 | */ 133 | typedef signed char Int8; 134 | typedef unsigned char UInt8; 135 | typedef signed short Int16; 136 | typedef unsigned short UInt16; 137 | typedef signed int Int32; 138 | typedef unsigned int UInt32; 139 | typedef signed long IntPtr; 140 | typedef unsigned long UIntPtr; 141 | #if defined(__LP64__) 142 | #define BEA_PTR_IS_64_BIT 1 143 | #define BEA_LONG_IS_64_BIT 1 144 | typedef signed long Int64; 145 | typedef unsigned long UInt64; 146 | #else 147 | typedef signed long long Int64; 148 | typedef unsigned long long UInt64; 149 | #endif 150 | #define BEA_HAVE_INT64 1 151 | #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) 152 | /* 153 | * SUN Forte C++ 154 | */ 155 | typedef signed char Int8; 156 | typedef unsigned char UInt8; 157 | typedef signed short Int16; 158 | typedef unsigned short UInt16; 159 | typedef signed int Int32; 160 | typedef unsigned int UInt32; 161 | typedef signed long IntPtr; 162 | typedef unsigned long UIntPtr; 163 | #if defined(__sparcv9) 164 | #define BEA_PTR_IS_64_BIT 1 165 | #define BEA_LONG_IS_64_BIT 1 166 | typedef signed long Int64; 167 | typedef unsigned long UInt64; 168 | #else 169 | typedef signed long long Int64; 170 | typedef unsigned long long UInt64; 171 | #endif 172 | #define BEA_HAVE_INT64 1 173 | #elif defined(__IBMCPP__) 174 | /* 175 | * IBM XL C++ 176 | */ 177 | typedef signed char Int8; 178 | typedef unsigned char UInt8; 179 | typedef signed short Int16; 180 | typedef unsigned short UInt16; 181 | typedef signed int Int32; 182 | typedef unsigned int UInt32; 183 | typedef signed long IntPtr; 184 | typedef unsigned long UIntPtr; 185 | #if defined(__64BIT__) 186 | #define BEA_PTR_IS_64_BIT 1 187 | #define BEA_LONG_IS_64_BIT 1 188 | typedef signed long Int64; 189 | typedef unsigned long UInt64; 190 | #else 191 | typedef signed long long Int64; 192 | typedef unsigned long long UInt64; 193 | #endif 194 | #define BEA_HAVE_INT64 1 195 | #elif defined(__BORLANDC__) 196 | /* 197 | * Borland C/C++ 198 | */ 199 | typedef signed char Int8; 200 | typedef unsigned char UInt8; 201 | typedef signed short Int16; 202 | typedef unsigned short UInt16; 203 | typedef signed int Int32; 204 | typedef unsigned int UInt32; 205 | typedef unsigned __int64 Int64; 206 | typedef signed __int64 UInt64; 207 | typedef signed long IntPtr; 208 | typedef unsigned long UIntPtr; 209 | #define BEA_HAVE_INT64 1 210 | #elif defined(__WATCOMC__) 211 | /* 212 | * Watcom C/C++ 213 | */ 214 | typedef signed char Int8; 215 | typedef unsigned char UInt8; 216 | typedef signed short Int16; 217 | typedef unsigned short UInt16; 218 | typedef signed int Int32; 219 | typedef unsigned int UInt32; 220 | typedef unsigned __int64 Int64; 221 | typedef signed __int64 UInt64; 222 | #define BEA_HAVE_INT64 1 223 | typedef size_t UIntPtr; 224 | #elif defined(__sgi) 225 | /* 226 | * MIPSpro C++ 227 | */ 228 | typedef signed char Int8; 229 | typedef unsigned char UInt8; 230 | typedef signed short Int16; 231 | typedef unsigned short UInt16; 232 | typedef signed int Int32; 233 | typedef unsigned int UInt32; 234 | typedef signed long IntPtr; 235 | typedef unsigned long UIntPtr; 236 | #if _MIPS_SZLONG == 64 237 | #define BEA_PTR_IS_64_BIT 1 238 | #define BEA_LONG_IS_64_BIT 1 239 | typedef signed long Int64; 240 | typedef unsigned long UInt64; 241 | #else 242 | typedef signed long long Int64; 243 | typedef unsigned long long UInt64; 244 | #endif 245 | #define BEA_HAVE_INT64 1 246 | #endif 247 | 248 | #if defined(_MSC_VER) || defined(__BORLANDC__) 249 | #define W64LIT(x) x##ui64 250 | #else 251 | #define W64LIT(x) x##ULL 252 | #endif 253 | 254 | 255 | #ifndef C_STATIC_ASSERT 256 | #define C_STATIC_ASSERT(tag_name, x) \ 257 | typedef int cache_static_assert_ ## tag_name[(x) * 2-1] 258 | #endif 259 | 260 | C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); 261 | C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); 262 | 263 | C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); 264 | C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); 265 | 266 | C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); 267 | C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); 268 | 269 | C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); 270 | C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); 271 | 272 | #endif 273 | -------------------------------------------------------------------------------- /beaengine/beaengine.h: -------------------------------------------------------------------------------- 1 | #ifndef _BEA_ENGINE_ 2 | #define _BEA_ENGINE_ 3 | #if defined(__cplusplus) && defined(__BORLANDC__) 4 | namespace BeaEngine { 5 | #endif 6 | 7 | #include "macros.h" 8 | #include "export.h" 9 | #include "basic_types.h" 10 | 11 | #if !defined(BEA_ENGINE_STATIC) 12 | #if defined(BUILD_BEA_ENGINE_DLL) 13 | #define BEA_API bea__api_export__ 14 | #else 15 | #define BEA_API bea__api_import__ 16 | #endif 17 | #else 18 | #define BEA_API 19 | #endif 20 | 21 | 22 | #define INSTRUCT_LENGTH 64 23 | 24 | #pragma pack(1) 25 | typedef struct { 26 | UInt8 L; 27 | UInt8 vvvv; 28 | UInt8 mmmmm; 29 | UInt8 pp; 30 | UInt8 state; 31 | UInt8 opcode; 32 | } VEX_Struct ; 33 | #pragma pack() 34 | 35 | #pragma pack(1) 36 | typedef struct { 37 | UInt8 W_; 38 | UInt8 R_; 39 | UInt8 X_; 40 | UInt8 B_; 41 | UInt8 state; 42 | } REX_Struct ; 43 | #pragma pack() 44 | 45 | #pragma pack(1) 46 | typedef struct { 47 | int Number; 48 | int NbUndefined; 49 | UInt8 LockPrefix; 50 | UInt8 OperandSize; 51 | UInt8 AddressSize; 52 | UInt8 RepnePrefix; 53 | UInt8 RepPrefix; 54 | UInt8 FSPrefix; 55 | UInt8 SSPrefix; 56 | UInt8 GSPrefix; 57 | UInt8 ESPrefix; 58 | UInt8 CSPrefix; 59 | UInt8 DSPrefix; 60 | UInt8 BranchTaken; 61 | UInt8 BranchNotTaken; 62 | REX_Struct REX; 63 | char alignment[2]; 64 | } PREFIXINFO ; 65 | #pragma pack() 66 | 67 | #pragma pack(1) 68 | typedef struct { 69 | UInt8 OF_; 70 | UInt8 SF_; 71 | UInt8 ZF_; 72 | UInt8 AF_; 73 | UInt8 PF_; 74 | UInt8 CF_; 75 | UInt8 TF_; 76 | UInt8 IF_; 77 | UInt8 DF_; 78 | UInt8 NT_; 79 | UInt8 RF_; 80 | UInt8 alignment; 81 | } EFLStruct ; 82 | #pragma pack() 83 | 84 | #pragma pack(4) 85 | typedef struct { 86 | Int32 BaseRegister; 87 | Int32 IndexRegister; 88 | Int32 Scale; 89 | Int64 Displacement; 90 | } MEMORYTYPE ; 91 | #pragma pack() 92 | 93 | 94 | #pragma pack(1) 95 | typedef struct { 96 | Int32 Category; 97 | Int32 Opcode; 98 | char Mnemonic[24]; 99 | Int32 BranchType; 100 | EFLStruct Flags; 101 | UInt64 AddrValue; 102 | Int64 Immediat; 103 | UInt32 ImplicitModifiedRegs; 104 | } INSTRTYPE; 105 | #pragma pack() 106 | 107 | #pragma pack(1) 108 | typedef struct { 109 | char ArgMnemonic[24]; 110 | UInt64 ArgType; 111 | Int32 ArgSize; 112 | Int32 ArgPosition; 113 | UInt32 AccessMode; 114 | MEMORYTYPE Memory; 115 | UInt32 SegmentReg; 116 | } ARGTYPE; 117 | #pragma pack() 118 | 119 | /* reserved structure used for thread-safety */ 120 | /* unusable by customer */ 121 | #pragma pack(1) 122 | typedef struct { 123 | UIntPtr EIP_; 124 | UInt64 EIP_VA; 125 | UIntPtr EIP_REAL; 126 | Int32 OriginalOperandSize; 127 | Int32 OperandSize; 128 | Int32 MemDecoration; 129 | Int32 AddressSize; 130 | Int32 MOD_; 131 | Int32 RM_; 132 | Int32 INDEX_; 133 | Int32 SCALE_; 134 | Int32 BASE_; 135 | Int32 MMX_; 136 | Int32 SSE_; 137 | Int32 CR_; 138 | Int32 DR_; 139 | Int32 SEG_; 140 | Int32 REGOPCODE; 141 | UInt32 DECALAGE_EIP; 142 | Int32 FORMATNUMBER; 143 | Int32 SYNTAX_; 144 | UInt64 EndOfBlock; 145 | Int32 RelativeAddress; 146 | UInt32 Architecture; 147 | Int32 ImmediatSize; 148 | Int32 NB_PREFIX; 149 | Int32 PrefRepe; 150 | Int32 PrefRepne; 151 | UInt32 SEGMENTREGS; 152 | UInt32 SEGMENTFS; 153 | Int32 third_arg; 154 | Int32 TAB_; 155 | Int32 ERROR_OPCODE; 156 | REX_Struct REX; 157 | Int32 OutOfBlock; 158 | VEX_Struct VEX; 159 | Int32 AVX_; 160 | Int32 MPX_; 161 | } InternalDatas; 162 | #pragma pack() 163 | 164 | /* ************** main structure ************ */ 165 | #pragma pack(1) 166 | typedef struct _Disasm { 167 | UIntPtr EIP; 168 | UInt64 VirtualAddr; 169 | UInt32 SecurityBlock; 170 | char CompleteInstr[INSTRUCT_LENGTH]; 171 | UInt32 Archi; 172 | UInt64 Options; 173 | INSTRTYPE Instruction; 174 | ARGTYPE Argument1; 175 | ARGTYPE Argument2; 176 | ARGTYPE Argument3; 177 | ARGTYPE Argument4; 178 | PREFIXINFO Prefix; 179 | InternalDatas Reserved_; 180 | } DISASM, *PDISASM, *LPDISASM; 181 | #pragma pack() 182 | 183 | /* #UD exception */ 184 | #define UD_ 2 185 | 186 | #define ESReg 1 187 | #define DSReg 2 188 | #define FSReg 3 189 | #define GSReg 4 190 | #define CSReg 5 191 | #define SSReg 6 192 | 193 | #define InvalidPrefix 4 194 | #define SuperfluousPrefix 2 195 | #define NotUsedPrefix 0 196 | #define MandatoryPrefix 8 197 | #define InUsePrefix 1 198 | 199 | #define LowPosition 0 200 | #define HighPosition 1 201 | 202 | enum INSTRUCTION_TYPE 203 | { 204 | GENERAL_PURPOSE_INSTRUCTION = 0x10000, 205 | FPU_INSTRUCTION = 0x20000, 206 | MMX_INSTRUCTION = 0x40000, 207 | SSE_INSTRUCTION = 0x80000, 208 | SSE2_INSTRUCTION = 0x100000, 209 | SSE3_INSTRUCTION = 0x200000, 210 | SSSE3_INSTRUCTION = 0x400000, 211 | SSE41_INSTRUCTION = 0x800000, 212 | SSE42_INSTRUCTION = 0x1000000, 213 | SYSTEM_INSTRUCTION = 0x2000000, 214 | VM_INSTRUCTION = 0x4000000, 215 | UNDOCUMENTED_INSTRUCTION = 0x8000000, 216 | AMD_INSTRUCTION = 0x10000000, 217 | ILLEGAL_INSTRUCTION = 0x20000000, 218 | AES_INSTRUCTION = 0x40000000, 219 | CLMUL_INSTRUCTION = (int)0x80000000, 220 | AVX_INSTRUCTION = (int)0x100000000, 221 | AVX2_INSTRUCTION = (int)0x200000000, 222 | MPX_INSTRUCTION = (int)0x400000000, 223 | DATA_TRANSFER = 0x1, 224 | ARITHMETIC_INSTRUCTION, 225 | LOGICAL_INSTRUCTION, 226 | SHIFT_ROTATE, 227 | BIT_UInt8, 228 | CONTROL_TRANSFER, 229 | STRING_INSTRUCTION, 230 | InOutINSTRUCTION, 231 | ENTER_LEAVE_INSTRUCTION, 232 | FLAG_CONTROL_INSTRUCTION, 233 | SEGMENT_REGISTER, 234 | MISCELLANEOUS_INSTRUCTION, 235 | COMPARISON_INSTRUCTION, 236 | LOGARITHMIC_INSTRUCTION, 237 | TRIGONOMETRIC_INSTRUCTION, 238 | UNSUPPORTED_INSTRUCTION, 239 | LOAD_CONSTANTS, 240 | FPUCONTROL, 241 | STATE_MANAGEMENT, 242 | CONVERSION_INSTRUCTION, 243 | SHUFFLE_UNPACK, 244 | PACKED_SINGLE_PRECISION, 245 | SIMD128bits, 246 | SIMD64bits, 247 | CACHEABILITY_CONTROL, 248 | FP_INTEGER_CONVERSION, 249 | SPECIALIZED_128bits, 250 | SIMD_FP_PACKED, 251 | SIMD_FP_HORIZONTAL , 252 | AGENT_SYNCHRONISATION, 253 | PACKED_ALIGN_RIGHT , 254 | PACKED_SIGN, 255 | PACKED_BLENDING_INSTRUCTION, 256 | PACKED_TEST, 257 | PACKED_MINMAX, 258 | HORIZONTAL_SEARCH, 259 | PACKED_EQUALITY, 260 | STREAMING_LOAD, 261 | INSERTION_EXTRACTION, 262 | DOT_PRODUCT, 263 | SAD_INSTRUCTION, 264 | ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ 265 | ROUND_INSTRUCTION 266 | 267 | }; 268 | 269 | enum EFLAGS_STATES 270 | { 271 | TE_ = 1, 272 | MO_ = 2, 273 | RE_ = 4, 274 | SE_ = 8, 275 | UN_ = 0x10, 276 | PR_ = 0x20 277 | }; 278 | 279 | enum BRANCH_TYPE 280 | { 281 | JO = 1, 282 | JC = 2, 283 | JE = 3, 284 | JA = 4, 285 | JS = 5, 286 | JP = 6, 287 | JL = 7, 288 | JG = 8, 289 | JB = 2, /* JC == JB */ 290 | JECXZ = 10, 291 | JmpType = 11, 292 | CallType = 12, 293 | RetType = 13, 294 | JNO = -1, 295 | JNC = -2, 296 | JNE = -3, 297 | JNA = -4, 298 | JNS = -5, 299 | JNP = -6, 300 | JNL = -7, 301 | JNG = -8, 302 | JNB = -2 /* JNC == JNB */ 303 | }; 304 | 305 | enum ARGUMENTS_TYPE 306 | { 307 | NO_ARGUMENT = 0x10000000, 308 | REGISTER_TYPE = 0x20000000, 309 | MEMORY_TYPE = 0x40000000, 310 | CONSTANT_TYPE = (UInt32)0x80000000, 311 | 312 | MMX_REG = 0x10000, 313 | GENERAL_REG = 0x20000, 314 | FPU_REG = 0x40000, 315 | SSE_REG = 0x80000, 316 | CR_REG = 0x100000, 317 | DR_REG = 0x200000, 318 | SPECIAL_REG = 0x400000, 319 | MEMORY_MANAGEMENT_REG = 0x800000, 320 | SEGMENT_REG = 0x1000000, 321 | AVX_REG = 0x2000000, 322 | MPX_REG = 0x4000000, 323 | RELATIVE_ = 0x4000000, 324 | ABSOLUTE_ = 0x8000000, 325 | 326 | READ = 0x1, 327 | WRITE = 0x2, 328 | 329 | REG0 = 0x1, 330 | REG1 = 0x2, 331 | REG2 = 0x4, 332 | REG3 = 0x8, 333 | REG4 = 0x10, 334 | REG5 = 0x20, 335 | REG6 = 0x40, 336 | REG7 = 0x80, 337 | REG8 = 0x100, 338 | REG9 = 0x200, 339 | REG10 = 0x400, 340 | REG11 = 0x800, 341 | REG12 = 0x1000, 342 | REG13 = 0x2000, 343 | REG14 = 0x4000, 344 | REG15 = 0x8000 345 | }; 346 | 347 | enum SPECIAL_INFO 348 | { 349 | UNKNOWN_OPCODE = -1, 350 | OUT_OF_BLOCK = 0, 351 | 352 | /* === mask = 0xff */ 353 | NoTabulation = 0x00000000, 354 | Tabulation = 0x00000001, 355 | 356 | /* === mask = 0xff00 */ 357 | MasmSyntax = 0x00000000, 358 | GoAsmSyntax = 0x00000100, 359 | NasmSyntax = 0x00000200, 360 | ATSyntax = 0x00000400, 361 | IntrinsicMemSyntax= 0x00000800, 362 | 363 | /* === mask = 0xff0000 */ 364 | PrefixedNumeral = 0x00010000, 365 | SuffixedNumeral = 0x00000000, 366 | 367 | /* === mask = 0xff000000 */ 368 | ShowSegmentRegs = 0x01000000 369 | }; 370 | 371 | 372 | #ifdef __cplusplus 373 | extern "C" { 374 | #endif 375 | 376 | BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm); 377 | BEA_API const__ char* __bea_callspec__ BeaEngineVersion (void); 378 | BEA_API const__ char* __bea_callspec__ BeaEngineRevision (void); 379 | 380 | #ifdef __cplusplus 381 | } 382 | #endif 383 | 384 | 385 | #if defined(__cplusplus) && defined(__BORLANDC__) 386 | }; 387 | using namespace BeaEngine; 388 | #endif 389 | #endif 390 | -------------------------------------------------------------------------------- /beaengine/export.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file export.h 3 | * @author igor.gutnik@gmail.com 4 | * @date Mon Sep 22 09:28:54 2008 5 | * 6 | * @brief This file sets things up for C dynamic library function definitions and 7 | * static inlined functions 8 | * 9 | * This file is part of BeaEngine. 10 | * 11 | * BeaEngine is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * BeaEngine is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with BeaEngine. If not, see . */ 23 | 24 | #ifndef __BEA_EXPORT_H__ 25 | #define __BEA_EXPORT_H__ 26 | 27 | 28 | /* Set up for C function definitions, even when using C++ */ 29 | 30 | #ifdef __cplusplus 31 | #define CPP_VISIBLE_BEGIN extern "C" { 32 | #define CPP_VISIBLE_END } 33 | #else 34 | #define CPP_VISIBLE_BEGIN 35 | #define CPP_VISIBLE_END 36 | #endif 37 | 38 | #if defined(_MSC_VER) 39 | #pragma warning( disable: 4251 ) 40 | #endif 41 | 42 | /* Some compilers use a special export keyword */ 43 | #ifndef bea__api_export__ 44 | # if defined(__BEOS__) 45 | # if defined(__GNUC__) 46 | # define bea__api_export__ __declspec(dllexport) 47 | # else 48 | # define bea__api_export__ __declspec(export) 49 | # endif 50 | # elif defined(_WIN32) || defined(_WIN64) 51 | # ifdef __BORLANDC__ 52 | # define bea__api_export__ __declspec(dllexport) 53 | # define bea__api_import__ __declspec(dllimport) 54 | # elif defined(__WATCOMC__) 55 | # define bea__api_export__ __declspec(dllexport) 56 | # define bea__api_import__ 57 | # else 58 | # define bea__api_export__ __declspec(dllexport) 59 | # define bea__api_import__ __declspec(dllimport) 60 | # endif 61 | # elif defined(__OS2__) 62 | # ifdef __WATCOMC__ 63 | # define bea__api_export__ __declspec(dllexport) 64 | # define bea__api_import__ 65 | # else 66 | # define bea__api_export__ 67 | # define bea__api_import__ 68 | # endif 69 | # else 70 | # if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 71 | # define bea__api_export__ __attribubea__ ((visibility("default"))) 72 | # define bea__api_import__ __attribubea__ ((visibility("default"))) 73 | # else 74 | # define bea__api_export__ 75 | # define bea__api_import__ 76 | # endif 77 | # endif 78 | #endif 79 | 80 | /* Use C calling convention by default*/ 81 | 82 | #ifndef __bea_callspec__ 83 | #if defined(BEA_USE_STDCALL) 84 | #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) 85 | #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) 86 | #define __bea_callspec__ __stdcall 87 | #else 88 | #define __bea_callspec__ 89 | #endif 90 | #else 91 | #ifdef __OS2__ 92 | #define __bea_callspec__ _System 93 | #else 94 | #define __bea_callspec__ 95 | #endif 96 | #endif 97 | #else 98 | #define __bea_callspec__ 99 | #endif 100 | #endif 101 | 102 | #ifdef __SYMBIAN32__ 103 | # ifndef EKA2 104 | # undef bea__api_export__ 105 | # undef bea__api_import__ 106 | # define bea__api_export__ 107 | # define bea__api_import__ 108 | # elif !defined(__WINS__) 109 | # undef bea__api_export__ 110 | # undef bea__api_import__ 111 | # define bea__api_export__ __declspec(dllexport) 112 | # define bea__api_import__ __declspec(dllexport) 113 | # endif /* !EKA2 */ 114 | #endif /* __SYMBIAN32__ */ 115 | 116 | 117 | #if defined(__GNUC__) && (__GNUC__ > 2) 118 | #define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) 119 | #define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) 120 | #else 121 | #define BEA_EXPECT_CONDITIONAL(c) (c) 122 | #define BEA_UNEXPECT_CONDITIONAL(c) (c) 123 | #endif 124 | 125 | 126 | /* Set up compiler-specific options for inlining functions */ 127 | #ifndef BEA_HAS_INLINE 128 | #if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) 129 | #define BEA_HAS_INLINE 130 | #else 131 | /* Add any special compiler-specific cases here */ 132 | #if defined(_MSC_VER) || defined(__BORLANDC__) || \ 133 | defined(__DMC__) || defined(__SC__) || \ 134 | defined(__WATCOMC__) || defined(__LCC__) || \ 135 | defined(__DECC) || defined(__EABI__) 136 | #ifndef __inline__ 137 | #define __inline__ __inline 138 | #endif 139 | #define BEA_HAS_INLINE 140 | #else 141 | #if !defined(__MRC__) && !defined(_SGI_SOURCE) 142 | #ifndef __inline__ 143 | #define __inline__ inline 144 | #endif 145 | #define BEA_HAS_INLINE 146 | #endif /* Not a funky compiler */ 147 | #endif /* Visual C++ */ 148 | #endif /* GNU C */ 149 | #endif /* CACHE_HAS_INLINE */ 150 | 151 | /* If inlining isn't supported, remove "__inline__", turning static 152 | inlined functions into static functions (resulting in code bloat 153 | in all files which include the offending header files) 154 | */ 155 | #ifndef BEA_HAS_INLINE 156 | #define __inline__ 157 | #endif 158 | 159 | /* fix a bug with gcc under windows */ 160 | 161 | #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) 162 | #if defined(__MINGW32__) 163 | #define const__ 164 | #else 165 | #define const__ const 166 | #endif 167 | #else 168 | #define const__ const 169 | #endif 170 | 171 | 172 | 173 | #endif 174 | -------------------------------------------------------------------------------- /beaengine/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef __BEAENGINE_MACROS_H__ 2 | #define __BEAENGINE_MACROS_H__ 3 | /* 4 | ============================================================================ 5 | Compiler Silencing macros 6 | 7 | Some compilers complain about parameters that are not used. This macro 8 | should keep them quiet. 9 | ============================================================================ 10 | */ 11 | 12 | # if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) 13 | # define BEA_UNUSED_ARG(a) (void) (a) 14 | #elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__) 15 | /* 16 | Some compilers complain about "statement with no effect" with (a). 17 | This eliminates the warnings, and no code is generated for the null 18 | conditional statement. Note, that may only be true if -O is enabled, 19 | such as with GreenHills (ghs) 1.8.8. 20 | */ 21 | 22 | # define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) 23 | #elif defined (__DMC__) 24 | #if defined(__cplusplus) 25 | #define BEA_UNUSED_ID(identifier) 26 | template 27 | inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { } 28 | #else 29 | #define BEA_UNUSED_ARG(a) 30 | #endif 31 | #else /* ghs || __GNUC__ || ..... */ 32 | # define BEA_UNUSED_ARG(a) (a) 33 | #endif /* ghs || __GNUC__ || ..... */ 34 | 35 | #if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) 36 | # define BEA_NOTREACHED(a) 37 | #else /* __sgi || ghs || ..... */ 38 | # define BEA_NOTREACHED(a) a 39 | #endif /* __sgi || ghs || ..... */ 40 | 41 | #endif /* __BEAENGINE_MACROS_H__ */ 42 | -------------------------------------------------------------------------------- /res/CodMake.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/res/CodMake.ico -------------------------------------------------------------------------------- /res/CodMake.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/res/CodMake.rc2 -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/stdafx.cpp -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/stdafx.h -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fjqisba/CodeMake/83c80b0efd3c3d4bef0d2f5fa4930172f3916a89/targetver.h -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | git add . 2 | git status 3 | git commit -m "content update" 4 | git push --------------------------------------------------------------------------------