From 17c685414cafea156b59b4fbfae1d25d17cf7de6 Mon Sep 17 00:00:00 2001 From: Neal Alexander Date: Sat, 13 Dec 2014 15:46:11 +0100 Subject: [PATCH] Initial commit: 4.1.0.0 --- BeaEngine.cabal | 103 + BeaEngine/ArgType.hsc | 34 + BeaEngine/BeaEngine.hs | 69 + BeaEngine/Constants.hsc | 284 + BeaEngine/Disasm.hsc | 86 + BeaEngine/EFL.hsc | 39 + BeaEngine/InstrType.hsc | 36 + BeaEngine/MemoryType.hsc | 24 + BeaEngine/PrefixInfo.hsc | 51 + BeaEngine/REX.hsc | 21 + LICENSE | 165 + Setup.hs | 2 + csrc/BeaEngine.c | 56 + csrc/CMakeLists.txt | 9 + csrc/COPYING.LESSER.txt | 165 + csrc/COPYING.txt | 674 ++ csrc/Includes/BeaEngineVersion.c | 23 + csrc/Includes/Routines_Disasm.c | 1077 ++++ csrc/Includes/Routines_ModRM.c | 3583 +++++++++++ csrc/Includes/instr_set/Data_opcode.h | 174 + csrc/Includes/instr_set/opcodes_AES.c | 168 + csrc/Includes/instr_set/opcodes_A_M.c | 6731 ++++++++++++++++++++ csrc/Includes/instr_set/opcodes_CLMUL.c | 74 + csrc/Includes/instr_set/opcodes_FPU.c | 1785 ++++++ csrc/Includes/instr_set/opcodes_Grp1.c | 297 + csrc/Includes/instr_set/opcodes_Grp12.c | 195 + csrc/Includes/instr_set/opcodes_Grp13.c | 194 + csrc/Includes/instr_set/opcodes_Grp14.c | 203 + csrc/Includes/instr_set/opcodes_Grp15.c | 166 + csrc/Includes/instr_set/opcodes_Grp16.c | 85 + csrc/Includes/instr_set/opcodes_Grp2.c | 461 ++ csrc/Includes/instr_set/opcodes_Grp3.c | 257 + csrc/Includes/instr_set/opcodes_Grp4.c | 51 + csrc/Includes/instr_set/opcodes_Grp5.c | 153 + csrc/Includes/instr_set/opcodes_Grp6.c | 117 + csrc/Includes/instr_set/opcodes_Grp7.c | 278 + csrc/Includes/instr_set/opcodes_Grp8.c | 70 + csrc/Includes/instr_set/opcodes_Grp9.c | 84 + csrc/Includes/instr_set/opcodes_MMX.c | 1722 +++++ csrc/Includes/instr_set/opcodes_N_Z.c | 3692 +++++++++++ csrc/Includes/instr_set/opcodes_SSE.c | 4570 +++++++++++++ csrc/Includes/instr_set/opcodes_prefixes.c | 239 + csrc/Includes/internal_datas.h | 560 ++ csrc/Includes/protos.h | 705 ++ csrc/README.txt | 30 + include/beaengine/BeaEngine.h | 362 ++ include/beaengine/basic_types.h | 272 + include/beaengine/export.h | 173 + include/beaengine/macros.h | 41 + include/bindings.dsl.custom.h | 365 ++ test/Test_Disasm.hs | 61 + test/Test_Marshal.c | 235 + test/Test_Marshal.hs | 120 + 53 files changed, 31191 insertions(+) create mode 100644 BeaEngine.cabal create mode 100644 BeaEngine/ArgType.hsc create mode 100644 BeaEngine/BeaEngine.hs create mode 100644 BeaEngine/Constants.hsc create mode 100644 BeaEngine/Disasm.hsc create mode 100644 BeaEngine/EFL.hsc create mode 100644 BeaEngine/InstrType.hsc create mode 100644 BeaEngine/MemoryType.hsc create mode 100644 BeaEngine/PrefixInfo.hsc create mode 100644 BeaEngine/REX.hsc create mode 100644 LICENSE create mode 100644 Setup.hs create mode 100644 csrc/BeaEngine.c create mode 100644 csrc/CMakeLists.txt create mode 100644 csrc/COPYING.LESSER.txt create mode 100644 csrc/COPYING.txt create mode 100644 csrc/Includes/BeaEngineVersion.c create mode 100644 csrc/Includes/Routines_Disasm.c create mode 100644 csrc/Includes/Routines_ModRM.c create mode 100644 csrc/Includes/instr_set/Data_opcode.h create mode 100644 csrc/Includes/instr_set/opcodes_AES.c create mode 100644 csrc/Includes/instr_set/opcodes_A_M.c create mode 100644 csrc/Includes/instr_set/opcodes_CLMUL.c create mode 100644 csrc/Includes/instr_set/opcodes_FPU.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp1.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp12.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp13.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp14.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp15.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp16.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp2.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp3.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp4.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp5.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp6.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp7.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp8.c create mode 100644 csrc/Includes/instr_set/opcodes_Grp9.c create mode 100644 csrc/Includes/instr_set/opcodes_MMX.c create mode 100644 csrc/Includes/instr_set/opcodes_N_Z.c create mode 100644 csrc/Includes/instr_set/opcodes_SSE.c create mode 100644 csrc/Includes/instr_set/opcodes_prefixes.c create mode 100644 csrc/Includes/internal_datas.h create mode 100644 csrc/Includes/protos.h create mode 100644 csrc/README.txt create mode 100644 include/beaengine/BeaEngine.h create mode 100644 include/beaengine/basic_types.h create mode 100644 include/beaengine/export.h create mode 100644 include/beaengine/macros.h create mode 100644 include/bindings.dsl.custom.h create mode 100644 test/Test_Disasm.hs create mode 100644 test/Test_Marshal.c create mode 100644 test/Test_Marshal.hs diff --git a/BeaEngine.cabal b/BeaEngine.cabal new file mode 100644 index 0000000..b47d09b --- /dev/null +++ b/BeaEngine.cabal @@ -0,0 +1,103 @@ +name: BeaEngine +version: 4.1.0.0 +synopsis: binding: BeaEngine disassembler +description: + - Direct binding to the C API. + - Symbol names mostly unchanged; prefixed to enforce haskell naming rules. + - BeaEngine library source (LGPL-3) included and statically linked. + - Package version numbering uses convention: C.C.H.H - where C is the underlying version of the C library, and H is the local Haskell binding revision. + +homepage: http://www.beaengine.org/ +license: LGPL-3 +license-file: LICENSE +author: Neal Alexander +maintainer: nhalxr@gmail.com +-- copyright: +category: Disassembler +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + + +extra-source-files: + include/bindings.dsl.custom.h + include/beaengine/basic_types.h + include/beaengine/BeaEngine.h + include/beaengine/export.h + include/beaengine/macros.h + csrc/BeaEngine.c + csrc/CMakeLists.txt + csrc/COPYING.LESSER.txt + csrc/COPYING.txt + csrc/README.txt + csrc/Includes/BeaEngineVersion.c + csrc/Includes/internal_datas.h + csrc/Includes/protos.h + csrc/Includes/Routines_Disasm.c + csrc/Includes/Routines_ModRM.c + csrc/Includes/instr_set/Data_opcode.h + csrc/Includes/instr_set/opcodes_AES.c + csrc/Includes/instr_set/opcodes_A_M.c + csrc/Includes/instr_set/opcodes_CLMUL.c + csrc/Includes/instr_set/opcodes_FPU.c + csrc/Includes/instr_set/opcodes_Grp1.c + csrc/Includes/instr_set/opcodes_Grp12.c + csrc/Includes/instr_set/opcodes_Grp13.c + csrc/Includes/instr_set/opcodes_Grp14.c + csrc/Includes/instr_set/opcodes_Grp15.c + csrc/Includes/instr_set/opcodes_Grp16.c + csrc/Includes/instr_set/opcodes_Grp2.c + csrc/Includes/instr_set/opcodes_Grp3.c + csrc/Includes/instr_set/opcodes_Grp4.c + csrc/Includes/instr_set/opcodes_Grp5.c + csrc/Includes/instr_set/opcodes_Grp6.c + csrc/Includes/instr_set/opcodes_Grp7.c + csrc/Includes/instr_set/opcodes_Grp8.c + csrc/Includes/instr_set/opcodes_Grp9.c + csrc/Includes/instr_set/opcodes_MMX.c + csrc/Includes/instr_set/opcodes_N_Z.c + csrc/Includes/instr_set/opcodes_prefixes.c + csrc/Includes/instr_set/opcodes_SSE.c + +library + exposed-modules: + BeaEngine, + BeaEngine.REX, + BeaEngine.PrefixInfo, + BeaEngine.MemoryType, + BeaEngine.InstrType, + BeaEngine.EFL, + BeaEngine.Disasm, + BeaEngine.Constants, + BeaEngine.ArgType + + c-sources: + csrc/BeaEngine.c + + include-dirs: include/BeaEngine/ + include-dirs: include/ + hs-source-dirs: . + hs-source-dirs: BeaEngine + hs-source-dirs: test + + CC-Options: "-DBEA_ENGINE_STATIC" + + build-depends: base >=4.7 && <4.8, bytestring >= 0.10.4.0 + build-tools: hsc2hs + default-language: Haskell2010 + +Test-Suite test-marshal + type: exitcode-stdio-1.0 + main-is: Test_Marshal.hs + build-depends: base >= 4.7, BeaEngine == 4.1.0.0 + default-language: Haskell2010 + hs-source-dirs: test + c-sources: test/Test_Marshal.c + +Test-Suite test-disasm + type: exitcode-stdio-1.0 + main-is: Test_Disasm.hs + build-depends: base >= 4.7, bytestring >= 0.10.4.0, BeaEngine == 4.1.0.0 + default-language: Haskell2010 + hs-source-dirs: test + \ No newline at end of file diff --git a/BeaEngine/ArgType.hsc b/BeaEngine/ArgType.hsc new file mode 100644 index 0000000..0033b6d --- /dev/null +++ b/BeaEngine/ArgType.hsc @@ -0,0 +1,34 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.ArgType where +import Foreign.Ptr +import Foreign.C.String +import Data.Word +import Data.Int +import Data.List +import BeaEngine.MemoryType +#strict_import + + +{- typedef struct { + char ArgMnemonic[64]; + Int32 ArgType; + Int32 ArgSize; + Int32 ArgPosition; + UInt32 AccessMode; + MEMORYTYPE Memory; + UInt32 SegmentReg; + } ARGTYPE; -} + +#starttype ARGTYPE +#array_field ArgMnemonic , CChar +#field ArgType , Int32 +#field ArgSize , Int32 +#field ArgPosition , Int32 +#field AccessMode , Word32 +#field Memory , +#field SegmentReg , Word32 +#stoptype + +cArgMnemonicS = map castCCharToChar . takeWhile (/=0) . cArgMnemonic diff --git a/BeaEngine/BeaEngine.hs b/BeaEngine/BeaEngine.hs new file mode 100644 index 0000000..6502f5b --- /dev/null +++ b/BeaEngine/BeaEngine.hs @@ -0,0 +1,69 @@ +module BeaEngine + (MachineCode(..),dasm, + module BeaEngine.Disasm, + module BeaEngine.REX, + module BeaEngine.PrefixInfo, + module BeaEngine.MemoryType, + module BeaEngine.InstrType, + module BeaEngine.ArgType, + module BeaEngine.Constants + ) +where +import Foreign.C.String +import Foreign.C.Types +import Foreign +import BeaEngine.Disasm +import BeaEngine.REX +import BeaEngine.PrefixInfo hiding (palignment,calignment) +import BeaEngine.MemoryType +import BeaEngine.InstrType +import BeaEngine.ArgType +import BeaEngine.Constants +import qualified Data.ByteString as B +import qualified Data.ByteString.Internal as B +import System.IO.Unsafe +import Debug.Trace + +data MachineCode = X86_16 { mcd :: B.ByteString } + | X86_32 { mcd :: B.ByteString } + | X86_64 { mcd :: B.ByteString } + + +mcid X86_32{} = 0 +mcid X86_16{} = 16 +mcid X86_64{} = 64 + + + +dasm a b = unsafePerformIO (dasmIO a b) + +dasmIO :: Word32 -> MachineCode -> IO [C_Disasm] +dasmIO options code' = do --allocaBytes (length code) $ \c -> + let (b,bi,bn) = B.toForeignPtr (mcd code') + withForeignPtr b $ \c -> do + alloca $ \d -> do + poke (pArchi d) (fromIntegral $ mcid code') + poke (pOptions d) 0 + + f bn d (fromIntegral $ ptrToIntPtr c) (fromIntegral bi) + + where + + f :: Int -> Ptr C_Disasm -> Word64 -> WordPtr -> IO [C_Disasm] + f codeN d vmbase offset + | limit > 0 = do + poke (pEIP d) (fromIntegral vmbase + offset) + poke (pVirtualAddr d) vmbase + poke (pSecurityBlock d) limit + + n <- cDisasm d + + if (n <= 0) + then error ("disasm: " ++ (show (n,limit,offset))) + else do + v <- peek d + return . (v:) =<< (unsafeInterleaveIO $ f codeN d vmbase (offset + fromIntegral n)) + where + limit = max 0 (fromIntegral $ codeN - (fromIntegral offset)) + + f _ _ _ _ = return [] \ No newline at end of file diff --git a/BeaEngine/Constants.hsc b/BeaEngine/Constants.hsc new file mode 100644 index 0000000..793e16e --- /dev/null +++ b/BeaEngine/Constants.hsc @@ -0,0 +1,284 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.Constants where +import Foreign.Ptr +import Data.Word +import Data.Int +#strict_import + +{- enum INSTRUCTION_TYPE { + GENERAL_PURPOSE_INSTRUCTION = 0x10000, + FPU_INSTRUCTION = 0x20000, + MMX_INSTRUCTION = 0x40000, + SSE_INSTRUCTION = 0x80000, + SSE2_INSTRUCTION = 0x100000, + SSE3_INSTRUCTION = 0x200000, + SSSE3_INSTRUCTION = 0x400000, + SSE41_INSTRUCTION = 0x800000, + SSE42_INSTRUCTION = 0x1000000, + SYSTEM_INSTRUCTION = 0x2000000, + VM_INSTRUCTION = 0x4000000, + UNDOCUMENTED_INSTRUCTION = 0x8000000, + AMD_INSTRUCTION = 0x10000000, + ILLEGAL_INSTRUCTION = 0x20000000, + AES_INSTRUCTION = 0x40000000, + CLMUL_INSTRUCTION = (int) 0x80000000, + DATA_TRANSFER = 0x1, + ARITHMETIC_INSTRUCTION, + LOGICAL_INSTRUCTION, + SHIFT_ROTATE, + BIT_UInt8, + CONTROL_TRANSFER, + STRING_INSTRUCTION, + InOutINSTRUCTION, + ENTER_LEAVE_INSTRUCTION, + FLAG_CONTROL_INSTRUCTION, + SEGMENT_REGISTER, + MISCELLANEOUS_INSTRUCTION, + COMPARISON_INSTRUCTION, + LOGARITHMIC_INSTRUCTION, + TRIGONOMETRIC_INSTRUCTION, + UNSUPPORTED_INSTRUCTION, + LOAD_CONSTANTS, + FPUCONTROL, + STATE_MANAGEMENT, + CONVERSION_INSTRUCTION, + SHUFFLE_UNPACK, + PACKED_SINGLE_PRECISION, + SIMD128bits, + SIMD64bits, + CACHEABILITY_CONTROL, + FP_INTEGER_CONVERSION, + SPECIALIZED_128bits, + SIMD_FP_PACKED, + SIMD_FP_HORIZONTAL, + AGENT_SYNCHRONISATION, + PACKED_ALIGN_RIGHT, + PACKED_SIGN, + PACKED_BLENDING_INSTRUCTION, + PACKED_TEST, + PACKED_MINMAX, + HORIZONTAL_SEARCH, + PACKED_EQUALITY, + STREAMING_LOAD, + INSERTION_EXTRACTION, + DOT_PRODUCT, + SAD_INSTRUCTION, + ACCELERATOR_INSTRUCTION, + ROUND_INSTRUCTION +}; -} + +#integral_t enum INSTRUCTION_TYPE +#num GENERAL_PURPOSE_INSTRUCTION +#num FPU_INSTRUCTION +#num MMX_INSTRUCTION +#num SSE_INSTRUCTION +#num SSE2_INSTRUCTION +#num SSE3_INSTRUCTION +#num SSSE3_INSTRUCTION +#num SSE41_INSTRUCTION +#num SSE42_INSTRUCTION +#num SYSTEM_INSTRUCTION +#num VM_INSTRUCTION +#num UNDOCUMENTED_INSTRUCTION +#num AMD_INSTRUCTION +#num ILLEGAL_INSTRUCTION +#num AES_INSTRUCTION +#num CLMUL_INSTRUCTION +#num DATA_TRANSFER +#num ARITHMETIC_INSTRUCTION +#num LOGICAL_INSTRUCTION +#num SHIFT_ROTATE +#num BIT_UInt8 +#num CONTROL_TRANSFER +#num STRING_INSTRUCTION +#num InOutINSTRUCTION +#num ENTER_LEAVE_INSTRUCTION +#num FLAG_CONTROL_INSTRUCTION +#num SEGMENT_REGISTER +#num MISCELLANEOUS_INSTRUCTION +#num COMPARISON_INSTRUCTION +#num LOGARITHMIC_INSTRUCTION +#num TRIGONOMETRIC_INSTRUCTION +#num UNSUPPORTED_INSTRUCTION +#num LOAD_CONSTANTS +#num FPUCONTROL +#num STATE_MANAGEMENT +#num CONVERSION_INSTRUCTION +#num SHUFFLE_UNPACK +#num PACKED_SINGLE_PRECISION +#num SIMD128bits +#num SIMD64bits +#num CACHEABILITY_CONTROL +#num FP_INTEGER_CONVERSION +#num SPECIALIZED_128bits +#num SIMD_FP_PACKED +#num SIMD_FP_HORIZONTAL +#num AGENT_SYNCHRONISATION +#num PACKED_ALIGN_RIGHT +#num PACKED_SIGN +#num PACKED_BLENDING_INSTRUCTION +#num PACKED_TEST +#num PACKED_MINMAX +#num HORIZONTAL_SEARCH +#num PACKED_EQUALITY +#num STREAMING_LOAD +#num INSERTION_EXTRACTION +#num DOT_PRODUCT +#num SAD_INSTRUCTION +#num ACCELERATOR_INSTRUCTION +#num ROUND_INSTRUCTION +{- enum EFLAGS_STATES { + TE_ = 1, MO_ = 2, RE_ = 4, SE_ = 8, UN_ = 0x10, PR_ = 0x20 +}; -} + +#integral_t enum EFLAGS_STATES +#num TE_ +#num MO_ +#num RE_ +#num SE_ +#num UN_ +#num PR_ +{- enum BRANCH_TYPE { + JO = 1, + JC = 2, + JE = 3, + JA = 4, + JS = 5, + JP = 6, + JL = 7, + JG = 8, + JB = 2, + JECXZ = 10, + JmpType = 11, + CallType = 12, + RetType = 13, + JNO = -1, + JNC = -2, + JNE = -3, + JNA = -4, + JNS = -5, + JNP = -6, + JNL = -7, + JNG = -8, + JNB = -2 +}; -} + +#integral_t enum BRANCH_TYPE +#num JO +#num JC +#num JE +#num JA +#num JS +#num JP +#num JL +#num JG +#num JB +#num JECXZ +#num JmpType +#num CallType +#num RetType +#num JNO +#num JNC +#num JNE +#num JNA +#num JNS +#num JNP +#num JNL +#num JNG +#num JNB +{- enum ARGUMENTS_TYPE { + NO_ARGUMENT = 0x10000000, + REGISTER_TYPE = 0x20000000, + MEMORY_TYPE = 0x40000000, + CONSTANT_TYPE = (int) 0x80000000, + MMX_REG = 0x10000, + GENERAL_REG = 0x20000, + FPU_REG = 0x40000, + SSE_REG = 0x80000, + CR_REG = 0x100000, + DR_REG = 0x200000, + SPECIAL_REG = 0x400000, + MEMORY_MANAGEMENT_REG = 0x800000, + SEGMENT_REG = 0x1000000, + RELATIVE_ = 0x4000000, + ABSOLUTE_ = 0x8000000, + READ = 0x1, + WRITE = 0x2, + REG0 = 0x1, + REG1 = 0x2, + REG2 = 0x4, + REG3 = 0x8, + REG4 = 0x10, + REG5 = 0x20, + REG6 = 0x40, + REG7 = 0x80, + REG8 = 0x100, + REG9 = 0x200, + REG10 = 0x400, + REG11 = 0x800, + REG12 = 0x1000, + REG13 = 0x2000, + REG14 = 0x4000, + REG15 = 0x8000 +}; -} +#integral_t enum ARGUMENTS_TYPE +#num NO_ARGUMENT +#num REGISTER_TYPE +#num MEMORY_TYPE +#num CONSTANT_TYPE +#num MMX_REG +#num GENERAL_REG +#num FPU_REG +#num SSE_REG +#num CR_REG +#num DR_REG +#num SPECIAL_REG +#num MEMORY_MANAGEMENT_REG +#num SEGMENT_REG +#num RELATIVE_ +#num ABSOLUTE_ +#num READ +#num WRITE +#num REG0 +#num REG1 +#num REG2 +#num REG3 +#num REG4 +#num REG5 +#num REG6 +#num REG7 +#num REG8 +#num REG9 +#num REG10 +#num REG11 +#num REG12 +#num REG13 +#num REG14 +#num REG15 +{- enum SPECIAL_INFO { + UNKNOWN_OPCODE = -1, + OUT_OF_BLOCK = 0, + NoTabulation = 0x0, + Tabulation = 0x1, + MasmSyntax = 0x0, + GoAsmSyntax = 0x100, + NasmSyntax = 0x200, + ATSyntax = 0x400, + PrefixedNumeral = 0x10000, + SuffixedNumeral = 0x0, + ShowSegmentRegs = 0x1000000 +}; -} +#integral_t enum SPECIAL_INFO +#num UNKNOWN_OPCODE +#num OUT_OF_BLOCK +#num NoTabulation +#num Tabulation +#num MasmSyntax +#num GoAsmSyntax +#num NasmSyntax +#num ATSyntax +#num PrefixedNumeral +#num SuffixedNumeral +#num ShowSegmentRegs diff --git a/BeaEngine/Disasm.hsc b/BeaEngine/Disasm.hsc new file mode 100644 index 0000000..f3089ff --- /dev/null +++ b/BeaEngine/Disasm.hsc @@ -0,0 +1,86 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.Disasm where +import Foreign.Ptr +import Foreign.C.String +import Data.Word +import Data.Int +import Data.List +import BeaEngine.REX +import BeaEngine.PrefixInfo +import BeaEngine.EFL +import BeaEngine.MemoryType +import BeaEngine.InstrType +import BeaEngine.ArgType +import BeaEngine.Constants +#strict_import + + + +{- typedef struct _Disasm { + UIntPtr EIP; + UInt64 VirtualAddr; + UInt32 SecurityBlock; + char CompleteInstr[64]; + UInt32 Archi; + UInt64 Options; + INSTRTYPE Instruction; + ARGTYPE Argument1; + ARGTYPE Argument2; + ARGTYPE Argument3; + PREFIXINFO Prefix; + UInt32 Reserved_[40]; + } DISASM, * PDISASM, * LPDISASM; -} + +#starttype struct _Disasm +#field EIP , WordPtr +#field VirtualAddr , Word64 +#field SecurityBlock , Word32 +#array_field CompleteInstr , CChar +#field Archi , Word32 +#field Options , Word64 +#field Instruction , +#field Argument1 , +#field Argument2 , +#field Argument3 , +#field Prefix , +#array_field Reserved_ , Word32 +#stoptype + +#synonym_t DISASM , +#synonym_t PDISASM , +#synonym_t LPDISASM , + +#ccall Disasm , Ptr -> IO CInt +#ccall BeaEngineVersion , IO CString +#ccall BeaEngineRevision , IO CString + +cCompleteInstrS = map castCCharToChar . takeWhile (/=0) . cCompleteInstr + +beaEngineVersion = peekCString =<< cBeaEngineVersion + +beaEngineRevision = peekCString =<< cBeaEngineRevision + + +disasm :: WordPtr -> Word64 -> WordPtr -> Word32 -> Word64 -> IO (Either Int (Int,C_Disasm)) +disasm eip vma limit arch opt = alloca $ \p -> do + (#poke struct _Disasm, EIP) p eip + (#poke struct _Disasm, VirtualAddr) p vma + (#poke struct _Disasm, SecurityBlock) p limit + (#poke struct _Disasm, Archi) p arch + (#poke struct _Disasm, Options) p opt + + wrap p =<< cDisasm p + + where + wrap p x + | x == cUNKNOWN_OPCODE = return $ Left (fromIntegral x) + | x == cOUT_OF_BLOCK = return $ Left (fromIntegral x) + | otherwise = do + d2 <- peek p + return $ Right (fromIntegral x,d2) + + + + \ No newline at end of file diff --git a/BeaEngine/EFL.hsc b/BeaEngine/EFL.hsc new file mode 100644 index 0000000..1f301e0 --- /dev/null +++ b/BeaEngine/EFL.hsc @@ -0,0 +1,39 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.EFL where +import Foreign.Ptr +import Data.Word +import Data.Int +#strict_import + + +{- typedef struct { + UInt8 OF_; + UInt8 SF_; + UInt8 ZF_; + UInt8 AF_; + UInt8 PF_; + UInt8 CF_; + UInt8 TF_; + UInt8 IF_; + UInt8 DF_; + UInt8 NT_; + UInt8 RF_; + UInt8 alignment; + } EFLStruct; -} + +#starttype EFLStruct +#field OF_ , Word8 +#field SF_ , Word8 +#field ZF_ , Word8 +#field AF_ , Word8 +#field PF_ , Word8 +#field CF_ , Word8 +#field TF_ , Word8 +#field IF_ , Word8 +#field DF_ , Word8 +#field NT_ , Word8 +#field RF_ , Word8 +#field alignment , Word8 +#stoptype \ No newline at end of file diff --git a/BeaEngine/InstrType.hsc b/BeaEngine/InstrType.hsc new file mode 100644 index 0000000..fd17548 --- /dev/null +++ b/BeaEngine/InstrType.hsc @@ -0,0 +1,36 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.InstrType where +import Foreign.Ptr +import Foreign.C.String +import Data.Word +import Data.Int +import Data.List +import BeaEngine.EFL +#strict_import + + +{- typedef struct { + Int32 Category; + Int32 Opcode; + char Mnemonic[16]; + Int32 BranchType; + EFLStruct Flags; + UInt64 AddrValue; + Int64 Immediat; + UInt32 ImplicitModifiedRegs; + } INSTRTYPE; -} + +#starttype INSTRTYPE +#field Category , Int32 +#field Opcode , Int32 +#array_field Mnemonic , CChar +#field BranchType , Int32 +#field Flags , +#field AddrValue , Word64 +#field Immediat , Int64 +#field ImplicitModifiedRegs , Word32 +#stoptype + +cMnemonicS = map castCCharToChar . takeWhile (/=0) . cMnemonic diff --git a/BeaEngine/MemoryType.hsc b/BeaEngine/MemoryType.hsc new file mode 100644 index 0000000..9e1febb --- /dev/null +++ b/BeaEngine/MemoryType.hsc @@ -0,0 +1,24 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.MemoryType where +import Foreign.Ptr +import Data.Word +import Data.Int +#strict_import + + + +{- typedef struct { + Int32 BaseRegister; + Int32 IndexRegister; + Int32 Scale; + Int64 Displacement; + } MEMORYTYPE; -} + +#starttype MEMORYTYPE +#field BaseRegister , Int32 +#field IndexRegister , Int32 +#field Scale , Int32 +#field Displacement , Int64 +#stoptype diff --git a/BeaEngine/PrefixInfo.hsc b/BeaEngine/PrefixInfo.hsc new file mode 100644 index 0000000..a87d11a --- /dev/null +++ b/BeaEngine/PrefixInfo.hsc @@ -0,0 +1,51 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.PrefixInfo where +import Foreign.Ptr +import Data.Word +import Data.Int +import BeaEngine.REX +#strict_import + + + +{- typedef struct { + int Number; + int NbUndefined; + UInt8 LockPrefix; + UInt8 OperandSize; + UInt8 AddressSize; + UInt8 RepnePrefix; + UInt8 RepPrefix; + UInt8 FSPrefix; + UInt8 SSPrefix; + UInt8 GSPrefix; + UInt8 ESPrefix; + UInt8 CSPrefix; + UInt8 DSPrefix; + UInt8 BranchTaken; + UInt8 BranchNotTaken; + REX_Struct REX; + char alignment[2]; + } PREFIXINFO; -} + +#starttype PREFIXINFO +#field Number , CInt +#field NbUndefined , CInt +#field LockPrefix , Word8 +#field OperandSize , Word8 +#field AddressSize , Word8 +#field RepnePrefix , Word8 +#field RepPrefix , Word8 +#field FSPrefix , Word8 +#field SSPrefix , Word8 +#field GSPrefix , Word8 +#field ESPrefix , Word8 +#field CSPrefix , Word8 +#field DSPrefix , Word8 +#field BranchTaken , Word8 +#field BranchNotTaken , Word8 +#field REX , +#array_field alignment , CChar +#stoptype diff --git a/BeaEngine/REX.hsc b/BeaEngine/REX.hsc new file mode 100644 index 0000000..1639cde --- /dev/null +++ b/BeaEngine/REX.hsc @@ -0,0 +1,21 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +#include +#include +module BeaEngine.REX where +import Foreign.Ptr +import Data.Word +import Data.Int +#strict_import + + +{- typedef struct { + UInt8 W_; UInt8 R_; UInt8 X_; UInt8 B_; UInt8 state; + } REX_Struct; -} + +#starttype REX_Struct +#field W_ , Word8 +#field R_ , Word8 +#field X_ , Word8 +#field B_ , Word8 +#field state , Word8 +#stoptype diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e4fa8a --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/csrc/BeaEngine.c b/csrc/BeaEngine.c new file mode 100644 index 0000000..4ef1ca8 --- /dev/null +++ b/csrc/BeaEngine.c @@ -0,0 +1,56 @@ +/* + * BeaEngine 4 - x86 & x86-64 disassembler library + * + * Copyright 2006-2010, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +#include +#include +#include + +#include "beaengine/BeaEngine.h" +#include "Includes/protos.h" +#include "Includes/internal_datas.h" +#include "Includes/instr_set/Data_opcode.h" +#include "Includes/instr_set/opcodes_A_M.c" +#include "Includes/instr_set/opcodes_N_Z.c" +#include "Includes/instr_set/opcodes_Grp1.c" +#include "Includes/instr_set/opcodes_Grp2.c" +#include "Includes/instr_set/opcodes_Grp3.c" +#include "Includes/instr_set/opcodes_Grp4.c" +#include "Includes/instr_set/opcodes_Grp5.c" +#include "Includes/instr_set/opcodes_Grp6.c" +#include "Includes/instr_set/opcodes_Grp7.c" +#include "Includes/instr_set/opcodes_Grp8.c" +#include "Includes/instr_set/opcodes_Grp9.c" +#include "Includes/instr_set/opcodes_Grp12.c" +#include "Includes/instr_set/opcodes_Grp13.c" +#include "Includes/instr_set/opcodes_Grp14.c" +#include "Includes/instr_set/opcodes_Grp15.c" +#include "Includes/instr_set/opcodes_Grp16.c" +#include "Includes/instr_set/opcodes_FPU.c" +#include "Includes/instr_set/opcodes_MMX.c" +#include "Includes/instr_set/opcodes_SSE.c" +#include "Includes/instr_set/opcodes_AES.c" +#include "Includes/instr_set/opcodes_CLMUL.c" +#include "Includes/instr_set/opcodes_prefixes.c" +#include "Includes/Routines_ModRM.c" +#include "Includes/Routines_Disasm.c" +#include "Includes/BeaEngineVersion.c" + +void BeaEngine(void){return;} diff --git a/csrc/CMakeLists.txt b/csrc/CMakeLists.txt new file mode 100644 index 0000000..e8fcb05 --- /dev/null +++ b/csrc/CMakeLists.txt @@ -0,0 +1,9 @@ +set (BEA_SOURCES BeaEngine.c) + +if (optBUILD_DLL) + add_library (${BEA_TARGET} SHARED BeaEngine.c) + set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBUILD_BEA_ENGINE_DLL") +else () + add_library (${BEA_TARGET} STATIC BeaEngine.c) + set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBEA_ENGINE_STATIC") +endif () diff --git a/csrc/COPYING.LESSER.txt b/csrc/COPYING.LESSER.txt new file mode 100644 index 0000000..fc8a5de --- /dev/null +++ b/csrc/COPYING.LESSER.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/csrc/COPYING.txt b/csrc/COPYING.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/csrc/COPYING.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/csrc/Includes/BeaEngineVersion.c b/csrc/Includes/BeaEngineVersion.c new file mode 100644 index 0000000..27bdb00 --- /dev/null +++ b/csrc/Includes/BeaEngineVersion.c @@ -0,0 +1,23 @@ +/* Copyright 2006-2010, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ +const__ char* __bea_callspec__ BeaEngineVersion(void) { + return "4.1"; +} +const__ char* __bea_callspec__ BeaEngineRevision(void) { + return "175"; +} diff --git a/csrc/Includes/Routines_Disasm.c b/csrc/Includes/Routines_Disasm.c new file mode 100644 index 0000000..7659960 --- /dev/null +++ b/csrc/Includes/Routines_Disasm.c @@ -0,0 +1,1077 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +int __bea_callspec__ Disasm (PDISASM pMyDisasm) { + + if (InitVariables(pMyDisasm)) { + (void) AnalyzeOpcode(pMyDisasm); + if (!GV.OutOfBlock) { + FixArgSizeForMemoryOperand(pMyDisasm); + FixREXPrefixes(pMyDisasm); + FillSegmentsRegisters(pMyDisasm); + CompleteInstructionFields(pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + if (GV.SYNTAX_ == ATSyntax) { + BuildCompleteInstructionATSyntax(pMyDisasm); + } + else { + BuildCompleteInstruction(pMyDisasm); + } + #endif + if (GV.ERROR_OPCODE) { + return -1; + } + else { + return (int) (GV.EIP_-(*pMyDisasm).EIP); + } + } + else { + return 0; + } + } + else { + return -1; + } +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ CompleteInstructionFields (PDISASM pMyDisasm) { + + if (((*pMyDisasm).Instruction.BranchType == JmpType) || ((*pMyDisasm).Instruction.BranchType == CallType)) { + (*pMyDisasm).Argument1.AccessMode = READ; + } +} + +/* ==================================================================== + * + * ==================================================================== */ +int __bea_callspec__ InitVariables (PDISASM pMyDisasm) { + + (void) memset (&GV, 0, sizeof (InternalDatas)); + GV.EIP_ = (*pMyDisasm).EIP; + GV.EIP_REAL = GV.EIP_; + GV.EIP_VA = (*pMyDisasm).VirtualAddr; + if ((*pMyDisasm).SecurityBlock != 0) GV.EndOfBlock = GV.EIP_+(*pMyDisasm).SecurityBlock; + GV.OperandSize = 32; + GV.OriginalOperandSize = 32; + GV.AddressSize = 32; + GV.Architecture = (*pMyDisasm).Archi; + (*pMyDisasm).Prefix.Number = 0; + if (GV.Architecture == 64) { + GV.AddressSize = 64; + } + if (GV.Architecture == 16) { + GV.OperandSize = 16; + GV.OriginalOperandSize = 16; + GV.AddressSize = 16; + } + (void) memset (&(*pMyDisasm).Argument1, 0, sizeof (ARGTYPE)); + (void) memset (&(*pMyDisasm).Argument2, 0, sizeof (ARGTYPE)); + (void) memset (&(*pMyDisasm).Argument3, 0, sizeof (ARGTYPE)); + (void) memset (&(*pMyDisasm).Prefix, 0, sizeof (PREFIXINFO)); + (*pMyDisasm).Argument1.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgPosition = LowPosition; + (*pMyDisasm).Argument2.ArgPosition = LowPosition; + (*pMyDisasm).Argument3.ArgPosition = LowPosition; + (*pMyDisasm).Argument1.ArgType = NO_ARGUMENT; + (*pMyDisasm).Argument2.ArgType = NO_ARGUMENT; + (*pMyDisasm).Argument3.ArgType = NO_ARGUMENT; + (*pMyDisasm).Argument2.AccessMode = READ; + (*pMyDisasm).Argument3.AccessMode = READ; + (void) memset (&(*pMyDisasm).Instruction, 0, sizeof (INSTRTYPE)); + GV.TAB_ = (UInt32)(*pMyDisasm).Options & 0xff; + GV.SYNTAX_ = (UInt32)(*pMyDisasm).Options & 0xff00; + GV.FORMATNUMBER = (UInt32)(*pMyDisasm).Options & 0xff0000; + GV.SEGMENTREGS = (UInt32)(*pMyDisasm).Options & 0xff000000; + GV.OutOfBlock = 0; + return 1; +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ FixArgSizeForMemoryOperand (PDISASM pMyDisasm) { + + if (GV.MemDecoration == Arg2byte) { + (*pMyDisasm).Argument2.ArgSize = 8; + } + else if (GV.MemDecoration == Arg2word) { + (*pMyDisasm).Argument2.ArgSize = 16; + } + else if (GV.MemDecoration == Arg2dword) { + (*pMyDisasm).Argument2.ArgSize = 32; + } + else if (GV.MemDecoration == Arg2qword) { + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.MemDecoration == Arg2multibytes) { + (*pMyDisasm).Argument2.ArgSize = 0; + } + else if (GV.MemDecoration == Arg2tbyte) { + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.MemDecoration == Arg2fword) { + (*pMyDisasm).Argument2.ArgSize = 48; + } + else if (GV.MemDecoration == Arg2dqword) { + (*pMyDisasm).Argument2.ArgSize = 128; + } + + + if (GV.MemDecoration == Arg1byte) { + (*pMyDisasm).Argument1.ArgSize = 8; + } + else if (GV.MemDecoration == Arg1word) { + (*pMyDisasm).Argument1.ArgSize = 16; + } + else if (GV.MemDecoration == Arg1dword) { + (*pMyDisasm).Argument1.ArgSize = 32; + } + else if (GV.MemDecoration == Arg1qword) { + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.MemDecoration == Arg1multibytes) { + (*pMyDisasm).Argument1.ArgSize = 0; + } + else if (GV.MemDecoration == Arg1tbyte) { + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.MemDecoration == Arg1fword) { + (*pMyDisasm).Argument1.ArgSize = 48; + } + else if (GV.MemDecoration == Arg1dqword) { + (*pMyDisasm).Argument1.ArgSize = 128; + } + +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ FixREXPrefixes (PDISASM pMyDisasm) { + + (*pMyDisasm).Prefix.REX.W_ = GV.REX.W_; + (*pMyDisasm).Prefix.REX.R_ = GV.REX.R_; + (*pMyDisasm).Prefix.REX.X_ = GV.REX.X_; + (*pMyDisasm).Prefix.REX.B_ = GV.REX.B_; + (*pMyDisasm).Prefix.REX.state = GV.REX.state; + +} + +/* ==================================================================== + * + * ==================================================================== */ +int __bea_callspec__ AnalyzeOpcode (PDISASM pMyDisasm) { + + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)(GV.EIP_)); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + return 1; +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ EbGb(PDISASM pMyDisasm) +{ + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ GbEb(PDISASM pMyDisasm) +{ + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ EvGv(PDISASM pMyDisasm) +{ + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ ExGx(PDISASM pMyDisasm) +{ + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ EvIv(PDISASM pMyDisasm) +{ + if (GV.OperandSize >= 32) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else { + GV.MemDecoration = Arg1dword; + } + GV.ImmediatSize = 32; /* place this instruction before MOD_RM routine to inform it there is an immediat value */ + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+6; + if (!Security(0, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + if (GV.OperandSize == 64) { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) *((Int32*)(UIntPtr) (GV.EIP_-4))); + } + else { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_-4))); + } + #endif + + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_-4)); + } + else { + GV.MemDecoration = Arg1word; + GV.ImmediatSize = 16; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+4; + if (!Security(0, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_-2))); + #endif + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_-2)); + } +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ EvIb(PDISASM pMyDisasm) +{ + Int8 MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.ImmediatSize = 8; + if (GV.OperandSize >= 32) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else { + GV.MemDecoration = Arg1dword; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1)); + if (MyNumber > 0) { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); + } + else { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1))); + } + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1)); + if (MyNumber > 0) { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); + } + else { + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1))); + } + #endif + } + + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + } + else { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); + #endif + + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + } +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ EbIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.ImmediatSize = 8; + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); + #endif + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ Eb(PDISASM pMyDisasm) +{ + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ Ev(PDISASM pMyDisasm) +{ + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ GvEv(PDISASM pMyDisasm) +{ + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + } + else { + GV.MemDecoration = Arg2word; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ GvEb(PDISASM pMyDisasm) +{ + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + } + else { + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 16; + } + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ GxEx(PDISASM pMyDisasm) +{ + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ GvEw(PDISASM pMyDisasm) +{ + GV.MemDecoration = Arg2word; + GV.OriginalOperandSize = GV.OperandSize; + GV.OperandSize = 16; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = GV.OriginalOperandSize; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ ALIb(PDISASM pMyDisasm) +{ + long MyNumber; + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((Int8*)(IntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ eAX_Iv(PDISASM pMyDisasm) +{ + UInt32 MyNumber; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(5, pMyDisasm)) return; + GV.ImmediatSize = 32; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 32; + MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + } + GV.EIP_+= 5; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + GV.ImmediatSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + } + GV.EIP_+= 5; + } + else { + if (!Security(3, pMyDisasm)) return; + GV.ImmediatSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X", (Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + } + GV.EIP_+= 3; + } + +} + +/* ==================================================================== + * + * ==================================================================== */ +int __bea_callspec__ Security(int len, PDISASM pMyDisasm) +{ + if ((GV.EndOfBlock != 0) && (GV.EIP_+(UInt64)len >= GV.EndOfBlock)) { + GV.OutOfBlock = 1; + return 0; + } + return 1; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ FillFlags(PDISASM pMyDisasm, int index) +{ + (*pMyDisasm).Instruction.Flags = EFLAGS_TABLE[index]; +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ CalculateRelativeAddress(UInt64 * pMyAddress, Int64 MyNumber, PDISASM pMyDisasm) +{ + GV.RelativeAddress = 1; + if (GV.EIP_VA != 0) { + *pMyAddress = (UInt64) (GV.EIP_VA+(UInt64) MyNumber); + } + else { + *pMyAddress = (UInt64) (GV.EIP_REAL+(UInt64) MyNumber); + } +} + +/* ==================================================================== + * + * ==================================================================== */ +#ifndef BEA_LIGHT_DISASSEMBLY +size_t __bea_callspec__ CopyFormattedNumber(PDISASM pMyDisasm, char* pBuffer, const char* pFormat, Int64 MyNumber) +{ + size_t i = 0; + if (!strcmp(pFormat,"%.2X")) MyNumber = MyNumber & 0xFF; + if (!strcmp(pFormat,"%.4X")) MyNumber = MyNumber & 0xFFFF; + if (!strcmp(pFormat,"%.8X")) MyNumber = MyNumber & 0xFFFFFFFF; + if (GV.FORMATNUMBER == PrefixedNumeral) { + (void) strcpy(pBuffer, "0x"); + (void) sprintf (pBuffer+2, pFormat, MyNumber); + i += strlen(pBuffer); + } + else { + (void) sprintf (pBuffer+i, pFormat, MyNumber); + i += strlen(pBuffer); + (void) strcpy(pBuffer+i, "h"); + i++; + } + return i; +} +#endif + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ FillSegmentsRegisters(PDISASM pMyDisasm) +{ + if (((*pMyDisasm).Prefix.LockPrefix == InUsePrefix) && !((*pMyDisasm).Argument1.ArgType & MEMORY_TYPE)) { + (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix; + } + if ((*pMyDisasm).Instruction.Category == GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION) { + (*pMyDisasm).Argument1.SegmentReg = ESReg; + (*pMyDisasm).Argument2.SegmentReg = DSReg; + /* =============== override affects Arg2 */ + if ((*pMyDisasm).Argument2.ArgType & MEMORY_TYPE) { + if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = FSReg; + } + else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = GSReg; + } + else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = CSReg; + } + else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = ESReg; + } + else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = SSReg; + } + else { + (*pMyDisasm).Argument2.SegmentReg = DSReg; + } + } + } + else { + if ((*pMyDisasm).Argument1.ArgType & MEMORY_TYPE) { + if (((*pMyDisasm).Argument1.Memory.BaseRegister == REG4) || ((*pMyDisasm).Argument1.Memory.BaseRegister == REG5)) { + (*pMyDisasm).Argument1.SegmentReg = SSReg; + /* ========== override is invalid here */ + if ((*pMyDisasm).Argument2.ArgType != MEMORY_TYPE) { + if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = FSReg; + (*pMyDisasm).Prefix.FSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = GSReg; + (*pMyDisasm).Prefix.GSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = CSReg; + (*pMyDisasm).Prefix.CSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = DSReg; + (*pMyDisasm).Prefix.DSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = ESReg; + (*pMyDisasm).Prefix.ESPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = SSReg; + (*pMyDisasm).Prefix.SSPrefix = InvalidPrefix; + } + } + } + else { + (*pMyDisasm).Argument1.SegmentReg = DSReg; + /* ============= test if there is override */ + if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = FSReg; + } + else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = GSReg; + } + else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = CSReg; + } + else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = ESReg; + } + else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { + (*pMyDisasm).Argument1.SegmentReg = SSReg; + } + } + } + + if ((*pMyDisasm).Argument2.ArgType & MEMORY_TYPE) { + if (((*pMyDisasm).Argument2.Memory.BaseRegister == REG4) || ((*pMyDisasm).Argument2.Memory.BaseRegister == REG5)) { + (*pMyDisasm).Argument2.SegmentReg = SSReg; + /* ========== override is invalid here */ + if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = FSReg; + (*pMyDisasm).Prefix.FSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = GSReg; + (*pMyDisasm).Prefix.GSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = CSReg; + (*pMyDisasm).Prefix.CSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = DSReg; + (*pMyDisasm).Prefix.DSPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = ESReg; + (*pMyDisasm).Prefix.ESPrefix = InvalidPrefix; + } + else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = SSReg; + (*pMyDisasm).Prefix.SSPrefix = InvalidPrefix; + } + } + else { + (*pMyDisasm).Argument2.SegmentReg = DSReg; + /* ============= test if there is override */ + if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = FSReg; + } + else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = GSReg; + } + else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = CSReg; + } + else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = ESReg; + } + else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { + (*pMyDisasm).Argument2.SegmentReg = SSReg; + } + } + } + } +} + +#ifndef BEA_LIGHT_DISASSEMBLY +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ BuildCompleteInstruction(PDISASM pMyDisasm) +{ + size_t i = 0; + /* =============== Copy Instruction Mnemonic */ + + if ((*pMyDisasm).Prefix.RepnePrefix == InUsePrefix) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "repne "); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + if ((*pMyDisasm).Prefix.RepPrefix == InUsePrefix) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "rep "); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + if ((*pMyDisasm).Prefix.LockPrefix == InUsePrefix) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "lock "); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Instruction.Mnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + + /* =============== if TAB = 1, add tabulation */ + if (GV.TAB_ == 1) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, space_tab[i>10 ? 0 : 10-i]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + /* =============== if Arg1.IsMemoryType, add decoration-example == "dword ptr ds:[" */ + if ((GV.MemDecoration >0) && (GV.MemDecoration < 99)) { + if (GV.SYNTAX_ == NasmSyntax) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + } + else { + if (GV.SYNTAX_ == MasmSyntax) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + } + /* =============== add Arg1.Mnemonic */ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); + i++; + } + /* =============== add Arg1.Mnemonic */ + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + + /* =============== if Arg2.Exists and Arg1.Exists , add"," */ + if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); + i += 2; + } + + /* =============== if Arg2.IsMemoryType, add decoration-example == "dword ptr ds:[" */ + if ((GV.MemDecoration >100) && (GV.MemDecoration < 199)) { + GV.MemDecoration -= 100; + if (GV.SYNTAX_ == NasmSyntax) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + } + else { + if (GV.SYNTAX_ == MasmSyntax) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); + i++; + } + } + /* =============== add Arg2.ArgMnemonic */ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); + i++; + } + /* =============== add Arg2.ArgMnemonic */ + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + + + /* =============== if Arg3.Exists */ + if (GV.third_arg != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); + i += 2; + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); + } + + + +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ BuildCompleteInstructionATSyntax(PDISASM pMyDisasm) +{ + size_t i = 0; + /* =============== Copy Instruction Mnemonic */ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr, (char*) &(*pMyDisasm).Instruction.Mnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + + /* =============== suffix the mnemonic */ + if (GV.MemDecoration != 0) { + if (GV.MemDecoration > 99) GV.MemDecoration -= 100; + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[GV.MemDecoration-1]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else { + if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) { + if ((*pMyDisasm).Argument1.ArgSize == 8) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 16) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 32) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 64) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + else if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) { + if ((*pMyDisasm).Argument1.ArgSize == 8) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 16) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 32) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]); + } + else if ((*pMyDisasm).Argument1.ArgSize == 64) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + } + /* =============== if TAB = 1, add tabulation */ + if (GV.TAB_ == 1) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, space_tab[i>10 ? 0 : 10-i]); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + + /* =============== if Arg3.Exists, display it */ + if (GV.third_arg != 0) { + if ((*pMyDisasm).Argument3.ArgType & REGISTER_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); + i++; + } + else if ((*pMyDisasm).Argument3.ArgType & CONSTANT_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); + i++; + } + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + + /* =============== if Arg3.Exists and Arg2.Exists , display " , " */ + if ((GV.third_arg != 0) && (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); + i += 2; + } + + /* =============== if Arg2 exists, display it */ + if (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0) { + if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); + i++; + } + else { + if ((*pMyDisasm).Instruction.BranchType != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*"); + i++; + } + if ((*pMyDisasm).Argument2.ArgType & REGISTER_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); + i++; + } + else if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); + i++; + } + else { + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); + i++; + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + } + } + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + + /* =============== if Arg2.Exists and Arg1.Exists , display " , " */ + if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); + i += 2; + } + + /* =============== if Arg1 exists, display it */ + if (*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) { + if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); + i++; + } + else { + if ((*pMyDisasm).Instruction.BranchType != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*"); + i++; + } + if ((*pMyDisasm).Argument1.ArgType & REGISTER_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); + i++; + } + else if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); + i++; + } + else { + if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); + i++; + if (GV.SEGMENTREGS != 0) { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); + } + else { + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); + } + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } + } + } + (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); + i = strlen((char*) &(*pMyDisasm).CompleteInstr); + } +} +#endif diff --git a/csrc/Includes/Routines_ModRM.c b/csrc/Includes/Routines_ModRM.c new file mode 100644 index 0000000..1d02dee --- /dev/null +++ b/csrc/Includes/Routines_ModRM.c @@ -0,0 +1,3583 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . + * ======================================= + * + * ======================================= */ +void __bea_callspec__ MOD_RM(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) return; + GV.MOD_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7; + if (GV.MOD_ == 0) { + ModRM_0[GV.RM_](pMyArgument, pMyDisasm); + } + else if (GV.MOD_ == 1) { + GV.DECALAGE_EIP++; + ModRM_1[GV.RM_](pMyArgument, pMyDisasm); + } + else if (GV.MOD_ == 2) { + if (GV.AddressSize >= 32) { + GV.DECALAGE_EIP += 4; + } + else { + GV.DECALAGE_EIP += 2; + } + ModRM_2[GV.RM_](pMyArgument, pMyDisasm); + } + else { + ModRM_3[GV.RM_](pMyArgument, pMyDisasm); + } + +} +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Reg_Opcode(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0; + if (!Security(1, pMyDisasm)) return; + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REX.R_ == 1) { + GV.REGOPCODE += 0x8; + } + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 64; + } + else if (GV.SEG_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSEG[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 16; + } + else if (GV.CR_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersCR[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+CR_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 32; + } + else if (GV.DR_ == 1) { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR_AT[GV.REGOPCODE]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR[GV.REGOPCODE]); + #endif + } + (*pMyArgument).ArgType = REGISTER_TYPE+DR_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 32; + } + else if (GV.SSE_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 128; + } + else if (GV.OperandSize == 8) { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[GV.REGOPCODE]; + if (GV.REGOPCODE >= 4) { + (*pMyArgument).ArgPosition = HighPosition; + } + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 8; + } + } + else if (GV.OperandSize == 16) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 16; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 32; + } + else if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.REGOPCODE]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE]; + (*pMyArgument).ArgSize = 64; + } +} +/* ======================================= + * ModRM_0 + * ======================================= */ +void __bea_callspec__ Addr_EAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif + +} +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_ECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif + +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_EDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_EBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif + +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_SIB(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + if (!Security(2, pMyDisasm)) return; + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize >= 32) { + GV.DECALAGE_EIP++; + GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr) (GV.EIP_+2))) & 0x7; + GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0xc0) >> 6; + GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0x38) >> 3; + (void) SIB[GV.SCALE_ ](pMyArgument, 0, pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + Int32 MyNumber; + UInt64 MyAddress; + size_t i = 0; + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize >= 32) { + if (!Security(6, pMyDisasm)) return; + GV.DECALAGE_EIP+=4; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.Architecture == 64) { + MyNumber += 6; + MyNumber += GV.NB_PREFIX; + if (GV.ImmediatSize == 32) { + MyNumber += 4; + } + if (GV.ImmediatSize == 16) { + MyNumber += 2; + } + if (GV.ImmediatSize == 8) { + MyNumber += 1; + } + if ((*pMyDisasm).Instruction.Opcode >= 0x0F3800) { /* add two bytes if opcode is a 3-bytes */ + MyNumber +=2; + } + else if ((*pMyDisasm).Instruction.Opcode >= 0x0100) { /* add one byte if opcode is a 2-bytes */ + MyNumber +=1; + } + CalculateRelativeAddress(&MyAddress, (Int64)MyNumber, pMyDisasm); + (*pMyDisasm).Instruction.AddrValue = MyAddress; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.16llX", (Int64)MyAddress); + #endif + (*pMyArgument).ArgType |= RELATIVE_; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X", (Int64)MyNumber); + #endif + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_ESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + long MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else { + GV.DECALAGE_EIP+=2; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (!Security(2, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.4X", (Int64)MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_EDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + size_t i = 0; + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); + i += 2; + } + #endif + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + #endif +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_EAX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_ECX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = (Int8) *((UInt8*) (UIntPtr)GV.EIP_+2); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else if (GV.AddressSize == 32) { + + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_EDX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_EBX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_SIB_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (!Security(2, pMyDisasm)) return; + if (GV.AddressSize >= 32) { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+3)); + } + else { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + /*#ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); +#endif + *i+=2; */ + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize >= 32) { + GV.DECALAGE_EIP++; + GV.BASE_ = (*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x7; + GV.SCALE_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0xc0) >> 6; + GV.INDEX_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x38) >> 3; + j = i; + i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); + #endif + i += strlen (Registers16Bits[6]); + (*pMyArgument).Memory.BaseRegister = REGS[6]; + + } + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i++; + } + else { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } + +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_EBP_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_ESI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_1 + * ======================================= */ +void __bea_callspec__ Addr_EDI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_EAX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[0]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_ECX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[1]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_EDX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[2]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[6]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_EBX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + (*pMyArgument).Memory.IndexRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ Addr_SIB_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (!Security(2, pMyDisasm)) return; + if (GV.AddressSize >= 32) { + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+3)); + } + else { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + /*#ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); +#endif + *i+=2; */ + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize >= 32) { + GV.DECALAGE_EIP++; + GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x7; + GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0xc0) >> 6; + GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x38) >> 3; + j = i; + i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + i += strlen (Registers16Bits[6]); + } + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i += 1; + } + else { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } + +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_EBP_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_ESI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[6]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[5]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_2 + * ======================================= */ +void __bea_callspec__ Addr_EDI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + size_t i = 0, j; + long MyNumber; + if (GV.AddressSize == 16) { + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); + } + else{ + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); + } + (*pMyArgument).Memory.Displacement = MyNumber; + if (GV.SYNTAX_ == ATSyntax) { + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i ++; + j=i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i+=2; + } + (*pMyArgument).ArgType = MEMORY_TYPE; + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7+8]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[7]; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[3]; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i = strlen ((char*) &(*pMyArgument).ArgMnemonic); + if (GV.SYNTAX_ == ATSyntax) { + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + i += 1; + } + else { + #else + if(1) { + #endif + if (MyNumber < 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i++; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); + #endif + } + } +} + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rEAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[0]; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[1]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[1]; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rEDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[2+0]; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rEBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[3+0]; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rESP(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[4+0]; + (*pMyArgument).ArgPosition = HighPosition; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rEBP(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[5+0]; + (*pMyArgument).ArgPosition = HighPosition; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[6+0]; + (*pMyArgument).ArgPosition = HighPosition; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + + +/* ======================================= + * ModRM_3 + * ======================================= */ +void __bea_callspec__ _rEDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) +{ + int i = 0; + GV.MemDecoration = 0; + if (GV.MMX_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 64; + return; + } + + if (GV.SSE_ == 1) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+8]; + (*pMyArgument).ArgSize = 128; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 128; + } + return; + } + if (GV.OperandSize == 64) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + (*pMyArgument).ArgSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 64; + } + } + else if (GV.OperandSize == 32) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + (*pMyArgument).ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 32; + } + } + else if (GV.OperandSize == 16) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + (*pMyArgument).ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 16; + } + } + else if (GV.OperandSize == 8) { + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+8]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + (*pMyArgument).ArgSize = 8; + } + else { + if (GV.REX.state == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[7+0]; + (*pMyArgument).ArgPosition = HighPosition; + (*pMyArgument).ArgSize = 8; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+0]); + #endif + (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyArgument).ArgSize = 8; + } + } + } +} + + +/* ======================================= + * + * ======================================= */ +size_t __bea_callspec__ SIB_0(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) +{ + + /* ========================= Interpret Base */ + size_t j; + if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { + GV.DECALAGE_EIP += 4; + if (!Security(7, pMyDisasm)) return i; + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); + #endif + (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); + + } + else { + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i += 2; + } + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen(Registers64Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers64Bits[GV.BASE_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers32Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers32Bits[GV.BASE_ +8]); + } + } + } + /* ======================== Interpret Index */ + + + if (GV.INDEX_ != 4 || GV.REX.X_) { + if (GV.SYNTAX_ == ATSyntax) { + if (GV.BASE_ == 5) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); + #endif + i+=3; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i+=1; + } + + if (GV.AddressSize == 64) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers64Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers64Bits[GV.INDEX_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers32Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers32Bits[GV.INDEX_ +8]); + } + } + } + (*pMyArgument).Memory.Scale = 1; + if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i++; + } + return i; +} + +/* ======================================= + * + * ======================================= */ +size_t __bea_callspec__ SIB_1(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) +{ + size_t j; + /* ========================= Interpret Base */ + + if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { + GV.DECALAGE_EIP += 4; + if (!Security(7, pMyDisasm)) return i; + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); + #endif + (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); + } + else { + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i += 2; + } + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers64Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers64Bits[GV.BASE_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers32Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers32Bits[GV.BASE_ +8]); + } + } + } + /* ======================== Interpret Index */ + + if (GV.INDEX_ != 4 || GV.REX.X_) { + if (GV.SYNTAX_ == ATSyntax) { + if (GV.BASE_ == 5) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); + #endif + i+=3; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i+=1; + } + + if (GV.AddressSize == 64) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers64Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers64Bits[GV.INDEX_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers32Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers32Bits[GV.INDEX_ +8]); + } + } + (*pMyArgument).Memory.Scale = 2; + if (GV.SYNTAX_ == ATSyntax) { + if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",2"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*2"); + #endif + + i+=2; + } + } + if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i++; + } + return i; +} + +/* ======================================= + * + * ======================================= */ +size_t __bea_callspec__ SIB_2(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) +{ + size_t j; + /* ========================= Interpret Base */ + + if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { + GV.DECALAGE_EIP += 4; + if (!Security(7, pMyDisasm)) return i; + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); + #endif + (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); + } + else { + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i += 2; + } + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers64Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers64Bits[GV.BASE_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers32Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers32Bits[GV.BASE_ +8]); + } + } + } + /* ======================== Interpret Index */ + + if (GV.INDEX_ != 4) { + if (GV.SYNTAX_ == ATSyntax) { + if (GV.BASE_ == 5) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); + #endif + i+=3; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i+=1; + } + + if (GV.AddressSize == 64) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers64Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers64Bits[GV.INDEX_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers32Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers32Bits[GV.INDEX_ +8]); + } + } + (*pMyArgument).Memory.Scale = 4; + if (GV.SYNTAX_ == ATSyntax) { + if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",4"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*4"); + #endif + i+=2; + } + } + if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i++; + } + return i; +} + +/* ======================================= + * + * ======================================= */ +size_t __bea_callspec__ SIB_3(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) +{ + size_t j; + /* ========================= Interpret Base */ + + if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { + GV.DECALAGE_EIP += 4; + if (!Security(7, pMyDisasm)) return i; + j = i; + #ifndef BEA_LIGHT_DISASSEMBLY + i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); + #endif + (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); + } + else { + + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); + #endif + i += 2; + } + if (GV.AddressSize == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers64Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers64Bits[GV.BASE_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; + i += strlen( Registers32Bits[GV.BASE_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); + #endif + (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; + i += strlen( Registers32Bits[GV.BASE_ +8]); + } + } + } + /* ======================== Interpret Index */ + + if (GV.INDEX_ != 4 || GV.REX.X_) { + if (GV.SYNTAX_ == ATSyntax) { + if (GV.BASE_ == 5) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); + #endif + i+=3; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); + #endif + i+=1; + } + + if (GV.AddressSize == 64) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers64Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers64Bits[GV.INDEX_ +8]); + } + } + else if (GV.AddressSize == 32) { + if (GV.REX.X_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; + i += strlen( Registers32Bits[GV.INDEX_ ]); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); + #endif + (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; + i += strlen( Registers32Bits[GV.INDEX_ +8]); + } + } + (*pMyArgument).Memory.Scale = 8; + if (GV.SYNTAX_ == ATSyntax) { + if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",8"); + #endif + i+=2; + } + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*8"); + #endif + i+=2; + } + } + if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); + #endif + i++; + } + return i; +} diff --git a/csrc/Includes/instr_set/Data_opcode.h b/csrc/Includes/instr_set/Data_opcode.h new file mode 100644 index 0000000..6abac2b --- /dev/null +++ b/csrc/Includes/instr_set/Data_opcode.h @@ -0,0 +1,174 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* =============================================================================== */ +/* */ +/* */ +/* 1 BYTE_OPCODE MAP */ +/* */ +/* */ +/* =============================================================================== */ + +void (__bea_callspec__ * opcode_map1[])(PDISASM) = { + 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 , + 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 , + 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_ , + 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_ , + 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 , + 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 , + pushad_ , popad_ , bound_ , arpl_ , PrefSEGFS , PrefSEGGS , PrefOpSize, PrefAdSize, push_Iv ,imul_GvEvIv, push_Ib ,imul_GvEvIb, insb_ , ins_ , outsb_ , outsw_ , + jo_ , jno_ , jc_ , jnc_ , je_ , jne_ , jbe_ , jnbe_ , js_ , jns_ , jp_ , jnp_ , jl_ , jnl_ , jle_ , jnle_ , + 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 , + nop_ , xchg_ecx , xchg_edx , xchg_ebx , xchg_esp , xchg_ebp , xchg_esi , xchg_edi , cwde_ , cdq_ , callf_ , wait_ , pushfd_ , popfd_ , sahf_ , lahf_ , + mov_ALOb , mov_eAXOv , mov_ObAL , mov_OveAX , movs_ , movsw_ , cmpsb_ , cmps_ , test_ALIb ,test_eAX_Iv, stos_ , stosw_ , lodsb_ , lodsw_ , scasb_ , scas_ , + 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 , + G2_EbIb , G2_EvIb , retn_ , ret_ , les_GvM , lds_GvM , mov_EbIb , mov_EvIv , enter_ , leave_ , retf_Iw , retf_ , int3_ , int_ , into_ , iret_ , + G2_Eb1 , G2_Ev1 , G2_EbCL , G2_EvCL , aam_ , aad_ , salc_ , xlat_ , D8_ , D9_ , DA_ , DB_ , DC_ , DD_ , DE_ , DF_ , + 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 , + PrefLock , int1_ , PrefREPNE , PrefREPE , hlt_ , cmc_ , G3_Eb , G3_Ev , clc_ , stc_ , cli_ , sti_ , cld_ , std_ , G4_Eb , G5_Ev , + }; + +/* =============================================================================== */ +/* */ +/* */ +/* 2 BYTE_OPCODE MAP --> 0F xx */ +/* */ +/* */ +/* =============================================================================== */ +void (__bea_callspec__ *opcode_map2[])(PDISASM) = { + G6_ , G7_ , lar_GvEw , lsl_GvEw , FailDecode, syscall_ , clts_ , sysret_ , invd_ , wbinvd_ , FailDecode, ud2_ , FailDecode, nop_Ev , femms_ , FailDecode, + movups_VW , movups_WV , movlps_VM , movlps_MV , unpcklps_ , unpckhps_ , movhps_VM , movhps_MV , G16_ , hint_nop , hint_nop , hint_nop , hint_nop , hint_nop , hint_nop , nop_Ev , + mov_RdCd , mov_RdDd , mov_CdRd , mov_DdRd , FailDecode, FailDecode, FailDecode, FailDecode, movaps_VW , movaps_WV , cvtpi2ps_ , movntps_ , cvttps2pi_, cvtps2pi_ , ucomiss_VW, comiss_VW , + wrmsr_ , rdtsc_ , rdmsr_ , rdpmc_ , sysenter_ , sysexit_ , FailDecode, FailDecode,Esc_tableA4, FailDecode,Esc_tableA5, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + cmovo_ , cmovno_ , cmovb_ , cmovnb_ , cmove_ , cmovne_ , cmovbe_ , cmovnbe_ , cmovs_ , cmovns_ , cmovp_ , cmovnp_ , cmovl_ , cmovnl_ , cmovle_ , cmovnle_ , + 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 , + punpcklbw_, punpcklwd_, punpckldq_, packsswb_ , pcmpgtb_ , pcmpgtw_ , pcmpgtd_ , packuswb_ , punpckhbw_, punpckhwd_, punpckhdq_, packssdw_ ,punpcklqdq_,punpckhqdq_, movd_PE , movq_PQ , + pshufw_ , G12_ , G13_ , G14_ , pcmpeqb_ , pcmpeqw_ , pcmpeqd_ , emms_ , vmread_ , vmwrite_ , FailDecode, FailDecode, haddpd_VW , hsubpd_VW , movd_EP , movq_QP , + 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 , + seto_ , setno_ , setb_ , setnb_ , sete_ , setne_ , setbe_ , setnbe_ , sets_ , setns_ , setp_ , setnp_ , setnge_ , setge_ , setle_ , setnle_ , + 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 , + 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, + 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 , + addsubpd_ , psrlw_ , psrld_ , psrlq_ , paddq_ , pmullw_ , movq_WV , pmovmskb_ , psubusb_ , psubusw_ , pminub_ , pand_ , paddusb_ , paddusw_ , pmaxub_ , pandn_ , + pavgb_ , psraw_ , psrad_ , pavgw_ , pmulhuw_ , pmulhw_ , cvtpd2dq_ , movntq_ , psubsb_ , psubsw_ , pminsw_ , por_ , paddsb_ , paddsw_ , pmaxsw_ , pxor_ , + lddqu_ , psllw_ , pslld_ , psllq_ , pmuludq_ , pmaddwd_ , psadbw_ , maskmovq_ , psubb_ , psubw_ , psubd_ , psubq_ , paddb_ , paddw_ , paddd_ , FailDecode, + }; + +/* =============================================================================== */ +/* */ +/* */ +/* 3 BYTE_OPCODE MAP --> 0F 38 xx */ +/* */ +/* */ +/* =============================================================================== */ + void (__bea_callspec__ *opcode_map3[])(PDISASM) = { + pshufb_ , phaddw_ , phaddd_ , phaddsw_ , pmaddubsw_, phsubw_ , phsubd_ , phsubsw_ , psignb_ , psignw_ , psignd_ , pmulhrsw_ , FailDecode, FailDecode, FailDecode, FailDecode, + pblendvb_ , FailDecode, FailDecode, FailDecode, blendvps_ , blendvpd_ , FailDecode, ptest_ , FailDecode, FailDecode, FailDecode, FailDecode, pabsb_ , pabsw_ , pabsd_ , FailDecode, + pmovsxbw_ , pmovsxbd_ , pmovsxbq_ , pmovsxwd_ , pmovsxwq_ , pmovsxdq_ , FailDecode, FailDecode, pmuldq_ , pcmpeqq_ , movntdqa_ , packusdw_ , FailDecode, FailDecode, FailDecode, FailDecode, + pmovzxbw_ , pmovzxbd_ , pmovzxbq_ , pmovzxwd_ , pmovzxwq_ , pmovzxdq_ , FailDecode, pcmpgtq_ , pminsb_ , pminsd_ , pminuw_ , pminud_ , pmaxsb_ , pmaxsd_ , pmaxuw_ , pmaxud_ , + pmulld_ ,phminposuw_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aesimc , aesenc , aesenclast, aesdec , aesdeclast, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + crc32_GvEb, crc32_GvEv, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + }; + +/* =============================================================================== */ +/* */ +/* */ +/* 3 UInt8_OPCODE MAP --> 0F 3A xx */ +/* */ +/* */ +/* =============================================================================== */ + void (__bea_callspec__ *opcode_map4[])(PDISASM) = { + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, roundps_ , roundpd_ , roundss_ , roundsd_ , blendps_ , blendpd_ , pblendw_ , palignr_ , + FailDecode, FailDecode, FailDecode, FailDecode, pextrb_ , pextrw2_ , pextrd_ , extractps_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + pinsrb_ , insertps_ , pinsrd_ , FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + dpps_ , dppd_ , mpsadbw_ , FailDecode, pclmulqdq_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + pcmpestrm_, pcmpestri_, pcmpistrm_, pcmpistri_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aeskeygen , + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, + }; + + +void (__bea_callspec__ *ModRM_0[])(ARGTYPE*, PDISASM) = { + Addr_EAX, + Addr_ECX, + Addr_EDX, + Addr_EBX, + Addr_SIB, + Addr_disp32, + Addr_ESI, + Addr_EDI, + }; + + void (__bea_callspec__ *ModRM_1[])(ARGTYPE*, PDISASM) = { + Addr_EAX_disp8, + Addr_ECX_disp8, + Addr_EDX_disp8, + Addr_EBX_disp8, + Addr_SIB_disp8, + Addr_EBP_disp8, + Addr_ESI_disp8, + Addr_EDI_disp8, + }; + + void (__bea_callspec__ *ModRM_2[])(ARGTYPE*, PDISASM) = { + Addr_EAX_disp32, + Addr_ECX_disp32, + Addr_EDX_disp32, + Addr_EBX_disp32, + Addr_SIB_disp32, + Addr_EBP_disp32, + Addr_ESI_disp32, + Addr_EDI_disp32, + }; + + void (__bea_callspec__ *ModRM_3[])(ARGTYPE*, PDISASM) = { + _rEAX, + _rECX, + _rEDX, + _rEBX, + _rESP, + _rEBP, + _rESI, + _rEDI, + }; + +size_t (__bea_callspec__ *SIB[])(ARGTYPE*, size_t, PDISASM) = { + SIB_0, + SIB_1, + SIB_2, + SIB_3, + }; diff --git a/csrc/Includes/instr_set/opcodes_AES.c b/csrc/Includes/instr_set/opcodes_AES.c new file mode 100644 index 0000000..e474184 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_AES.c @@ -0,0 +1,168 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0x 0f 38 db + * ==================================================================== */ +void __bea_callspec__ aesimc(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesimc "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 dc + * ==================================================================== */ +void __bea_callspec__ aesenc(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenc "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 dd + * ==================================================================== */ +void __bea_callspec__ aesenclast(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenclast "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 de + * ==================================================================== */ +void __bea_callspec__ aesdec(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdec "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 df + * ==================================================================== */ +void __bea_callspec__ aesdeclast(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdeclast "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 3a df + * ==================================================================== */ +void __bea_callspec__ aeskeygen(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aeskeygenassist "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} diff --git a/csrc/Includes/instr_set/opcodes_A_M.c b/csrc/Includes/instr_set/opcodes_A_M.c new file mode 100644 index 0000000..217aaac --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_A_M.c @@ -0,0 +1,6731 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +void __bea_callspec__ FailDecode(PDISASM pMyDisasm) +{ + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "??? "); +#endif + GV.ERROR_OPCODE = 1; +} +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ aaa_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Archi == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aaa "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + GV.EIP_++; + }; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ aad_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Archi == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aad "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + if (!Security(1, pMyDisasm)) return; + GV.ImmediatSize = 8; + if (*((UInt8*)(UIntPtr) (GV.EIP_+1)) != 0x0A) { + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); + #endif + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + GV.EIP_+=2; + }; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ aam_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Archi == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aam "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + if (!Security(1, pMyDisasm)) return; + GV.ImmediatSize = 8; + if (*((UInt8*)(UIntPtr) (GV.EIP_+1)) != 0x0A) { + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); + #endif + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + GV.EIP_+=2; + }; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ aas_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Archi == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aas "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + GV.EIP_++; + }; +} + +/* ======================================= + * 00h + * ======================================= */ +void __bea_callspec__ add_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 01h + * ======================================= */ +void __bea_callspec__ add_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 02h + * ======================================= */ +void __bea_callspec__ add_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 03h + * ======================================= */ +void __bea_callspec__ add_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 04h + * ======================================= */ +void __bea_callspec__ add_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 05h + * ======================================= */ +void __bea_callspec__ add_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,5); +} + +/* ======================================= + * 10h + * ======================================= */ +void __bea_callspec__ adc_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 11h + * ======================================= */ +void __bea_callspec__ adc_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 12h + * ======================================= */ +void __bea_callspec__ adc_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 13h + * ======================================= */ +void __bea_callspec__ adc_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 14h + * ======================================= */ +void __bea_callspec__ adc_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 15h + * ======================================= */ +void __bea_callspec__ adc_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,4); +} + +/* ======================================= + * 20h + * ======================================= */ +void __bea_callspec__ and_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * 21h + * ======================================= */ +void __bea_callspec__ and_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * 22h + * ======================================= */ +void __bea_callspec__ and_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * 23h + * ======================================= */ +void __bea_callspec__ and_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * 24h + * ======================================= */ +void __bea_callspec__ and_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * 25h + * ======================================= */ +void __bea_callspec__ and_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,6); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ arpl_(PDISASM pMyDisasm) +{ + + if (GV.Architecture == 64) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsxd "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,69); + } + else { + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "arpl "); + #endif + GV.OperandSize = 16; + EvGv(pMyDisasm); + GV.OperandSize = 32; + FillFlags(pMyDisasm,7); + } + +} + +/* ======================================= + * 62h + * ======================================= */ +void __bea_callspec__ bound_(PDISASM pMyDisasm) +{ + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bound "); + #endif + GvEv(pMyDisasm); + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,8); + } + +} + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_eax(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_ecx(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_edx(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_ebx(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_esp(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_ebp(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_esi(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + + +/* ======================================= + * 0fc8h + * ======================================= */ +void __bea_callspec__ bswap_edi(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); + #endif + if (GV.OperandSize == 64) { + (*pMyDisasm).Argument1.ArgSize = 64; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + } + } + else if (GV.OperandSize == 32){ + (*pMyDisasm).Argument1.ArgSize = 32; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + } + } + else { + (*pMyDisasm).Argument1.ArgSize = 16; + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + } + } + GV.EIP_++; + FillFlags(pMyDisasm,10); + +} + +/* ======================================= + * 0fbch + * ======================================= */ +void __bea_callspec__ bsf_GvEv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bsf "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,9); +} + +/* ======================================= + * 0fbdh + * ======================================= */ +void __bea_callspec__ bsr_GvEv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bsr "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,9); +} + +/* ======================================= + * 0fbbh + * ======================================= */ +void __bea_callspec__ btc_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); + #endif + EvGv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,11); +} + +/* ======================================= + * 0fa3h + * ======================================= */ +void __bea_callspec__ bt_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); + #endif + EvGv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,11); +} + +/* ======================================= + * 0fb3h + * ======================================= */ +void __bea_callspec__ btr_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); + #endif + EvGv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,11); +} + +/* ======================================= + * 0fabh + * ======================================= */ +void __bea_callspec__ bts_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); + #endif + EvGv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,11); +} + +/* ======================================= + * e8h + * ======================================= */ +void __bea_callspec__ call_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = CallType; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1))+5+GV.NB_PREFIX; + CalculateRelativeAddress(&MyAddress,(Int64) MyNumber, pMyDisasm); + (*pMyDisasm).Instruction.AddrValue = MyAddress; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + if (MyAddress >= 0x80000000) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1))+3+GV.NB_PREFIX; + CalculateRelativeAddress(&MyAddress,(Int64) MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ callf_(PDISASM pMyDisasm) +{ + UInt32 MyNumber; + UInt64 MyAddress; + size_t i = 0; + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = CallType; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic,"\x24"); + #endif + i++; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); + #endif + } + if (GV.OperandSize ==32) { + if (!Security(7, pMyDisasm)) return; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+5)); + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); + #endif + } + else { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+3)); + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); + #endif + } + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " , \x24"); + #endif + i+=4; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " : "); + #endif + i+=3; + } + MyAddress = MyNumber*16; + MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + if (GV.OperandSize == 16) { + MyNumber = MyNumber & 0xffff; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.8X",(Int64) MyNumber); + #endif + if (GV.OperandSize == 32) { + GV.EIP_+=7; + } + else { + GV.EIP_+=5; + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + (*pMyDisasm).Instruction.AddrValue = MyAddress + MyNumber; + } +} + +/* ======================================= + * 99h + * ======================================= */ +void __bea_callspec__ cdq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + if (GV.OperandSize == 64) { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cqto "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cqo "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize ==32) { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cltd "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cdq "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwtd "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwd "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ clts_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clts "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 17); + GV.EIP_++; +} + + +/* ======================================= + * F5h + * ======================================= */ +void __bea_callspec__ cmc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmc "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 18); + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovo_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovo "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovno_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovno "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovb "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovnb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnb "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmove_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmove "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovne_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovne "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovbe_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovbe "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovnbe_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnbe "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovs_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovs "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovns_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovns "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovp_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovp "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovnp_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnp "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovl_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovl "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovnl_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnl "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovle_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovle "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmovnle_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnle "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm, 19); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmpx_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,22); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cmpx_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,22); +} + +/* ======================================= + * 38h + * ======================================= */ +void __bea_callspec__ cmp_EbGb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + EbGb(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * 39h + * ======================================= */ +void __bea_callspec__ cmp_EvGv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + EvGv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * 3ah + * ======================================= */ +void __bea_callspec__ cmp_GbEb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + GbEb(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * 3bh + * ======================================= */ +void __bea_callspec__ cmp_GvEv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + GvEv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * 3ch + * ======================================= */ +void __bea_callspec__ cmp_ALIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + ALIb(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * 3dh + * ======================================= */ +void __bea_callspec__ cmp_eAX_Iv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + eAX_Iv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm,20); +} + +/* ======================================= + * a6h + * ======================================= */ +void __bea_callspec__ cmpsb_(PDISASM pMyDisasm) +{ + + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsb "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + FillFlags(pMyDisasm,21); + GV.EIP_++; +} + +/* ======================================= + * a7h + * ======================================= */ +void __bea_callspec__ cmps_(PDISASM pMyDisasm) +{ + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + if (GV.Architecture == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsq "); + #endif + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsd "); + #endif + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsw "); + #endif + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + FillFlags(pMyDisasm,21); + GV.EIP_++; +} + +/* ======================================= + * 98h + * ======================================= */ +void __bea_callspec__ cwde_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + if (GV.OperandSize == 64) { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cltq "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cdqe "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwtl "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwde "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cbtw "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cbw "); + #endif + } + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; +} + +/* ======================================= + * f8h + * ======================================= */ +void __bea_callspec__ clc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clc "); + #endif + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 14); + GV.EIP_++; +} + +/* ======================================= + * f8h + * ======================================= */ +void __bea_callspec__ cld_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cld "); + #endif + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 15); + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ cli_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cli "); + #endif + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 16); + GV.EIP_++; +} + +/* ======================================= + * 0fa2h + * ======================================= */ +void __bea_callspec__ cpuid_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cpuid "); + #endif + (*pMyDisasm).Argument1.ArgSize = 32; + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ daa_(PDISASM pMyDisasm) +{ + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "daa "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + FillFlags(pMyDisasm,28); + GV.EIP_++; + } + +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ das_(PDISASM pMyDisasm) +{ + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "das "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + FillFlags(pMyDisasm,29); + GV.EIP_++; + } + +} + +/* ======================================= + * 48h + * ======================================= */ +void __bea_callspec__ dec_eax(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 0; + GV.REX.X_ = 0; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 49h + * ======================================= */ +void __bea_callspec__ dec_ecx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 0; + GV.REX.X_ = 0; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4ah + * ======================================= */ +void __bea_callspec__ dec_edx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 0; + GV.REX.X_ = 1; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4bh + * ======================================= */ +void __bea_callspec__ dec_ebx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 0; + GV.REX.X_ = 1; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4ch + * ======================================= */ +void __bea_callspec__ dec_esp(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 1; + GV.REX.X_ = 0; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4dh + * ======================================= */ +void __bea_callspec__ dec_ebp(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 1; + GV.REX.X_ = 0; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4eh + * ======================================= */ +void __bea_callspec__ dec_esi(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 1; + GV.REX.X_ = 1; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 4fh + * ======================================= */ +void __bea_callspec__ dec_edi(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 1; + GV.REX.R_ = 1; + GV.REX.X_ = 1; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + GV.OperandSize = 64; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 30); + } +} + +/* ======================================= + * 0c8h + * ======================================= */ +void __bea_callspec__ enter_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "enter "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber (pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic,"%.4X",(Int64) *((UInt16*)(UIntPtr) (GV.EIP_+1))); + #endif + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber (pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+3))); + #endif + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + GV.EIP_+=4; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ femms_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = AMD_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "femms "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ hlt_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hlt "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ invd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invd "); + #endif + GV.EIP_++; +} + +/* ======================================= + * 40h + * ======================================= */ +void __bea_callspec__ inc_eax(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 0; + GV.REX.X_ = 0; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 41h + * ======================================= */ +void __bea_callspec__ inc_ecx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 0; + GV.REX.X_ = 0; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 42h + * ======================================= */ +void __bea_callspec__ inc_edx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 0; + GV.REX.X_ = 1; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 43h + * ======================================= */ +void __bea_callspec__ inc_ebx(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 0; + GV.REX.X_ = 1; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 44h + * ======================================= */ +void __bea_callspec__ inc_esp(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 1; + GV.REX.X_ = 0; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 45h + * ======================================= */ +void __bea_callspec__ inc_ebp(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 1; + GV.REX.X_ = 0; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 46h + * ======================================= */ +void __bea_callspec__ inc_esi(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 1; + GV.REX.X_ = 1; + GV.REX.B_ = 0; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} + +/* ======================================= + * 47h + * ======================================= */ +void __bea_callspec__ inc_edi(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + if (!Security(0, pMyDisasm)) return; + GV.REX.W_ = 0; + GV.REX.R_ = 1; + GV.REX.X_ = 1; + GV.REX.B_ = 1; + GV.REX.state = InUsePrefix; + GV.EIP_++; + GV.NB_PREFIX++; + (*pMyDisasm).Prefix.Number++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; + + } + else { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; + (*pMyDisasm).Argument1.ArgSize = 16; + } + GV.EIP_++; + FillFlags(pMyDisasm, 40); + } +} +/* ======================================= + * 0xcf + * ======================================= */ +void __bea_callspec__ iret_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = RetType; + if (GV.OperandSize ==64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretq "); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretd "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretw "); + #endif + } + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ in_ALDX(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ in_ALIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); + #endif + ALIb(pMyDisasm); +} + +/* ======================================= + * 0xe5 + * ======================================= */ +void __bea_callspec__ in_eAX_Ib(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); + #endif + if (!Security(1, pMyDisasm)) return; + GV.ImmediatSize = 8; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_+=2; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ insb_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insb "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; + FillFlags(pMyDisasm, 41); + + +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ ins_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + if (GV.OperandSize >= 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insd "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; + FillFlags(pMyDisasm, 41); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insw "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; + FillFlags(pMyDisasm, 41); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ into_(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "into "); + #endif + GV.EIP_++; + FillFlags(pMyDisasm, 43); + } +} + +/* ======================================= + * 0edh + * ======================================= */ +void __bea_callspec__ in_eAX(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); + #endif + if (GV.OperandSize >=32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 16; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 16; + } + GV.EIP_++; +} + +/* ======================================= + * 0cdh + * ======================================= */ +void __bea_callspec__ int_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int "); + #endif + if (!Security(1, pMyDisasm)) return; + GV.ImmediatSize = 8; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument1.ArgSize = 8; + GV.EIP_+=2; + FillFlags(pMyDisasm, 42); +} + +/* ======================================= + * 0f1h + * ======================================= */ +void __bea_callspec__ int1_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int1 "); + #endif + GV.EIP_++; + FillFlags(pMyDisasm, 42); +} + +/* ======================================= + * 0cch + * ======================================= */ +void __bea_callspec__ int3_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int3 "); + #endif + GV.EIP_++; + FillFlags(pMyDisasm, 42); +} + +/* ======================================= + * 69h + * ======================================= */ +void __bea_callspec__ imul_GvEvIv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); + #endif + if (GV.OperandSize >= 32) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else { + GV.MemDecoration = Arg2dword; + } + GV.ImmediatSize = 32; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+6; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_- 4)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_- 4))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 32; + + FillFlags(pMyDisasm, 38); + } + else { + GV.MemDecoration = Arg2word; + GV.ImmediatSize = 16; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+4; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_- 2)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.4X",(Int64) *((UInt16*)(UIntPtr) (GV.EIP_- 2))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 16; + + FillFlags(pMyDisasm, 38); + } +} + +/* ======================================= + * 6bh + * ======================================= */ +void __bea_callspec__ imul_GvEvIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); + #endif + if (GV.OperandSize >= 32) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else { + GV.MemDecoration = Arg2dword; + } + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + FillFlags(pMyDisasm, 38); + } + else { + GV.MemDecoration = Arg2word; + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + FillFlags(pMyDisasm, 38); + } +} + +/* ======================================= + * 0fafh + * ======================================= */ +void __bea_callspec__ imul_GvEv(PDISASM pMyDisasm) +{ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,38); +} + +/* ======================================= + * 70h + * ======================================= */ +void __bea_callspec__ jo_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JO; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jo "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,116); +} + +/* ======================================= + * 71h + * ======================================= */ +void __bea_callspec__ jno_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNO; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jno "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,116); +} + +/* ======================================= + * 72h + * ======================================= */ +void __bea_callspec__ jc_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JC; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jc "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,117); +} + +/* ======================================= + * 73h + * ======================================= */ +void __bea_callspec__ jnc_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNC; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnc "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,117); +} +/* ======================================= + * 74h + * ======================================= */ +void __bea_callspec__ je_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "je "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,118); +} + +/* ======================================= + * 75h + * ======================================= */ +void __bea_callspec__ jne_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jne "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,49); +} + +/* ======================================= + * 76h + * ======================================= */ +void __bea_callspec__ jbe_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNA; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jbe "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,119); +} + +/* ======================================= + * 77h + * ======================================= */ +void __bea_callspec__ jnbe_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JA; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnbe "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,119); +} + +/* ======================================= + * 78h + * ======================================= */ +void __bea_callspec__ js_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "js "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,120); +} + +/* ======================================= + * 79h + * ======================================= */ +void __bea_callspec__ jns_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jns "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,120); +} + +/* ======================================= + * 7ah + * ======================================= */ +void __bea_callspec__ jp_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JP; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jp "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,121); +} + +/* ======================================= + * 7bh + * ======================================= */ +void __bea_callspec__ jnp_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNP; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnp "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,121); +} + +/* ======================================= + * 7ch + * ======================================= */ +void __bea_callspec__ jl_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jl "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,122); +} + +/* ======================================= + * 7dh + * ======================================= */ +void __bea_callspec__ jnl_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnl "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,122); +} + +/* ======================================= + * 7eh + * ======================================= */ +void __bea_callspec__ jle_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNG; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jle "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,115); +} + +/* ======================================= + * 7fh + * ======================================= */ +void __bea_callspec__ jnle_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + signed long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JG; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnle "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,115); +} + + +/* ======================================= + * 0f80h + * ======================================= */ +void __bea_callspec__ jo_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JO; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jo "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,116); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,116); + } +} + + +/* ======================================= + * 0f81h + * ======================================= */ +void __bea_callspec__ jno_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNO; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jno "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,116); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,116); + } +} + +/* ======================================= + * 0f82h + * ======================================= */ +void __bea_callspec__ jc_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JC; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jc "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,117); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,117); + } +} + +/* ======================================= + * 0f83h + * ======================================= */ +void __bea_callspec__ jnc_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNC; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnc "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,117); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,117); + } +} + +/* ======================================= + * 0f84h + * ======================================= */ +void __bea_callspec__ je_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JE; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "je "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,118); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} + +/* ======================================= + * 0f85h + * ======================================= */ +void __bea_callspec__ jne_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNE; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jne "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,49); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} +/* ======================================= + * 0f86h + * ======================================= */ +void __bea_callspec__ jbe_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNA; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jbe "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,49); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} + + +/* ======================================= + * 0f87h + * ======================================= */ +void __bea_callspec__ ja_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JA; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ja "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,119); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,119); + } +} + +/* ======================================= + * 0f88h + * ======================================= */ +void __bea_callspec__ js_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JS; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "js "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,120); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} + +/* ======================================= + * 0f89h + * ======================================= */ +void __bea_callspec__ jns_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNS; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jns "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,120); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} + +/* ======================================= + * 0f8ah + * ======================================= */ +void __bea_callspec__ jp_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JP; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jp "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,121); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,49); + } +} + +/* ======================================= + * 0f8bh + * ======================================= */ +void __bea_callspec__ jnp_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNP; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnp "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,121); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,121); + } +} + +/* ======================================= + * 0f8ch + * ======================================= */ +void __bea_callspec__ jl_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JL; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jl "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,122); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,122); + } +} + +/* ======================================= + * 0f8dh + * ======================================= */ +void __bea_callspec__ jnl_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNL; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnl "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,122); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,122); + } +} + +/* ======================================= + * 0f8eh + * ======================================= */ +void __bea_callspec__ jle_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + Int32 MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNG; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jng "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,115); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,115); + } +} + +/* ======================================= + * 0f8fh + * ======================================= */ +void __bea_callspec__ jnle_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + Int64 MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JG; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jg "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,115); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,115); + } +} + +/* ======================================= + * 0e3h + * ======================================= */ +void __bea_callspec__ jecxz_(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + Int64 MyNumber; + if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; + } + if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { + (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; + (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JECXZ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + if (GV.AddressSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jrcxz "); + #endif + } + else if (GV.AddressSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jecxz "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jcxz "); + #endif + } + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,49); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,49); + } +} + +/* ======================================= + * 0e9h + * ======================================= */ +void __bea_callspec__ jmp_near(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JmpType; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); + #endif + if (GV.OperandSize >= 32) { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+5+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=5; + FillFlags(pMyDisasm,51); + } + else { + if (!Security(3, pMyDisasm)) return; + MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+3+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=3; + FillFlags(pMyDisasm,51); + } +} + + +/* ======================================= + * 0ebh + * ======================================= */ +void __bea_callspec__ jmp_short(PDISASM pMyDisasm) +{ + UInt64 MyAddress = 0; + signed long MyNumber = 0; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JmpType; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); + #endif + if (!Security(1, pMyDisasm)) return; + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm,49); +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ jmp_far(PDISASM pMyDisasm) +{ + UInt32 MyNumber; + UInt64 MyAddress; + size_t i = 0; + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JmpType; + (*pMyDisasm).Argument1.AccessMode = READ; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic,"\x24"); + #endif + i++; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); + #endif + } + if (GV.OperandSize ==32) { + if (!Security(7, pMyDisasm)) return; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+5)); + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); + #endif + } + else { + if (!Security(5, pMyDisasm)) return; + MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+3)); + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); + #endif + } + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " , \x24"); + #endif + i+=4; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " : "); + #endif + i+=3; + } + MyAddress = MyNumber*16; + MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + if (GV.OperandSize == 16) { + MyNumber = MyNumber & 0xffff; + } + #ifndef BEA_LIGHT_DISASSEMBLY + i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.8X",(Int64) MyNumber); + #endif + if (GV.OperandSize == 32) { + GV.EIP_+=7; + } + else { + GV.EIP_+=5; + } + (*pMyDisasm).Instruction.AddrValue = MyAddress + MyNumber; + FillFlags(pMyDisasm,51); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lahf_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lahf "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lar_GvEw(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lar "); + #endif + GvEw(pMyDisasm); + FillFlags(pMyDisasm, 53); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lds_GvM(PDISASM pMyDisasm) +{ + /* if MOD == 11b, invalid instruction */ + /* or VEX Prefix - implemented in next release (AVX) */ + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lds "); + #endif + if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2fword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } +} + +/* ======================================= + * 0c9h + * ======================================= */ +void __bea_callspec__ leave_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "leave "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG5; + (*pMyDisasm).Argument2.ArgSize = 32; + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lea_GvM(PDISASM pMyDisasm) +{ + + /* if MOD == 11b, invalid instruction */ + /* or VEX Prefix - implemented in next release (AVX) */ + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lea "); + #endif + if (GV.OperandSize >= 32) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else { + GV.MemDecoration = Arg2dword; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + (*pMyDisasm).Argument2.AccessMode = 0; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ les_GvM(PDISASM pMyDisasm) +{ + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "les "); + #endif + if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2fword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } +} + +/* ======================================= + * 0ach + * ======================================= */ +void __bea_callspec__ lodsb_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; + GV.EIP_++; + FillFlags(pMyDisasm, 59); +} + +/* ======================================= + * 0adh + * ======================================= */ +void __bea_callspec__ lodsw_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsq "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; + GV.EIP_++; + FillFlags(pMyDisasm, 59); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; + GV.EIP_++; + FillFlags(pMyDisasm, 59); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsw "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; + GV.EIP_++; + FillFlags(pMyDisasm, 59); + } +} + +/* ======================================= + * 0e2h + * ======================================= */ +void __bea_callspec__ loop_(PDISASM pMyDisasm) +{ + signed long MyNumber; + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loop "); + #endif + if (!Security(1, pMyDisasm)) return; + if (GV.OperandSize >= 32) { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 60); + } + else { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 60); + } +} + +/* ======================================= + * 0xe0 + * ======================================= */ +void __bea_callspec__ loopne_(PDISASM pMyDisasm) +{ + signed long MyNumber; + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JNE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loopne "); + #endif + if (!Security(1, pMyDisasm)) return; + if (GV.OperandSize >= 32) { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 61); + } + else { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 61); + + } +} + +/* ======================================= + * 0xe1 + * ======================================= */ +void __bea_callspec__ loope_(PDISASM pMyDisasm) +{ + signed long MyNumber; + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loope "); + #endif + if (!Security(1, pMyDisasm)) return; + if (GV.OperandSize >= 32) { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + if (MyAddress >= W64LIT (0x100000000)) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + } + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 61); + } + else { + MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); + CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); + MyAddress = MyAddress & 0xffff; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; + (*pMyDisasm).Instruction.AddrValue = MyAddress; + GV.EIP_+=2; + FillFlags(pMyDisasm, 61); + + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lsl_GvEw(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lsl "); + #endif + GvEw(pMyDisasm); + FillFlags(pMyDisasm, 62); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lss_Mp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lss "); + #endif + GvEv(pMyDisasm); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lfs_Mp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfs "); + #endif + GvEv(pMyDisasm); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ lgs_Mp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgs "); + #endif + GvEv(pMyDisasm); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ mov_RdCd(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + if (GV.MOD_== 3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.CR_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.CR_ = 0; + FillFlags(pMyDisasm,67); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ mov_RdDd(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + if (GV.MOD_== 3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.DR_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.DR_ = 0; + FillFlags(pMyDisasm,67); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ mov_CdRd(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_== 3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.CR_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.CR_ = 0; + FillFlags(pMyDisasm,67); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ mov_DdRd(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_== 3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.DR_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.DR_ = 0; + FillFlags(pMyDisasm,67); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * 88h + * ======================================= */ +void __bea_callspec__ mov_EbGb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + EbGb(pMyDisasm); +} + +/* ======================================= + * 89h + * ======================================= */ +void __bea_callspec__ mov_EvGv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + EvGv(pMyDisasm); +} + +/* ======================================= + * 8ah + * ======================================= */ +void __bea_callspec__ mov_GbEb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GbEb(pMyDisasm); +} + +/* ======================================= + * 8bh + * ======================================= */ +void __bea_callspec__ mov_GvEv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GvEv(pMyDisasm); +} + +/* ======================================= + * 0a0h + * ======================================= */ +void __bea_callspec__ mov_ALOb(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.MemDecoration = Arg2byte; + GV.RM_ = 5; + GV.MOD_= 0; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE ; + (*pMyDisasm).Argument2.ArgSize = 8; + if (GV.AddressSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + else if (GV.AddressSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0+8]); + #endif + } + +} + +/* ======================================= + * 0a1h + * ======================================= */ +void __bea_callspec__ mov_eAXOv(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.RM_ = 5; + GV.MOD_= 0; + if (GV.AddressSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + else if (GV.AddressSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + } + else { + GV.MemDecoration = Arg2word; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); + #endif + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); + #endif + } + else { + GV.MemDecoration = Arg2word; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); + #endif + } + } + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE ; + if (GV.MemDecoration == 104) { + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.MemDecoration == 103) { + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else if (GV.MemDecoration == 102) { + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + +} + +/* ======================================= + * 0a2h + * ======================================= */ +void __bea_callspec__ mov_ObAL(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.MemDecoration = Arg1byte; + GV.RM_ = 5; + GV.MOD_= 0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE ; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgSize = 8; + if (GV.AddressSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + else if (GV.AddressSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0+8]); + #endif + } + +} + +/* ======================================= + * 0a3h + * ======================================= */ +void __bea_callspec__ mov_OveAX(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.RM_ = 5; + GV.MOD_= 0; + if (GV.AddressSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + else if (GV.AddressSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0]); + #endif + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); + #endif + } + else { + GV.MemDecoration = Arg1word; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); + #endif + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0+8]); + #endif + } + else { + GV.MemDecoration = Arg1word; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0+8]); + #endif + } + } + + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE ; + if (GV.MemDecoration == Arg1qword) { + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.MemDecoration == Arg1dword) { + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else if (GV.MemDecoration == Arg1word) { + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + +/* ======================================= + * 0b0h + * ======================================= */ +void __bea_callspec__ mov_ALIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + ALIb(pMyDisasm); +} + +/* ======================================= + * 0b1h + * ======================================= */ +void __bea_callspec__ mov_CLIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[1]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b2h + * ======================================= */ +void __bea_callspec__ mov_DLIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b3h + * ======================================= */ +void __bea_callspec__ mov_BLIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b4h + * ======================================= */ +void __bea_callspec__ mov_AHIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgPosition = HighPosition; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b5h + * ======================================= */ +void __bea_callspec__ mov_CHIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[5]); + #endif + (*pMyDisasm).Argument1.ArgPosition = HighPosition; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b6h + * ======================================= */ +void __bea_callspec__ mov_DHIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[6]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument1.ArgPosition = HighPosition; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * 0b7h + * ======================================= */ +void __bea_callspec__ mov_BHIb(PDISASM pMyDisasm) +{ + long MyNumber; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[7]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument1.ArgPosition = HighPosition; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + + +/* ======================================= + * 0a4h + * ======================================= */ +void __bea_callspec__ movs_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsb "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 68); +} + +/* ======================================= + * 0a5h + * ======================================= */ +void __bea_callspec__ movsw_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsq "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 68); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 68); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsw "); + #endif + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 68); + } +} + +/* ======================================= + * 0fb6h + * ======================================= */ +void __bea_callspec__ movzx_GvEb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movzx "); + #endif + GvEb(pMyDisasm); +} + + +/* ======================================= + * 0fbeh + * ======================================= */ +void __bea_callspec__ movsx_GvEb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsx "); + #endif + GvEb(pMyDisasm); +} + +/* ======================================= + * 0fbfh + * ======================================= */ +void __bea_callspec__ movsx_GvEw(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsx "); + #endif + GvEw(pMyDisasm); +} + +/* ======================================= + * 0fb7h + * ======================================= */ +void __bea_callspec__ movzx_GvEw(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movzx "); + #endif + GvEw(pMyDisasm); +} + +/* ======================================= + * 0b8h + * ======================================= */ +void __bea_callspec__ mov_EAX(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); + #endif + } + } + +} + +/* ======================================= + * 0b9h + * ======================================= */ +void __bea_callspec__ mov_ECX(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0bah + * ======================================= */ +void __bea_callspec__ mov_EDX(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0bbh + * ======================================= */ +void __bea_callspec__ mov_EBX(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0bch + * ======================================= */ +void __bea_callspec__ mov_ESP(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0bdh + * ======================================= */ +void __bea_callspec__ mov_EBP(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG5; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0beh + * ======================================= */ +void __bea_callspec__ mov_ESI(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG6; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0+8]); + #endif + } + } + +} + +/* ======================================= + * 0bfh + * ======================================= */ +void __bea_callspec__ mov_EDI(PDISASM pMyDisasm) +{ + UInt64 MyAddress; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG7; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + if (GV.OperandSize == 64) { + if (!Security(9, pMyDisasm)) return; + MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); + #endif + GV.EIP_+=9; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); + #endif + GV.EIP_+=5; + (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + if (!Security(3, pMyDisasm)) return; + MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); + #endif + GV.EIP_+=3; + (*pMyDisasm).Instruction.Immediat = (Int64) MyAddress; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + if (GV.REX.B_ == 0) { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); + #endif + } + } + else { + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0+8]); + #endif + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0+8]); + #endif + } + } + +} +/* ======================================= + * 0c6h-Group 11 + * ======================================= */ +void __bea_callspec__ mov_EbIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + EbIb(pMyDisasm); + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * 0c7h-Group 11 + * ======================================= */ +void __bea_callspec__ mov_EvIv(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + EvIv(pMyDisasm); + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * 08ch + * ======================================= */ +void __bea_callspec__ mov_EwSreg(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.MemDecoration = Arg1word; + GV.OperandSize = 16; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.SEG_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SEG_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ======================================= + * 08eh + * ======================================= */ +void __bea_callspec__ mov_SregEw(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); + #endif + GV.MemDecoration = Arg2word; + GV.OperandSize = 16; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.SEG_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SEG_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+2; +} diff --git a/csrc/Includes/instr_set/opcodes_CLMUL.c b/csrc/Includes/instr_set/opcodes_CLMUL.c new file mode 100644 index 0000000..22960ee --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_CLMUL.c @@ -0,0 +1,74 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0x 0f 3a 44 + * ==================================================================== */ +void __bea_callspec__ pclmulqdq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = CLMUL_INSTRUCTION; + + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + + if ((*pMyDisasm).Instruction.Immediat == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqlqdq "); + #endif + } + else if ((*pMyDisasm).Instruction.Immediat == 0x01 ) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqlqdq "); + #endif + } + else if ((*pMyDisasm).Instruction.Immediat == 0x10 ) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqhqdq "); + #endif + } + else if ((*pMyDisasm).Instruction.Immediat == 0x011 ) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqhqdq "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulqdq "); + #endif + GV.third_arg = 1; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + } + } + else { + FailDecode(pMyDisasm); + } +} diff --git a/csrc/Includes/instr_set/opcodes_FPU.c b/csrc/Includes/instr_set/opcodes_FPU.c new file mode 100644 index 0000000..c5eb280 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_FPU.c @@ -0,0 +1,1785 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ D8_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + GV.MemDecoration = Arg2dword; + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 3) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 4) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xf0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ D9_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2multibytes; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldenv "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldcw "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg1multibytes; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstenv "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstcw "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if ((MyMODRM & 0xf) ==0) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnop "); + #endif + } + else if (((MyMODRM & 0xf) >=0x8) && ((MyMODRM & 0xf) <=0xf)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp1 "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if ((MyMODRM & 0xf) ==0) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fchs "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==1) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fabs "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==4) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ftst "); + #endif + } + else if ((MyMODRM & 0xf) ==5) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxam "); + #endif + } + else if ((MyMODRM & 0xf) ==8) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld1 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + + } + else if ((MyMODRM & 0xf) ==9) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldl2t "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xa) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldl2e "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xb) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldpi "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xc) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldlg2 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + + else if ((MyMODRM & 0xf) ==0xd) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldln2 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xe) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldz "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 80; + } + + else { + FailDecode(pMyDisasm); + } + } + else if ((MyMODRM & 0xf0) == 0xf0) { + if ((MyMODRM & 0xf) ==0) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "f2xm1 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==1) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fyl2x "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==2) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fptan "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==3) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fpatan "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==4) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxtract "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==5) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fprem1 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==6) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdecstp "); + #endif + } + else if ((MyMODRM & 0xf) ==7) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fincstp "); + #endif + } + else if ((MyMODRM & 0xf) ==8) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fprem "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==9) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fyl2xp1 "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xa) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsqrt "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xb) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsincos "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xc) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frndint "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xd) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fscale "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xe) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsin "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf) ==0xf) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcos "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DA_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fiadd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fimul "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficom "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficomp "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisub "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisubr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidiv "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidivr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovb "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmove "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovbe "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovu "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + + } + else if (MyMODRM == 0xe9) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucompp "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DB_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fist "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2tbyte; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg1tbyte; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnb "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovne "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnbe "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnu "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xe0) { + + if ((MyMODRM & 0xf) ==0) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fneni "); + #endif + } + else if ((MyMODRM & 0xf) ==1) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fndisi "); + #endif + } + else if ((MyMODRM & 0xf) ==2) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnclex "); + #endif + } + else if ((MyMODRM & 0xf) ==3) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fninit "); + #endif + } + else if ((MyMODRM & 0xf) ==4) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnsetpm "); + #endif + } + else if ((MyMODRM & 0xf) ==5) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frstpm "); + #endif + } + else if (((MyMODRM & 0xf) >=0x8) && ((MyMODRM & 0xf) <=0xf)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomi "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else if ((MyMODRM & 0xf0) == 0xf0) { + if (((MyMODRM & 0xf) >=0x0) && ((MyMODRM & 0xf) <=0x7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomi "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DC_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + (*pMyDisasm).Argument1.AccessMode = READ; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); + #endif + (*pMyDisasm).Argument1.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom2 "); + #endif + + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp3 "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xf0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + + } + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DD_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg1qword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg1qword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg1qword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2multibytes; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frstor "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 108*8; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg1multibytes; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsave "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 108*8; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstsw "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG; + (*pMyDisasm).Argument2.ArgSize = 16; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ffree "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch4 "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucom "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomp "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + + } + + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DE_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fiadd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fimul "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficom "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficomp "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisub "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisubr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidiv "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidivr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "faddp "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmulp "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp5 "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (MyMODRM == 0xd9){ + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcompp "); + #endif + } + else { + FailDecode(pMyDisasm); + } + + + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubrp "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubp "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xf0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivrp "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivp "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + + } + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ DF_(PDISASM pMyDisasm) +{ + long MyMODRM; + char (*pRegistersFPU)[8][8] ; + + GV.DECALAGE_EIP = 0; + if (!Security(1, pMyDisasm)) {return;} + MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + pRegistersFPU = &RegistersFPU_Masm; + if (GV.SYNTAX_ == NasmSyntax) { + pRegistersFPU = &RegistersFPU_Nasm; + } + if (MyMODRM <= 0xbf) { + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 1) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fist "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2multibytes; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fbld "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg1multibytes; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fbstp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else if (GV.REGOPCODE == 7) { + GV.MemDecoration = Arg1qword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if ((MyMODRM & 0xf0) == 0xc0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ffreep "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch7 "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + } + else if ((MyMODRM & 0xf0) == 0xd0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp8 "); + #endif + } + else { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp9 "); + #endif + (*pMyDisasm).Argument2.AccessMode = WRITE; + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument1.ArgSize = 80; + + } + else if ((MyMODRM & 0xf0) == 0xe0) { + if (MyMODRM == 0xe0) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstsw "); + #endif + } + else if ((MyMODRM & 0xf) >=8) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomip "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + + + else { + FailDecode(pMyDisasm); + } + } + + else if ((MyMODRM & 0xf0) == 0xf0) { + if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomip "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 80; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; + (*pMyDisasm).Argument2.ArgSize = 80; + } + else { + FailDecode(pMyDisasm); + } + + } + else { + FailDecode(pMyDisasm); + } + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} diff --git a/csrc/Includes/instr_set/opcodes_Grp1.c b/csrc/Includes/instr_set/opcodes_Grp1.c new file mode 100644 index 0000000..c939bcb --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp1.c @@ -0,0 +1,297 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 80h + * ==================================================================== */ +void __bea_callspec__ G1_EbIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EbIb(pMyDisasm); + if (GV.REGOPCODE == 0) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + FillFlags(pMyDisasm, 5); + } + else if (GV.REGOPCODE == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + FillFlags(pMyDisasm, 74); + } + else if (GV.REGOPCODE == 2) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + FillFlags(pMyDisasm, 4); + } + else if (GV.REGOPCODE == 3) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + FillFlags(pMyDisasm, 93); + } + else if (GV.REGOPCODE == 4) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + FillFlags(pMyDisasm, 6); + } + else if (GV.REGOPCODE == 5) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + FillFlags(pMyDisasm, 103); + } + + else if (GV.REGOPCODE == 6) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + FillFlags(pMyDisasm, 113); + } + + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + FillFlags(pMyDisasm, 20); + (*pMyDisasm).Argument1.AccessMode = READ; + } +} + +/* ==================================================================== + * 82h + * ==================================================================== */ +void __bea_callspec__ G1_EbIb2(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + G1_EbIb(pMyDisasm); + } +} + +/* ==================================================================== + * 81h + * ==================================================================== */ +void __bea_callspec__ G1_EvIv(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EvIv(pMyDisasm); + if (GV.REGOPCODE == 0) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + FillFlags(pMyDisasm, 5); + } + else if (GV.REGOPCODE == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + FillFlags(pMyDisasm, 74); + } + else if (GV.REGOPCODE == 2) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + FillFlags(pMyDisasm, 4); + } + else if (GV.REGOPCODE == 3) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + FillFlags(pMyDisasm, 93); + } + else if (GV.REGOPCODE == 4) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + FillFlags(pMyDisasm, 6); + } + else if (GV.REGOPCODE == 5) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + FillFlags(pMyDisasm, 103); + } + + else if (GV.REGOPCODE == 6) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + FillFlags(pMyDisasm, 113); + } + + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + FillFlags(pMyDisasm, 20); + (*pMyDisasm).Argument1.AccessMode = READ; + } +} + +/* ==================================================================== + * 83h + * ==================================================================== */ +void __bea_callspec__ G1_EvIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EvIb(pMyDisasm); + if (GV.REGOPCODE == 0) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); + #endif + FillFlags(pMyDisasm, 5); + } + else if (GV.REGOPCODE == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + FillFlags(pMyDisasm, 74); + } + else if (GV.REGOPCODE == 2) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); + #endif + FillFlags(pMyDisasm, 4); + } + else if (GV.REGOPCODE == 3) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + FillFlags(pMyDisasm, 93); + } + else if (GV.REGOPCODE == 4) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); + #endif + FillFlags(pMyDisasm, 6); + } + else if (GV.REGOPCODE == 5) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + FillFlags(pMyDisasm, 103); + } + + else if (GV.REGOPCODE == 6) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + FillFlags(pMyDisasm, 113); + } + + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); + #endif + FillFlags(pMyDisasm, 20); + (*pMyDisasm).Argument1.AccessMode = READ; + } +} diff --git a/csrc/Includes/instr_set/opcodes_Grp12.c b/csrc/Includes/instr_set/opcodes_Grp12.c new file mode 100644 index 0000000..d0d9030 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp12.c @@ -0,0 +1,195 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ G12_(PDISASM pMyDisasm) +{ + long MyNumber; + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 2) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + else if (GV.REGOPCODE == 4) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + + } + else if (GV.REGOPCODE == 6) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + + else { + FailDecode(pMyDisasm); + } + +} diff --git a/csrc/Includes/instr_set/opcodes_Grp13.c b/csrc/Includes/instr_set/opcodes_Grp13.c new file mode 100644 index 0000000..b01a132 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp13.c @@ -0,0 +1,194 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ G13_(PDISASM pMyDisasm) +{ + long MyNumber; + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 2) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + else if (GV.REGOPCODE == 4) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + + } + else if (GV.REGOPCODE == 6) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + + else { + FailDecode(pMyDisasm); + } + +} diff --git a/csrc/Includes/instr_set/opcodes_Grp14.c b/csrc/Includes/instr_set/opcodes_Grp14.c new file mode 100644 index 0000000..801e114 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp14.c @@ -0,0 +1,203 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ G14_(PDISASM pMyDisasm) +{ + long MyNumber; + + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 2) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + else if (GV.REGOPCODE == 3) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrldq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + FailDecode(pMyDisasm); + } + + } + else if (GV.REGOPCODE == 6) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1qword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + } + else if (GV.REGOPCODE == 7) { + if (GV.OperandSize == 16) { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; + GV.MemDecoration = Arg1dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslldq "); + #endif + } + else { + FailDecode(pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Instruction.Immediat = MyNumber; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + } + else { + FailDecode(pMyDisasm); + } + + } + else { + FailDecode(pMyDisasm); + } + +} diff --git a/csrc/Includes/instr_set/opcodes_Grp15.c b/csrc/Includes/instr_set/opcodes_Grp15.c new file mode 100644 index 0000000..1489d0a --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp15.c @@ -0,0 +1,166 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ G15_(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg1multibytes; + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxsave "); + #endif + (*pMyDisasm).Argument1.ArgSize = 512; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; + (*pMyDisasm).Argument2.ArgSize = 512; + } + else { + FailDecode(pMyDisasm); + } + } + else if (GV.REGOPCODE == 1) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2multibytes; + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxrstor "); + #endif + (*pMyDisasm).Argument2.ArgSize = 512; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; + (*pMyDisasm).Argument1.ArgSize = 512; + } + else { + FailDecode(pMyDisasm); + } + + } + else if (GV.REGOPCODE == 2) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ldmxcsr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + FailDecode(pMyDisasm); + } + + } + else if (GV.REGOPCODE == 3) { + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg1dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stmxcsr "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + FailDecode(pMyDisasm); + } + + } + + else if (GV.REGOPCODE == 4) { + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg1multibytes; + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsave "); + #endif + (*pMyDisasm).Argument1.ArgSize = 512; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; + (*pMyDisasm).Argument2.ArgSize = 512; + } + else { + FailDecode(pMyDisasm); + } + } + + else if (GV.REGOPCODE == 5) { + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfence "); + #endif + } + else { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MemDecoration = Arg2multibytes; + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xrstor "); + #endif + (*pMyDisasm).Argument2.ArgSize = 512; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; + (*pMyDisasm).Argument1.ArgSize = 512; + } + + } + else if (GV.REGOPCODE == 6) { + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mfence "); + #endif + } + else { + FailDecode(pMyDisasm); + } + } + else if (GV.REGOPCODE == 7) { + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sfence "); + #endif + } + else { + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clflush "); + #endif + } + + } + + else { + FailDecode(pMyDisasm); + } + GV.EIP_+= GV.DECALAGE_EIP+2; +} diff --git a/csrc/Includes/instr_set/opcodes_Grp16.c b/csrc/Includes/instr_set/opcodes_Grp16.c new file mode 100644 index 0000000..58cad51 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp16.c @@ -0,0 +1,85 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * + * ==================================================================== */ +void __bea_callspec__ G16_(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchNTA "); + #endif + } + else { + FailDecode(pMyDisasm); + } + } + else if (GV.REGOPCODE == 1) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT0 "); + #endif + } + else { + FailDecode(pMyDisasm); + } + + } + else if (GV.REGOPCODE == 2) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT1 "); + #endif + } + else { + FailDecode(pMyDisasm); + } + + } + else if (GV.REGOPCODE == 3) { + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.MOD_!= 0x3) { + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT2 "); + #endif + } + else { + FailDecode(pMyDisasm); + } + + } + + else { + FailDecode(pMyDisasm); + } + GV.EIP_+= GV.DECALAGE_EIP+2; +} diff --git a/csrc/Includes/instr_set/opcodes_Grp2.c b/csrc/Includes/instr_set/opcodes_Grp2.c new file mode 100644 index 0000000..b1fc810 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp2.c @@ -0,0 +1,461 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0c0h + * ==================================================================== */ +void __bea_callspec__ G2_EbIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EbIb(pMyDisasm); + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 92); + } +} + + +/* ==================================================================== + * 0c1h + * ==================================================================== */ +void __bea_callspec__ G2_EvIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EvIb(pMyDisasm); + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 92); + } +} + +/* ==================================================================== + * 0d0h + * ==================================================================== */ +void __bea_callspec__ G2_Eb1(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); + #endif + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.Immediat = 1; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 87); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 87); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 80); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 80); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 91); + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * 0d1h + * ==================================================================== */ +void __bea_callspec__ G2_Ev1(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); + #endif + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.Immediat = 1; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 87); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 87); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 80); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 80); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 91); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 91); + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * 0d2h + * ==================================================================== */ +void __bea_callspec__ G2_EbCL(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 8; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 92); + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} + + +/* ==================================================================== + * 0d3h + * ==================================================================== */ +void __bea_callspec__ G2_EvCL(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 8; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); + #endif + FillFlags(pMyDisasm, 88); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); + #endif + FillFlags(pMyDisasm, 81); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); + #endif + FillFlags(pMyDisasm, 92); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); + #endif + FillFlags(pMyDisasm, 92); + } + GV.EIP_ += GV.DECALAGE_EIP+2; +} diff --git a/csrc/Includes/instr_set/opcodes_Grp3.c b/csrc/Includes/instr_set/opcodes_Grp3.c new file mode 100644 index 0000000..2e2433c --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp3.c @@ -0,0 +1,257 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0f6h + * ==================================================================== */ +void __bea_callspec__ G3_Eb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + EbIb(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 104); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + EbIb(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 104); + } + else if (GV.REGOPCODE == 2) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); + #endif + Eb(pMyDisasm); + FillFlags(pMyDisasm, 73); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); + #endif + Eb(pMyDisasm); + FillFlags(pMyDisasm, 71); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); + #endif + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; + FillFlags(pMyDisasm, 70); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); + #endif + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 8; + FillFlags(pMyDisasm, 38); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); + #endif + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 8; + FillFlags(pMyDisasm, 31); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); + #endif + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; + FillFlags(pMyDisasm, 37); + } +} + +/* ==================================================================== + * 0f7h + * ==================================================================== */ +void __bea_callspec__ G3_Ev(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + EvIv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 104); + } + else if (GV.REGOPCODE == 1) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + EvIv(pMyDisasm); + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 104); + } + else if (GV.REGOPCODE == 2) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); + #endif + Ev(pMyDisasm); + FillFlags(pMyDisasm, 73); + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); + #endif + Ev(pMyDisasm); + FillFlags(pMyDisasm, 71); + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + GV.MemDecoration = Arg2word; + (*pMyDisasm).Argument1.ArgSize = 16; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + FillFlags(pMyDisasm, 70); + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + GV.MemDecoration = Arg2word; + (*pMyDisasm).Argument1.ArgSize = 16; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + FillFlags(pMyDisasm, 38); + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + GV.MemDecoration = Arg2word; + (*pMyDisasm).Argument1.ArgSize = 16; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + FillFlags(pMyDisasm, 31); + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + GV.MemDecoration = Arg2word; + (*pMyDisasm).Argument1.ArgSize = 16; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + FillFlags(pMyDisasm, 37); + } +} diff --git a/csrc/Includes/instr_set/opcodes_Grp4.c b/csrc/Includes/instr_set/opcodes_Grp4.c new file mode 100644 index 0000000..4e430b9 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp4.c @@ -0,0 +1,51 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0feh + * ==================================================================== */ +void __bea_callspec__ G4_Eb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + Eb(pMyDisasm); + FillFlags(pMyDisasm, 40); + } + else if (GV.REGOPCODE == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + Eb(pMyDisasm); + FillFlags(pMyDisasm, 30); + } + else { + FailDecode(pMyDisasm); + } +} + diff --git a/csrc/Includes/instr_set/opcodes_Grp5.c b/csrc/Includes/instr_set/opcodes_Grp5.c new file mode 100644 index 0000000..f7ad804 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp5.c @@ -0,0 +1,153 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0ffh + * ==================================================================== */ +void __bea_callspec__ G5_Ev(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); + #endif + Ev(pMyDisasm); + FillFlags(pMyDisasm, 40); + } + else if (GV.REGOPCODE == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); + #endif + Ev(pMyDisasm); + FillFlags(pMyDisasm, 30); + } + else if (GV.REGOPCODE == 2) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = CallType; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + } + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } + else if (GV.REGOPCODE == 3) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = CallType; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); + #endif + } + GV.MemDecoration = Arg1fword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } + else if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JmpType; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + } + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg1qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 5) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = JmpType; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); + #endif + } + GV.MemDecoration = Arg1fword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + } + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + } + else { + GV.MemDecoration = Arg2word; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } + else { + FailDecode(pMyDisasm); + } +} + diff --git a/csrc/Includes/instr_set/opcodes_Grp6.c b/csrc/Includes/instr_set/opcodes_Grp6.c new file mode 100644 index 0000000..af09f7a --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp6.c @@ -0,0 +1,117 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0f00h + * ==================================================================== */ +void __bea_callspec__ G6_(PDISASM pMyDisasm) +{ + Int32 OperandSizeOld = 0; + + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + OperandSizeOld = GV.OperandSize; + GV.OperandSize = 16; + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + + if (GV.REGOPCODE == 0) { + if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { + GV.OperandSize = OperandSizeOld; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sldt "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 32; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 1) { + if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { + GV.OperandSize = OperandSizeOld; + } + else { + GV.MemDecoration = Arg1word; + } + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "str "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 2) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lldt "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; + (*pMyDisasm).Argument1.ArgSize = 16; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 3) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ltr "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; + (*pMyDisasm).Argument1.ArgSize = 16; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verr "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 5) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verw "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.OperandSize = OperandSizeOld; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 6) { + FailDecode(pMyDisasm); + GV.OperandSize = OperandSizeOld; + } + else { + FailDecode(pMyDisasm); + GV.OperandSize = OperandSizeOld; + } +} + diff --git a/csrc/Includes/instr_set/opcodes_Grp7.c b/csrc/Includes/instr_set/opcodes_Grp7.c new file mode 100644 index 0000000..465b6d6 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp7.c @@ -0,0 +1,278 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0f01h + * ==================================================================== */ +void __bea_callspec__ G7_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7; + if (GV.REGOPCODE == 0) { + if (GV.MOD_== 0x3) { + if (GV.RM_ == 0x1) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmcall "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x2) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmlaunch "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x3) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmresume "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x4) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxoff "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + else { + GV.MemDecoration = Arg1fword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sgdt "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 48; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else if (GV.REGOPCODE == 1) { + if (GV.MOD_== 0x3) { + if (GV.RM_ == 0x00) { + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "monitor "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x01) { + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mwait "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + else { + GV.MemDecoration = Arg1fword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sidt "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; + (*pMyDisasm).Argument2.ArgSize = 48; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else if (GV.REGOPCODE == 2) { + if (GV.MOD_== 0x3) { + if (GV.RM_ == 0x0) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xgetbv "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x1) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsetbv "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + else { + GV.MemDecoration = Arg2fword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgdt "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 48; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else if (GV.REGOPCODE == 3) { + if (GV.MOD_== 0x3) { + if (GV.RM_ == 0x0) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmrun "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x1) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmmcall "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x2) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmload "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x3) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmsave "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x4) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stgi "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x5) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clgi "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x6) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "skinit "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.RM_ == 0x7) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpga "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + else { + GV.MemDecoration = Arg2fword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lidt "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; + (*pMyDisasm).Argument1.ArgSize = 48; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + + else if (GV.REGOPCODE == 4) { + GV.MemDecoration = Arg2word; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "smsw "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + + else if (GV.REGOPCODE == 6) { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lmsw "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+CR_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else if (GV.REGOPCODE == 7) { + if (GV.MOD_== 0x3) { + if (GV.Architecture == 64) { + if (GV.RM_ == 0x0) { + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "swapgs "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + else { + if (GV.RM_ == 0x1) { + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtscp "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + } + } + else { + GV.MemDecoration = Arg2byte; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpg "); + #endif + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else { + FailDecode(pMyDisasm); + } + + +} + diff --git a/csrc/Includes/instr_set/opcodes_Grp8.c b/csrc/Includes/instr_set/opcodes_Grp8.c new file mode 100644 index 0000000..cd0447e --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp8.c @@ -0,0 +1,70 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0fbah + * ==================================================================== */ +void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + EvIb(pMyDisasm); + if (GV.REGOPCODE == 4) { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 11); + } + else if (GV.REGOPCODE == 5) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 11); + } + else if (GV.REGOPCODE == 6) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 11); + } + else if (GV.REGOPCODE == 7) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 11); + } + else { + FailDecode(pMyDisasm); + } +} diff --git a/csrc/Includes/instr_set/opcodes_Grp9.c b/csrc/Includes/instr_set/opcodes_Grp9.c new file mode 100644 index 0000000..2519c86 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_Grp9.c @@ -0,0 +1,84 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + + +/* ==================================================================== + * 0fc7h + * ==================================================================== */ +void __bea_callspec__ G9_(PDISASM pMyDisasm) +{ + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + if (GV.REGOPCODE == 1) { + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg16b "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 128; + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 23); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg8b "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument1.AccessMode = READ; + FillFlags(pMyDisasm, 23); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + } + else if (GV.REGOPCODE == 6) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + if (GV.OperandSize == 16) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmclear "); + #endif + } + else if (GV.PrefRepe == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxon "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrld "); + #endif + } + GV.EIP_ += GV.DECALAGE_EIP+2; + + } + else if (GV.REGOPCODE == 7) { + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrst "); + #endif + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + +} diff --git a/csrc/Includes/instr_set/opcodes_MMX.c b/csrc/Includes/instr_set/opcodes_MMX.c new file mode 100644 index 0000000..c59217b --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_MMX.c @@ -0,0 +1,1722 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +void __bea_callspec__ emms_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+STATE_MANAGEMENT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "emms "); + #endif + GV.EIP_++; +} + +/* ==================================================================== + * 0x 0f 7e + * ==================================================================== */ +void __bea_callspec__ movd_EP(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg1dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); + #endif + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else { + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg1dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); + #endif + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } +} + + +/* ==================================================================== + * 0x 0f 6e + * ==================================================================== */ +void __bea_callspec__ movd_PE(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); + #endif + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + else { + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); + #endif + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } +} + + + +/* ==================================================================== + * 0x 0f 6f + * ==================================================================== */ +void __bea_callspec__ movq_PQ(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqu "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqa "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 7f + * ==================================================================== */ +void __bea_callspec__ movq_QP(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqu "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqa "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + GV.MMX_ = 1; + ExGx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d6 + * ==================================================================== */ +void __bea_callspec__ movq_WV(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdq2q "); + #endif + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq2dq "); + #endif + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 1c + * ==================================================================== */ +void __bea_callspec__ pabsb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 38 1e + * ==================================================================== */ +void __bea_callspec__ pabsd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsd "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 38 1d + * ==================================================================== */ +void __bea_callspec__ pabsw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 63 + * ==================================================================== */ +void __bea_callspec__ packsswb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packsswb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packsswb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 6b + * ==================================================================== */ +void __bea_callspec__ packssdw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packssdw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packssdw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 67 + * ==================================================================== */ +void __bea_callspec__ packuswb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packuswb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packuswb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f fc + * ==================================================================== */ +void __bea_callspec__ paddb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f fd + * ==================================================================== */ +void __bea_callspec__ paddw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f fe + * ==================================================================== */ +void __bea_callspec__ paddd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddd "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f ec + * ==================================================================== */ +void __bea_callspec__ paddsb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f ed + * ==================================================================== */ +void __bea_callspec__ paddsw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f dc + * ==================================================================== */ +void __bea_callspec__ paddusb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f dd + * ==================================================================== */ +void __bea_callspec__ paddusw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f db + * ==================================================================== */ +void __bea_callspec__ pand_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pand "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pand "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} +/* ==================================================================== + * 0x 0f df + * ==================================================================== */ +void __bea_callspec__ pandn_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pandn "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pandn "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 74 + * ==================================================================== */ +void __bea_callspec__ pcmpeqb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 75 + * ==================================================================== */ +void __bea_callspec__ pcmpeqw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 76 + * ==================================================================== */ +void __bea_callspec__ pcmpeqd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 64 + * ==================================================================== */ +void __bea_callspec__ pcmpgtb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 65 + * ==================================================================== */ +void __bea_callspec__ pcmpgtw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 66 + * ==================================================================== */ +void __bea_callspec__ pcmpgtd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f e5 + * ==================================================================== */ +void __bea_callspec__ pmulhw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d5 + * ==================================================================== */ +void __bea_callspec__ pmullw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmullw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmullw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f5 + * ==================================================================== */ +void __bea_callspec__ pmaddwd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f eb + * ==================================================================== */ +void __bea_callspec__ por_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "por "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "por "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f1 + * ==================================================================== */ +void __bea_callspec__ psllw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f2 + * ==================================================================== */ +void __bea_callspec__ pslld_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f3 + * ==================================================================== */ +void __bea_callspec__ psllq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d1 + * ==================================================================== */ +void __bea_callspec__ psrlw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d2 + * ==================================================================== */ +void __bea_callspec__ psrld_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d3 + * ==================================================================== */ +void __bea_callspec__ psrlq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f e1 + * ==================================================================== */ +void __bea_callspec__ psraw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f e2 + * ==================================================================== */ +void __bea_callspec__ psrad_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f8 + * ==================================================================== */ +void __bea_callspec__ psubb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f f9 + * ==================================================================== */ +void __bea_callspec__ psubw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f fa + * ==================================================================== */ +void __bea_callspec__ psubd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f e8 + * ==================================================================== */ +void __bea_callspec__ psubsb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f e9 + * ==================================================================== */ +void __bea_callspec__ psubsw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d8 + * ==================================================================== */ +void __bea_callspec__ psubusb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusb "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d9 + * ==================================================================== */ +void __bea_callspec__ psubusw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 68 + * ==================================================================== */ +void __bea_callspec__ punpckhbw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhbw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhbw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 69 + * ==================================================================== */ +void __bea_callspec__ punpckhwd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 6a + * ==================================================================== */ +void __bea_callspec__ punpckhdq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhdq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhdq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 60 + * ==================================================================== */ +void __bea_callspec__ punpcklbw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklbw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklbw "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 61 + * ==================================================================== */ +void __bea_callspec__ punpcklwd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklwd "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 62 + * ==================================================================== */ +void __bea_callspec__ punpckldq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckldq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckldq "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + +/* ==================================================================== + * 0x 0f ef + * ==================================================================== */ +void __bea_callspec__ pxor_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pxor "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pxor "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} diff --git a/csrc/Includes/instr_set/opcodes_N_Z.c b/csrc/Includes/instr_set/opcodes_N_Z.c new file mode 100644 index 0000000..df572ed --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_N_Z.c @@ -0,0 +1,3692 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 90h + * ==================================================================== */ +void __bea_callspec__ nop_(PDISASM pMyDisasm) +{ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pause "); + #endif + GV.EIP_++; + } + else { + if (GV.REX.B_ == 1) { + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0+8]); + #endif + + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0+8]); + #endif + + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + + } + else { + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "nop "); + #endif + GV.EIP_++; + } + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ nop_Ev(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "nop "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + } + else { + GV.MemDecoration = Arg2word; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument2.AccessMode = 0; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ hint_nop(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hint_nop "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + } + else { + GV.MemDecoration = Arg2word; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; +} + +/* ======================================= + * 08h + * ======================================= */ +void __bea_callspec__ or_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,74); +} + +/* ======================================= + * 09h + * ======================================= */ +void __bea_callspec__ or_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,74); +} + +/* ======================================= + * 0ah + * ======================================= */ +void __bea_callspec__ or_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,74); +} + +/* ======================================= + * 0bh + * ======================================= */ +void __bea_callspec__ or_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,74); +} + +/* ======================================= + * 0ch + * ======================================= */ +void __bea_callspec__ or_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,74); +} + +/* ======================================= + * 0dh + * ======================================= */ +void __bea_callspec__ or_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,74); +} + + +/* ======================================= + * 06eh + * ======================================= */ +void __bea_callspec__ outsb_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_++; + FillFlags(pMyDisasm, 76); +} + +/* ======================================= + * 06fh + * ======================================= */ +void __bea_callspec__ outsw_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + if (GV.OperandSize >= 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 32; + GV.EIP_++; + FillFlags(pMyDisasm, 76); + } + + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsw "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; + FillFlags(pMyDisasm, 76); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ out_IbAL(PDISASM pMyDisasm) +{ + long MyNumber; + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.Immediat = MyNumber; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ += 2; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ out_Ib_eAX(PDISASM pMyDisasm) +{ + long MyNumber; + + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); + #endif + if (!Security(2, pMyDisasm)) return; + GV.ImmediatSize = 8; + MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.2X",(Int64) MyNumber); + #endif + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.Immediat = MyNumber; + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgSize = 16; + } + GV.EIP_ += 2; +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ out_DXAL(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgSize = 8; + GV.EIP_ ++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ out_DXeAX(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); + #endif + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); + #endif + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgSize = 16; + } + GV.EIP_ ++; +} + +/* ======================================= + * 8fh + * ======================================= */ +void __bea_callspec__ pop_Ev(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; + if (GV.REGOPCODE == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + GV.MemDecoration = Arg1qword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg1dword; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } + else { + GV.MemDecoration = Arg1word; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * 58h + * ======================================= */ +void __bea_callspec__ pop_eax(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 59h + * ======================================= */ +void __bea_callspec__ pop_ecx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5ah + * ======================================= */ +void __bea_callspec__ pop_edx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5bh + * ======================================= */ +void __bea_callspec__ pop_ebx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5ch + * ======================================= */ +void __bea_callspec__ pop_esp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5dh + * ======================================= */ +void __bea_callspec__ pop_ebp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5eh + * ======================================= */ +void __bea_callspec__ pop_esi(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 5fh + * ======================================= */ +void __bea_callspec__ pop_edi(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0+8]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + } + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ pop_es(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[0]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[0]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ pop_ss(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[2]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[2]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ pop_ds(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[3]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[3]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ pop_fs(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[4]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[4]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ pop_gs(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[5]); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[5]; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * 9dh + * ======================================= */ +void __bea_callspec__ popfd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + + if (GV.Architecture == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popfq "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popfd "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popf "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } +} + +/* ======================================= + * 9dh + * ======================================= */ +void __bea_callspec__ popad_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popad "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popa "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_es(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_ss(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[2]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_ds(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[3]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[3]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_fs(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[4]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[4]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_gs(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[5]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[5]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ push_cs(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[1]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[1]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + GV.EIP_++; + } +} + + + +/* ======================================= + * 50h + * ======================================= */ +void __bea_callspec__ push_eax(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 51h + * ======================================= */ +void __bea_callspec__ push_ecx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 52h + * ======================================= */ +void __bea_callspec__ push_edx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 53h + * ======================================= */ +void __bea_callspec__ push_ebx(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 54h + * ======================================= */ +void __bea_callspec__ push_esp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 55h + * ======================================= */ +void __bea_callspec__ push_ebp(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 56h + * ======================================= */ +void __bea_callspec__ push_esi(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + +/* ======================================= + * 57h + * ======================================= */ +void __bea_callspec__ push_edi(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (GV.REX.B_ == 0) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+0+8]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; + } + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7+0]); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgSize = 16; + } + } + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; +} + + +/* ======================================= + * 68h + * ======================================= */ +void __bea_callspec__ push_Iv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (GV.Architecture == 64) { + if (!Security(5, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((UInt32*)(UIntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 32; + (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_ += 5; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } + else if (GV.OperandSize == 32) { + if (!Security(5, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((UInt32*)(UIntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 32; + (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_ += 5; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } + else { + if (!Security(3, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 16; + (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_ += 3; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + } +} + +/* ======================================= + * 6ah + * ======================================= */ +void __bea_callspec__ push_Ib(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); + #endif + if (!Security(1, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(IntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 8; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_ += 2; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; + +} + + +/* ======================================= + * 9ch + * ======================================= */ +void __bea_callspec__ pushfd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + + if (GV.Architecture == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushfq "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushfd "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushf "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + FillFlags(pMyDisasm, 78); + } +} + + +/* ======================================= + * 60h + * ======================================= */ +void __bea_callspec__ pushad_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + + if (GV.Architecture == 64) { + FailDecode(pMyDisasm); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushad "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pusha "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; + } +} + +/* ======================================= + * 0c2h + * ======================================= */ +void __bea_callspec__ retn_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = RetType; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retn "); + #endif + if (!Security(3, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 16; + (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_+=3; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; +} + +/* ======================================= + * 0c3h + * ======================================= */ +void __bea_callspec__ ret_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = RetType; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ret "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ retf_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = RetType; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lret "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); + #endif + } + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ retf_Iw(PDISASM pMyDisasm) +{ + int i = 0; + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; + (*pMyDisasm).Instruction.BranchType = RetType; + if (GV.SYNTAX_ == ATSyntax) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lret "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); + #endif + } + if (!Security(3, pMyDisasm)) return; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); + #endif + GV.ImmediatSize = 16; + (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); + GV.EIP_+=3; + (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ rdtsc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtsc "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 32; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ rdmsr_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdmsr "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 32; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ rdpmc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdpmc "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument2.ArgSize = 32; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ rsm_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsm "); + #endif + GV.EIP_++; + FillFlags(pMyDisasm, 89); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ sysenter_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysenter "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ sysexit_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysexit "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ sahf_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sahf "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 8; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ salc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = UNDOCUMENTED_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "salc "); + #endif + GV.EIP_++; +} + + +/* ======================================= + * 0ach + * ======================================= */ +void __bea_callspec__ scasb_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 94); +} + +/* ======================================= + * 0adh + * ======================================= */ +void __bea_callspec__ scas_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasq "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 94); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasd "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 94); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasw "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument1.AccessMode = READ; + (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 94); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ stc_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stc "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 98); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ sti_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sti "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 100); +} + + +/* ======================================= + * 0aah + * ======================================= */ +void __bea_callspec__ stos_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosb "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 8; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 101); +} + +/* ======================================= + * 0abh + * ======================================= */ +void __bea_callspec__ stosw_(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; + } + if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { + (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosq "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 64; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 101); + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosd "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 32; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 101); + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosw "); + #endif + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgSize = 16; + (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; + (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; + GV.EIP_++; + FillFlags(pMyDisasm, 101); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ syscall_(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION+CONTROL_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "syscall "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1+REG11; + (*pMyDisasm).Argument1.ArgSize = 64; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ sysret_(PDISASM pMyDisasm) +{ + if (GV.Architecture == 64) { + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysret "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1+REG11; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else { + FailDecode(pMyDisasm); + } +} + + + +/* ======================================= + * 18h + * ======================================= */ +void __bea_callspec__ sbb_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 19h + * ======================================= */ +void __bea_callspec__ sbb_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 1ah + * ======================================= */ +void __bea_callspec__ sbb_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 1bh + * ======================================= */ +void __bea_callspec__ sbb_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 1ch + * ======================================= */ +void __bea_callspec__ sbb_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 1dh + * ======================================= */ +void __bea_callspec__ sbb_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,93); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ seto_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "seto "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f91h + * ======================================= */ +void __bea_callspec__ setno_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setno "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setb "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setnb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnb "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ sete_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sete "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setne_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setne "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setbe_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setbe "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setnbe_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnbe "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ sets_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sets "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setns_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setns "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setp_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setp "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setnp_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnp "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setge_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnl "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setnge_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setl "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setle_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setle "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + +/* ======================================= + * 0f90h + * ======================================= */ +void __bea_callspec__ setnle_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnle "); + #endif + GV.MemDecoration = Arg1byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 32; + GV.EIP_+= GV.DECALAGE_EIP+2; + FillFlags(pMyDisasm,95); +} + + +/* ======================================= + * 0fa4h + * ======================================= */ +void __bea_callspec__ shld_EvGvIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shld "); + #endif + GV.ImmediatSize = 8; + EvGv(pMyDisasm); + GV.EIP_+= 1; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + FillFlags(pMyDisasm, 97); +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ shld_EvGvCL(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shld "); + #endif + EvGv(pMyDisasm); + GV.third_arg = 2; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument3.ArgMnemonic, Registers8Bits[1]); + #endif + (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument3.ArgSize = 8; + FillFlags(pMyDisasm, 97); +} + +/* ======================================= + * 0fach + * ======================================= */ +void __bea_callspec__ shrd_EvGvIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shrd "); + #endif + GV.ImmediatSize = 8; + EvGv(pMyDisasm); + GV.EIP_+= 1; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + FillFlags(pMyDisasm, 97); +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ shrd_EvGvCL(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shrd "); + #endif + EvGv(pMyDisasm); + GV.third_arg = 2; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument3.ArgMnemonic, Registers8Bits[1]); + #endif + (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + (*pMyDisasm).Argument3.ArgSize = 8; + FillFlags(pMyDisasm, 97); +} + + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ std_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "std "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 1; + FillFlags(pMyDisasm, 99); +} + + +/* ======================================= + * 28h + * ======================================= */ +void __bea_callspec__ sub_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 29h + * ======================================= */ +void __bea_callspec__ sub_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 2ah + * ======================================= */ +void __bea_callspec__ sub_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 2bh + * ======================================= */ +void __bea_callspec__ sub_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 2ch + * ======================================= */ +void __bea_callspec__ sub_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 2dh + * ======================================= */ +void __bea_callspec__ sub_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,103); +} + +/* ======================================= + * 84h + * ======================================= */ +void __bea_callspec__ test_EbGb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + EbGb(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * 85h + * ======================================= */ +void __bea_callspec__ test_EvGv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + EvGv(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * 86h + * ======================================= */ +void __bea_callspec__ test_GbEb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GbEb(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * 87h + * ======================================= */ +void __bea_callspec__ test_GvEv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + GvEv(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * 88h + * ======================================= */ +void __bea_callspec__ test_ALIb(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + ALIb(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * 89h + * ======================================= */ +void __bea_callspec__ test_eAX_Iv(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); + #endif + (*pMyDisasm).Argument1.AccessMode = READ; + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,104); +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ ud2_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ud2 "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ vmread_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmread "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + } + EvGv(pMyDisasm); + if (GV.Architecture == 64) { + GV.OperandSize = 32; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ vmwrite_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmwrite "); + #endif + if (GV.Architecture == 64) { + GV.OperandSize = 64; + } + GvEv(pMyDisasm); + if (GV.Architecture == 64) { + GV.OperandSize = 32; + } +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ wbinvd_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wbinvd "); + #endif + GV.EIP_++; +} + +/* ======================================= + * 9Bh + * ======================================= */ +void __bea_callspec__ wait_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wait "); + #endif + GV.EIP_++; +} + +/* ======================================= + * + * ======================================= */ +void __bea_callspec__ wrmsr_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wrmsr "); + #endif + GV.EIP_++; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2; + (*pMyDisasm).Argument2.ArgSize = 32; +} + + +/* ======================================= + * 0fc0h + * ======================================= */ +void __bea_callspec__ xadd_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xadd "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,110); +} + +/* ======================================= + * 0fc1h + * ======================================= */ +void __bea_callspec__ xadd_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xadd "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,110); +} + +/* ======================================= + * 91h + * ======================================= */ +void __bea_callspec__ xchg_ecx(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 92h + * ======================================= */ +void __bea_callspec__ xchg_edx(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 93h + * ======================================= */ +void __bea_callspec__ xchg_ebx(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 94h + * ======================================= */ +void __bea_callspec__ xchg_esp(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 95h + * ======================================= */ +void __bea_callspec__ xchg_ebp(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG5; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 96h + * ======================================= */ +void __bea_callspec__ xchg_esi(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG6; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + + +/* ======================================= + * 97h + * ======================================= */ +void __bea_callspec__ xchg_edi(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG7; + if (GV.OperandSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 64; + (*pMyDisasm).Argument2.ArgSize = 64; + } + else if (GV.OperandSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 32; + (*pMyDisasm).Argument2.ArgSize = 32; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); + #endif + if (GV.REX.B_ == 1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7+8]); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7]); + #endif + } + GV.EIP_++; + (*pMyDisasm).Argument2.AccessMode = WRITE; + (*pMyDisasm).Argument1.ArgSize = 16; + (*pMyDisasm).Argument2.ArgSize = 16; + } +} + +/* ======================================= + * 0d7h + * ======================================= */ +void __bea_callspec__ xlat_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; + if (GV.AddressSize == 64) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument2.ArgSize = 64; + GV.EIP_++; + } + else if (GV.AddressSize == 32) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument2.ArgSize = 32; + GV.EIP_++; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); + #endif + (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; + (*pMyDisasm).Argument1.ArgSize = 8; + (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; + (*pMyDisasm).Argument2.ArgSize = 16; + GV.EIP_++; + } +} + + +/* ======================================= + * 30h + * ======================================= */ +void __bea_callspec__ xor_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,113); +} + +/* ======================================= + * 31h + * ======================================= */ +void __bea_callspec__ xor_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,113); +} + +/* ======================================= + * 32h + * ======================================= */ +void __bea_callspec__ xor_GbEb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + GbEb(pMyDisasm); + FillFlags(pMyDisasm,113); +} + +/* ======================================= + * 33h + * ======================================= */ +void __bea_callspec__ xor_GvEv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,113); +} + +/* ======================================= + * 34h + * ======================================= */ +void __bea_callspec__ xor_ALIb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + ALIb(pMyDisasm); + FillFlags(pMyDisasm,113); +} + +/* ======================================= + * 35h + * ======================================= */ +void __bea_callspec__ xor_eAX_Iv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); + #endif + eAX_Iv(pMyDisasm); + FillFlags(pMyDisasm,113); +} + + +/* ======================================= + * 86h + * ======================================= */ +void __bea_callspec__ xchg_EbGb(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + EbGb(pMyDisasm); + FillFlags(pMyDisasm,113); + (*pMyDisasm).Argument2.AccessMode = WRITE; +} + +/* ======================================= + * 87h + * ======================================= */ +void __bea_callspec__ xchg_EvGv(PDISASM pMyDisasm) +{ + if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { + (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; + } + (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); + #endif + EvGv(pMyDisasm); + FillFlags(pMyDisasm,113); + (*pMyDisasm).Argument2.AccessMode = WRITE; +} diff --git a/csrc/Includes/instr_set/opcodes_SSE.c b/csrc/Includes/instr_set/opcodes_SSE.c new file mode 100644 index 0000000..5bd0424 --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_SSE.c @@ -0,0 +1,4570 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * 0x 0f 58 + * ==================================================================== */ +void __bea_callspec__ addps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + +/* ==================================================================== + * 0x 0f d0 + * ==================================================================== */ +void __bea_callspec__ addsubpd_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_PACKED; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsubps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_PACKED; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsubpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 55 + * ==================================================================== */ +void __bea_callspec__ andnps_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andnpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andnps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 54 + * ==================================================================== */ +void __bea_callspec__ andps_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 0d + * ==================================================================== */ +void __bea_callspec__ blendpd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendpd "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 0c + * ==================================================================== */ +void __bea_callspec__ blendps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendps "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 15 + * ==================================================================== */ +void __bea_callspec__ blendvpd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendvpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 38 14 + * ==================================================================== */ +void __bea_callspec__ blendvps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendvps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f c2 + * ==================================================================== */ +void __bea_callspec__ cmpps_VW(PDISASM pMyDisasm) +{ + + /* ========= 0xf2 */ + GV.ImmediatSize = 8; + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmppd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + (*pMyDisasm).Argument1.AccessMode = READ; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + +} + + +/* ==================================================================== + * 0x 0f 38 f0 + * ==================================================================== */ +void __bea_callspec__ crc32_GvEb(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+ACCELERATOR_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "crc32 "); + #endif + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 64; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2byte; + GV.OperandSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.OperandSize = 32; + } + else { + GV.MemDecoration = Arg2byte; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + } + + if (GV.OperandSize == 16) { + GV.OperandSize = 32; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 16; + } + else { + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 f1 + * ==================================================================== */ +void __bea_callspec__ crc32_GvEv(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+ACCELERATOR_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "crc32 "); + #endif + + if (GV.OperandSize == 64) { + GV.MemDecoration = Arg2qword; + } + else if (GV.OperandSize == 32) { + GV.MemDecoration = Arg2dword; + } + else { + GV.MemDecoration = Arg2word; + } + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + + if (GV.OperandSize == 16) { + GV.OperandSize = 32; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.OperandSize = 16; + } + else { + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + } + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 2f + * ==================================================================== */ +void __bea_callspec__ comiss_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "comisd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "comiss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 5a + * ==================================================================== */ +void __bea_callspec__ cvtps2pd_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsd2ss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtss2sd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2ps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2pd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 5b + * ==================================================================== */ +void __bea_callspec__ cvtdq2ps_(PDISASM pMyDisasm) +{ + /* ========== 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttps2dq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2dq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtdq2ps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 2a + * ==================================================================== */ +void __bea_callspec__ cvtpi2ps_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsi2sd "); + #endif + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsi2ss "); + #endif + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpi2pd "); + #endif + GV.MemDecoration = Arg2qword; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpi2ps "); + #endif + GV.MemDecoration = Arg2qword; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } +} + + +/* ==================================================================== + * 0x 0f 2d + * ==================================================================== */ +void __bea_callspec__ cvtps2pi_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsd2si "); + #endif + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtss2si "); + #endif + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2dword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2dword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2pi "); + #endif + GV.MemDecoration = Arg2dqword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2pi "); + #endif + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } +} + + +/* ==================================================================== + * 0x 0f 2c + * ==================================================================== */ +void __bea_callspec__ cvttps2pi_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttsd2si "); + #endif + if (GV.REX.W_ == 1) { + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttss2si "); + #endif + GV.MemDecoration = Arg2dword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_+= GV.DECALAGE_EIP+2; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttpd2pi "); + #endif + GV.MemDecoration = Arg2dqword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttps2pi "); + #endif + GV.MemDecoration = Arg2qword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } +} + + +/* ==================================================================== + * 0x 0f e6 + * ==================================================================== */ +void __bea_callspec__ cvtpd2dq_(PDISASM pMyDisasm) +{ + /* ========== 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2dq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtdq2pd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttpd2dq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 3a 41 + * ==================================================================== */ +void __bea_callspec__ dppd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+DOT_PRODUCT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dppd "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + +/* ==================================================================== + * 0x 0f 3a 40 + * ==================================================================== */ +void __bea_callspec__ dpps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+DOT_PRODUCT; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dpps "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 5e + * ==================================================================== */ +void __bea_callspec__ divps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 17 + * ==================================================================== */ +void __bea_callspec__ extractps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "extractps "); + #endif + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 7c + * ==================================================================== */ +void __bea_callspec__ haddpd_VW(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "haddpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "haddps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 7d + * ==================================================================== */ +void __bea_callspec__ hsubpd_VW(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hsubpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hsubps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 21 + * ==================================================================== */ +void __bea_callspec__ insertps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insertps "); + #endif + GV.SSE_ = 1; + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + GV.MemDecoration = Arg2qword; + } + else { + GV.MemDecoration = Arg2dword; + } + + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + + + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + + +/* ==================================================================== + * 0x 0f f0 + * ==================================================================== */ +void __bea_callspec__ lddqu_(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SPECIALIZED_128bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lddqu "); + #endif + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_+= GV.DECALAGE_EIP+2; + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f f7 + * ==================================================================== */ +void __bea_callspec__ maskmovq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maskmovdqu "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maskmovq "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 5f + * ==================================================================== */ +void __bea_callspec__ maxps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 5d + * ==================================================================== */ +void __bea_callspec__ minps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 28 + * ==================================================================== */ +void __bea_callspec__ movaps_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movapd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movaps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 29 + * ==================================================================== */ +void __bea_callspec__ movaps_WV(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movapd "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movaps "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 16 + * ==================================================================== */ +void __bea_callspec__ movhps_VM(PDISASM pMyDisasm) +{ + + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movshdup "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlhps "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhps "); + #endif + } + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 17 + * ==================================================================== */ +void __bea_callspec__ movhps_MV(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhpd "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhps "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 12 + * ==================================================================== */ +void __bea_callspec__ movlps_VM(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movddup "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsldup "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; + if (GV.MOD_== 0x3) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhlps "); + #endif + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlps "); + #endif + } + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 13 + * ==================================================================== */ +void __bea_callspec__ movlps_MV(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlpd "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlps "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 50 + * ==================================================================== */ +void __bea_callspec__ movmskps_(PDISASM pMyDisasm) +{ + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_!= 0x3) { + FailDecode(pMyDisasm); + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movmskpd "); + #endif + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movmskps "); + #endif + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + + } +} + + +/* ==================================================================== + * 0x 0f 38 2a + * ==================================================================== */ +void __bea_callspec__ movntdqa_(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+STREAMING_LOAD; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntdqa "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f c3 + * ==================================================================== */ +void __bea_callspec__ movnti_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movnti "); + #endif + EvGv(pMyDisasm); + +} + + +/* ==================================================================== + * 0x 0f 2b + * ==================================================================== */ +void __bea_callspec__ movntps_(PDISASM pMyDisasm) +{ + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + FailDecode(pMyDisasm); + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntpd "); + #endif + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + + } + else { + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntps "); + #endif + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + + } +} + + +/* ==================================================================== + * 0x 0f e7 + * ==================================================================== */ +void __bea_callspec__ movntq_(PDISASM pMyDisasm) +{ + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + FailDecode(pMyDisasm); + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntdq "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntq "); + #endif + GV.MMX_ = 1; + ExGx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 10 + * ==================================================================== */ +void __bea_callspec__ movups_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movupd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movups "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + + +/* ==================================================================== + * 0x 0f 11 + * ==================================================================== */ +void __bea_callspec__ movups_WV(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg1qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg1dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movss "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movupd "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg1dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movups "); + #endif + GV.SSE_ = 1; + ExGx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 42 + * ==================================================================== */ +void __bea_callspec__ mpsadbw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+SAD_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mpsadbw "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 59 + * ==================================================================== */ +void __bea_callspec__ mulps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 56 + * ==================================================================== */ +void __bea_callspec__ orps_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "orpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "orps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 2b + * ==================================================================== */ +void __bea_callspec__ packusdw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packusdw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f d4 + * ==================================================================== */ +void __bea_callspec__ paddq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddq "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f e0 + * ==================================================================== */ +void __bea_callspec__ pavgb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f e3 + * ==================================================================== */ +void __bea_callspec__ pavgw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 0f + * ==================================================================== */ +void __bea_callspec__ palignr_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "palignr "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "palignr "); + #endif + GV.ImmediatSize = 8; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } +} + + +/* ==================================================================== + * 0x 0f 38 10 + * ==================================================================== */ +void __bea_callspec__ pblendvb_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendvb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendvb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 0e + * ==================================================================== */ +void __bea_callspec__ pblendw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+SAD_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendw "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 38 29 + * ==================================================================== */ +void __bea_callspec__ pcmpeqq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_EQUALITY; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 61 + * ==================================================================== */ +void __bea_callspec__ pcmpestri_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestri "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 60 + * ==================================================================== */ +void __bea_callspec__ pcmpestrm_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestrm "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 63 + * ==================================================================== */ +void __bea_callspec__ pcmpistri_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpistri "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 62 + * ==================================================================== */ +void __bea_callspec__ pcmpistrm_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestrm "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 38 37 + * ==================================================================== */ +void __bea_callspec__ pcmpgtq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 14 + * ==================================================================== */ +void __bea_callspec__ pextrb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrb "); + #endif + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1byte; + } + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 16 + * ==================================================================== */ +void __bea_callspec__ pextrd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + if (GV.REX.W_ == 0x1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrq "); + #endif + GV.MemDecoration = Arg1qword; + GV.OperandSize = 64; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrd "); + #endif + GV.MemDecoration = Arg1dword; + } + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + +/* ==================================================================== + * 0x 0f c5 + * ==================================================================== */ +void __bea_callspec__ pextrw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); + #endif + GV.MemDecoration = Arg2dqword; + GV.ImmediatSize = 8; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); + #endif + GV.MemDecoration = Arg2dqword; + GV.ImmediatSize = 8; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + +} + +/* ==================================================================== + * 0x 0f 3a 15 + * ==================================================================== */ +void __bea_callspec__ pextrw2_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); + #endif + GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; + if (GV.MOD_== 0x3) { + GV.MemDecoration = Arg1dword; + } + else { + GV.MemDecoration = Arg1word; + } + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 38 02 + * ==================================================================== */ +void __bea_callspec__ phaddd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddd "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 03 + * ==================================================================== */ +void __bea_callspec__ phaddsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 01 + * ==================================================================== */ +void __bea_callspec__ phaddw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 41 + * ==================================================================== */ +void __bea_callspec__ phminposuw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+HORIZONTAL_SEARCH; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phminposuw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 05 + * ==================================================================== */ +void __bea_callspec__ phsubw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 06 + * ==================================================================== */ +void __bea_callspec__ phsubd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubd "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 07 + * ==================================================================== */ +void __bea_callspec__ phsubsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 20 + * ==================================================================== */ +void __bea_callspec__ pinsrb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2byte; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrb "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 3a 22 + * ==================================================================== */ +void __bea_callspec__ pinsrd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; + if (GV.REX.W_ == 0x1) { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrq "); + #endif + GV.MemDecoration = Arg1qword; + } + else { + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrd "); + #endif + GV.MemDecoration = Arg1dword; + } + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f c4 + * ==================================================================== */ +void __bea_callspec__ pinsrw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrw "); + #endif + GV.MemDecoration = Arg2word; + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.SSE_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + + } + else { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrw "); + #endif + GV.MemDecoration = Arg2word; + GV.ImmediatSize = 8; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 1; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.MMX_ = 0; + GV.EIP_ += GV.DECALAGE_EIP+3; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + +} + + +/* ==================================================================== + * 0x 0f 38 3c + * ==================================================================== */ +void __bea_callspec__ pmaxsb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 3d + * ==================================================================== */ +void __bea_callspec__ pmaxsd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 3e + * ==================================================================== */ +void __bea_callspec__ pmaxuw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxuw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 3f + * ==================================================================== */ +void __bea_callspec__ pmaxud_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxud "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 38 + * ==================================================================== */ +void __bea_callspec__ pminsb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 39 + * ==================================================================== */ +void __bea_callspec__ pminsd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 3a + * ==================================================================== */ +void __bea_callspec__ pminuw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminuw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + +/* ==================================================================== + * 0x 0f 38 3b + * ==================================================================== */ +void __bea_callspec__ pminud_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminud "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f da + * ==================================================================== */ +void __bea_callspec__ pminub_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminub "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminub "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f de + * ==================================================================== */ +void __bea_callspec__ pmaxub_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxub "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxub "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f ea + * ==================================================================== */ +void __bea_callspec__ pminsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f ee + * ==================================================================== */ +void __bea_callspec__ pmaxsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 04 + * ==================================================================== */ +void __bea_callspec__ pmaddubsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddubsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddubsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f d7 + * ==================================================================== */ +void __bea_callspec__ pmovmskb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovmskb "); + #endif + GV.MemDecoration = Arg2dqword; + GV.SSE_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.SSE_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + else { + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovmskb "); + #endif + GV.MemDecoration = Arg2qword; + GV.MMX_ = 1; + MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); + GV.MMX_ = 0; + Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); + GV.EIP_ += GV.DECALAGE_EIP+2; + } + +} + + +/* ==================================================================== + * 0x 0f 38 21 + * ==================================================================== */ +void __bea_callspec__ pmovsxbd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 22 + * ==================================================================== */ +void __bea_callspec__ pmovsxbq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 20 + * ==================================================================== */ +void __bea_callspec__ pmovsxbw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 25 + * ==================================================================== */ +void __bea_callspec__ pmovsxdq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxdq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 23 + * ==================================================================== */ +void __bea_callspec__ pmovsxwd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxwd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 24 + * ==================================================================== */ +void __bea_callspec__ pmovsxwq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxwq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 31 + * ==================================================================== */ +void __bea_callspec__ pmovzxbd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 32 + * ==================================================================== */ +void __bea_callspec__ pmovzxbq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 30 + * ==================================================================== */ +void __bea_callspec__ pmovzxbw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 35 + * ==================================================================== */ +void __bea_callspec__ pmovzxdq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxdq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 33 + * ==================================================================== */ +void __bea_callspec__ pmovzxwd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxwd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 34 + * ==================================================================== */ +void __bea_callspec__ pmovzxwq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxwq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 28 + * ==================================================================== */ +void __bea_callspec__ pmuldq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuldq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 40 + * ==================================================================== */ +void __bea_callspec__ pmulld_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulld "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 38 0b + * ==================================================================== */ +void __bea_callspec__ pmulhrsw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhrsw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhrsw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f e4 + * ==================================================================== */ +void __bea_callspec__ pmulhuw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhuw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhuw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f f4 + * ==================================================================== */ +void __bea_callspec__ pmuludq_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuludq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuludq "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ======================================= + * 0x 0f b8 + * ======================================= */ +void __bea_callspec__ popcnt_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+DATA_TRANSFER; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popcnt "); + #endif + GvEv(pMyDisasm); + FillFlags(pMyDisasm,114); +} + + +/* ==================================================================== + * 0x 0f f6 + * ==================================================================== */ +void __bea_callspec__ psadbw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psadbw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psadbw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 00 + * ==================================================================== */ +void __bea_callspec__ pshufb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 70 + * ==================================================================== */ +void __bea_callspec__ pshufw_(PDISASM pMyDisasm) +{ + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + /* ========= 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufhw "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + /* ========= 0xf2 */ + else if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshuflw "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufd "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + GV.MemDecoration = Arg2qword; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufw "); + #endif + GV.ImmediatSize = 8; + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } +} + +/* ==================================================================== + * 0x 0f 38 08 + * ==================================================================== */ +void __bea_callspec__ psignb_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignb "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignb "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 0a + * ==================================================================== */ +void __bea_callspec__ psignd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignd "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 09 + * ==================================================================== */ +void __bea_callspec__ psignw_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignw "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignw "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f fb + * ==================================================================== */ +void __bea_callspec__ psubq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubq "); + #endif + GV.MMX_ = 1; + GxEx(pMyDisasm); + GV.MMX_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 38 17 + * ==================================================================== */ +void __bea_callspec__ ptest_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_TEST; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ptest "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } + +} + +/* ==================================================================== + * 0x 0f 6c + * ==================================================================== */ +void __bea_callspec__ punpcklqdq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklqdq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } + +} + +/* ==================================================================== + * 0x 0f 6d + * ==================================================================== */ +void __bea_callspec__ punpckhqdq_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhqdq "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + FailDecode(pMyDisasm); + } + +} + + +/* ==================================================================== + * 0x 0f 53 + * ==================================================================== */ +void __bea_callspec__ rcpps_(PDISASM pMyDisasm) +{ + /* ========== 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcpss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcpps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 3a 09 + * ==================================================================== */ +void __bea_callspec__ roundpd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundpd "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 3a 08 + * ==================================================================== */ +void __bea_callspec__ roundps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundps "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 3a 0b + * ==================================================================== */ +void __bea_callspec__ roundsd_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundsd "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 3a 0a + * ==================================================================== */ +void __bea_callspec__ roundss_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundss "); + #endif + GV.ImmediatSize = 8; + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + + } + else { + FailDecode(pMyDisasm); + } +} + + +/* ==================================================================== + * 0x 0f 52 + * ==================================================================== */ +void __bea_callspec__ rsqrtps_(PDISASM pMyDisasm) +{ + /* ========== 0xf3 */ + if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsqrtss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsqrtps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f c6 + * ==================================================================== */ +void __bea_callspec__ shufps_(PDISASM pMyDisasm) +{ + + /* ========== 0x66 */ + GV.ImmediatSize = 8; + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shufpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shufps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + (*pMyDisasm).Argument1.AccessMode = READ; + GV.EIP_++; + if (!Security(0, pMyDisasm)) return; + GV.third_arg = 1; + (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); + #ifndef BEA_LIGHT_DISASSEMBLY + (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); + #endif + (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; + (*pMyDisasm).Argument3.ArgSize = 8; + +} + + +/* ==================================================================== + * 0x 0f 51 + * ==================================================================== */ +void __bea_callspec__ sqrtps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 5c + * ==================================================================== */ +void __bea_callspec__ subps_VW(PDISASM pMyDisasm) +{ + /* ========= 0xf2 */ + if (GV.PrefRepne == 1) { + (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; + GV.MemDecoration = Arg2qword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subsd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========= 0xf3 */ + else if (GV.PrefRepe == 1) { + (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + /* ========== 0x66 */ + else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 2e + * ==================================================================== */ +void __bea_callspec__ ucomiss_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ucomisd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ucomiss "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 15 + * ==================================================================== */ +void __bea_callspec__ unpckhps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if (GV.OperandSize == 16) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpckhpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpckhps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + +/* ==================================================================== + * 0x 0f 14 + * ==================================================================== */ +void __bea_callspec__ unpcklps_(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpcklpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpcklps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} + + +/* ==================================================================== + * 0x 0f 57 + * ==================================================================== */ +void __bea_callspec__ xorps_VW(PDISASM pMyDisasm) +{ + /* ========== 0x66 */ + if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { + GV.OperandSize = GV.OriginalOperandSize; + (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xorpd "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } + else { + GV.MemDecoration = Arg2dqword; + (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; + #ifndef BEA_LIGHT_DISASSEMBLY + (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xorps "); + #endif + GV.SSE_ = 1; + GxEx(pMyDisasm); + GV.SSE_ = 0; + } +} diff --git a/csrc/Includes/instr_set/opcodes_prefixes.c b/csrc/Includes/instr_set/opcodes_prefixes.c new file mode 100644 index 0000000..f22433c --- /dev/null +++ b/csrc/Includes/instr_set/opcodes_prefixes.c @@ -0,0 +1,239 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* ==================================================================== + * Legacy Prefix F0h-Group 1 + * ==================================================================== */ +void __bea_callspec__ PrefLock(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.OperandSize = 32; +} + +/* ==================================================================== + * Legacy Prefix F2h-Group 1 + * ==================================================================== */ +void __bea_callspec__ PrefREPNE(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.RepnePrefix = SuperfluousPrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + GV.PrefRepne = 1; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.PrefRepne = 0; +} + +/* ==================================================================== + * Legacy Prefix F3h-Group 1 + * ==================================================================== */ +void __bea_callspec__ PrefREPE(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + GV.PrefRepe = 1; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + GV.PrefRepe = 0; +} + +/* ==================================================================== + * Legacy Prefix 2Eh-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGCS(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.CSPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Legacy Prefix 3Eh-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGDS(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.DSPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Legacy Prefix 26h-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGES(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.ESPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Legacy Prefix 64h-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGFS(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.FSPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + GV.SEGMENTFS = 1; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Legacy Prefix 65h-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGGS(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.GSPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + + +/* ==================================================================== + * Legacy Prefix 36h-Group 2 + * ==================================================================== */ +void __bea_callspec__ PrefSEGSS(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.SSPrefix = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Legacy Prefix 66h-Group 3 + * ==================================================================== */ +void __bea_callspec__ PrefOpSize(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.OperandSize = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + GV.OriginalOperandSize = GV.OperandSize; /* if GV.OperandSize is used as a mandatory prefix, keep the real operandsize value */ + if (GV.Architecture == 16) { + GV.OperandSize = 32; + } + else { + if (GV.OperandSize != 64) { + GV.OperandSize = 16; + } + } + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + if (GV.Architecture == 16) { + GV.OperandSize = 16; + } + else { + GV.OperandSize = 32; + } +} + +/* ==================================================================== + * Legacy Prefix 67h-Group 4 + * ==================================================================== */ +void __bea_callspec__ PrefAdSize(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + (*pMyDisasm).Prefix.AddressSize = InUsePrefix; + GV.EIP_++; + (*pMyDisasm).Prefix.Number++; + GV.NB_PREFIX++; + if (GV.Architecture == 16) { + GV.AddressSize = GV.AddressSize << 1; + } + else { + GV.AddressSize = GV.AddressSize >> 1; + } + + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); + (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); + if (GV.Architecture == 16) { + GV.AddressSize = GV.AddressSize >> 1; + } + else { + GV.AddressSize = GV.AddressSize << 1; + } + +} + +/* ==================================================================== + * Escape Prefix 0Fh-two bytes opcodes + * ==================================================================== */ +void __bea_callspec__ Esc_2byte(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + GV.EIP_++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F00; + (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} + +/* ==================================================================== + * Escape Prefix 0F38h-three bytes opcodes + * ==================================================================== */ +void __bea_callspec__ Esc_tableA4(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + GV.EIP_++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3800; + (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} +/* ==================================================================== + * Escape Prefix 0F3Ah-three bytes opcodes + * ==================================================================== */ +void __bea_callspec__ Esc_tableA5(PDISASM pMyDisasm) +{ + if (!Security(0, pMyDisasm)) return; + GV.EIP_++; + (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3A00; + (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); +} diff --git a/csrc/Includes/internal_datas.h b/csrc/Includes/internal_datas.h new file mode 100644 index 0000000..8bb45fb --- /dev/null +++ b/csrc/Includes/internal_datas.h @@ -0,0 +1,560 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +/* Define prefix GV aka GlobalVariable - used instead of global internal variables to make BeaEngine thread-safe */ + +#define GV (*pMyDisasm).Reserved_ + +/* Define constants to identify the position and type of decoration used in case of memory argument */ + +#define Arg1byte 1 +#define Arg1word 2 +#define Arg1dword 3 +#define Arg1qword 4 +#define Arg1multibytes 5 +#define Arg1tbyte 6 +#define Arg1fword 7 +#define Arg1dqword 8 + +#define Arg2byte 101 +#define Arg2word 102 +#define Arg2dword 103 +#define Arg2qword 104 +#define Arg2multibytes 105 +#define Arg2tbyte 106 +#define Arg2fword 107 +#define Arg2dqword 108 + +EFLStruct EFLAGS_TABLE[] = { + {UN_, UN_, UN_, MO_, UN_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 0-AAA */ + {UN_, MO_, MO_, UN_, MO_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 1-AAD */ + {UN_, MO_, MO_, UN_, MO_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 2-AAM */ + {UN_, UN_, UN_, MO_, UN_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 3-AAS */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 4-ADC */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 5-ADD */ + {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 6-AND */ + {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 7-ARPL */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 8-BOUND */ + {UN_, UN_, MO_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 9-BSF/BSR */ + + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 10-BSWAP */ + {UN_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 11-BT/BTS/BTR/BTC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 12-CALL */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 13-CBW */ + {0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 14-CLC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0, 0}, /* 15-CLD */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , 0, 0}, /* 16-CLI */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 17-CLTS */ + {0 , 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 18-CMC */ + {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0, 0}, /* 19-CMOVcc */ + + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 20-CMP */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 21-CMPS */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 22-CMPXCHG */ + {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 23-CMPXCHGG8B */ + {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 24-COMSID */ + {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 25-COMISS */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 26-CPUID */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 27-CWD */ + {UN_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 28-DAA */ + {UN_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 29-DAS */ + + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 30-DEC */ + {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 31-DIV */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 32-ENTER */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 33-ESC */ + {0 , 0 , TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0, 0}, /* 34-FCMOV */ + {0 , 0 , MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 35-FCOMI FCOMIP FUCMI FUCMIP */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 36-HLT */ + {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 37-IDIV */ + {MO_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 38-IMUL */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 39-IN */ + + {MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 40-INC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0, 0}, /* 41-INS */ + {0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , RE_, 0, 0}, /* 42-INT */ + {TE_, 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , RE_, 0, 0}, /* 43-INTO */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 44-INVD */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 45-INVLPG */ + {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 46-UCOMSID */ + {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 47-UCOMISS */ + {PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, TE_, 0, 0}, /* 48-IRET */ + {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0, 0}, /* 49-Jcc */ + + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 50-JCXZ */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 51-JMP */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 52-LAHF */ + {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 53-LAR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 54-LDS LES LSS LFS LGS */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 55-LEA */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 56-LEAVE */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 57-LGDT LIDT LLDT LMSW */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 58-LOCK */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0, 0}, /* 59-LODS */ + + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 60-LOOP */ + {0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 61-LOOPE LOOPNE */ + {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 62-LSL */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 63-LTR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 64-MONITOR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 65-MWAIT */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 66-MOV */ + {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0, 0}, /* 67-MOV control, debug, test */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0, 0}, /* 68-MOVS */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 69-MOVSX MOVZX */ + + {MO_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 70-MUL */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 71-NEG */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 72-NOP */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 73-NOT */ + {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 74-OR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 75-OUT */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0, 0}, /* 76-OUTS */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 77-POP POPA */ + {PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, 0, 0}, /* 78-POPF */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 79-PUSH PUSHA PUSHF */ + + {MO_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 80-RCL RCR 1 */ + {UN_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 81-RCL RCR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 82-RDMSR */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 83-RDPMC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 84-RDTSC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 85-REP REPE REPNE */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 86-RET */ + {MO_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 87-ROL ROR 1 */ + {UN_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 88-ROL ROR */ + {MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, 0}, /* 89-RSM */ + + {0 , PR_, PR_, PR_, PR_, PR_, 0 , 0 , 0 , 0 , 0, 0}, /* 90-SAHF */ + {MO_, MO_, MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 91-SAL SAR SHL SHR 1 */ + {0 , MO_, MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 92-SAL SAR SHL SHR */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 93-SBB */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 94-SCAS */ + {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0, 0}, /* 95-SETcc */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 96-SGDT SIDT SLDT SMSW */ + {UN_, MO_, MO_, UN_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 97-SHLD SHRD */ + {0 , 0 , 0 , 0 , 0 , SE_, 0 , 0 , 0 , 0 , 0, 0}, /* 98-STC */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , SE_, 0 , 0, 0}, /* 99-STD */ + + {0 , 0 , 0 , 0 , 0 , 0 , 0 , SE_, 0 , 0 , 0, 0}, /* 100-STI */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 101-STOS */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 102-STR */ + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 103-SUB */ + {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 104-TEST */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 105-UD2 */ + {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 106-VERR VERRW */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 107-WAIT */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 108-WBINVD */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 109-WRMSR */ + + {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0, 0}, /* 110-XADD */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 111-XCHG */ + {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 112-XLAT */ + {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 113-XOR */ + + {RE_, RE_, MO_, RE_, RE_, RE_, 0 , 0 , 0 , 0 , 0, 0}, /* 114-POPCNT */ + + {TE_, TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /*115 -jg jnle jng jle http://ref.x86asm.net/coder.html */ + {TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /*116 -jo jno http://ref.x86asm.net/coder.html */ + {0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0, 0}, /*117 -jc jnc jb jnb jnae jae http://ref.x86asm.net/coder.html */ + {0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /*118 -jz jnz je jne http://ref.x86asm.net/coder.html */ + {0 , 0 , TE_, 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0, 0}, /*119 -jbe jnbe jna ja http://ref.x86asm.net/coder.html */ + + {0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 120 - js jns http://ref.x86asm.net/coder.html */ + {0 , 0 , 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0, 0}, /* 121 - jp jpe jnp jpo http://ref.x86asm.net/coder.html */ + {TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0} /* 122 - jl jnge jnl jge http://ref.x86asm.net/coder.html */ + + }; +/* ===================================================== + * To make a tabulation between mnemonic and first argument + * ===================================================== */ +char space_tab[11][16] = { + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + +}; +/* ===================================================== + * Segment registers + * ===================================================== */ +char SegmentRegs[7][4] = { + "??:", /* +0 */ + "es:", /* +1 */ + "ds:", /* +2 */ + "fs:", /* +3 */ + "gs:", /* +4 */ + "cs:", /* +5 */ + "ss:", /* +6 */ +}; +/* ===================================================== + * AT&T Suffixes + * ===================================================== */ +char ATSuffixes[8][4] = { + "b ", /* GV.MemDecoration == 1 */ + "w ", /* GV.MemDecoration == 2 */ + "l ", /* GV.MemDecoration == 3 */ + "q ", /* GV.MemDecoration == 4 */ + " ", /* GV.MemDecoration == 5 (multibytes) */ + "t ", /* GV.MemDecoration == 6 */ + " ", /* GV.MemDecoration == 7 (fword) */ + " ", /* GV.MemDecoration == 8 (dqword) */ +}; + +/* ===================================================== + * MASM Prefixes for MemoryType + * ===================================================== */ + +char MasmPrefixes[8][16] = { + "byte ptr ", /* GV.MemDecoration == 1 */ + "word ptr ", /* GV.MemDecoration == 2 */ + "dword ptr ", /* GV.MemDecoration == 3 */ + "qword ptr ", /* GV.MemDecoration == 4 */ + " ", /* GV.MemDecoration == 5 (multibytes) */ + "tbyte ptr ", /* GV.MemDecoration == 6 */ + "fword ptr ", /* GV.MemDecoration == 7 (fword) */ + "dqword ptr ", /* GV.MemDecoration == 8 (dqword) */ +}; + +/* ===================================================== + * NASM Prefixes for MemoryType + * ===================================================== */ +char NasmPrefixes[8][8] = { + "byte ", /* GV.MemDecoration == 1 */ + "word ", /* GV.MemDecoration == 2 */ + " ", /* GV.MemDecoration == 3 */ + "qword ", /* GV.MemDecoration == 4 */ + " ", /* GV.MemDecoration == 5 (multibytes) */ + "tword ", /* GV.MemDecoration == 6 */ + " ", /* GV.MemDecoration == 7 (fword) */ + " ", /* GV.MemDecoration == 8 (dqword) */ +}; + + + +/* ===================================================== + * GOASM Prefixes for MemoryType + * ===================================================== */ +char GoAsmPrefixes[8][4] = { + "b ", /* GV.MemDecoration == 1 */ + "w ", /* GV.MemDecoration == 2 */ + "d ", /* GV.MemDecoration == 3 */ + "q ", /* GV.MemDecoration == 4 */ + " ", /* GV.MemDecoration == 5 (multibytes) */ + "t ", /* GV.MemDecoration == 6 */ + " ", /* GV.MemDecoration == 7 (fword) */ + " ", /* GV.MemDecoration == 8 (dqword) */ +}; + + +/* ===================================================== + * Segment registers + * ===================================================== */ +char RegistersSEG[16][8] = { + "es", /* +0 */ + "cs", /* +1 */ + "ss", /* +2 */ + "ds", /* +3 */ + "fs", /* +4 */ + "gs", /* +5 */ + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", + "seg?", +}; + +/* ===================================================== + * FPU Registers + * ===================================================== */ +char RegistersFPU_Masm[8][8] = { + "st(0)", /* +0 */ + "st(1)", /* +1 */ + "st(2)", /* +2 */ + "st(3)", /* +3 */ + "st(4)", /* +4 */ + "st(5)", /* +5 */ + "st(6)", /* +6 */ + "st(7)", /* +7 */ +}; + +char RegistersFPU_Nasm[8][8] = { + "st0", /* +0 */ + "st1", /* +1 */ + "st2", /* +2 */ + "st3", /* +3 */ + "st4", /* +4 */ + "st5", /* +5 */ + "st6", /* +6 */ + "st7", /* +7 */ +}; + +/* ===================================================== + * debug registers + * ===================================================== */ +char RegistersDR[16][8] = { + "dr0", /* +0 */ + "dr1", /* +1 */ + "dr2", /* +2 */ + "dr3", /* +3 */ + "dr4", /* +4 */ + "dr5", /* +5 */ + "dr6", /* +6 */ + "dr7", /* +7 */ + "dr8", /* +8 */ + "dr9", /* +9 */ + "dr10", /* +10 */ + "dr11", /* +11 */ + "dr12", /* +12 */ + "dr13", /* +13 */ + "dr14", /* +14 */ + "dr15", /* +15 */ +}; + +/* ===================================================== + * debug registers-AT&T syntax + * ===================================================== */ +char RegistersDR_AT[16][8] = { + "db0", /* +0 */ + "db1", /* +1 */ + "db2", /* +2 */ + "db3", /* +3 */ + "db4", /* +4 */ + "db5", /* +5 */ + "db6", /* +6 */ + "db7", /* +7 */ + "db8", /* +8 */ + "db9", /* +9 */ + "db10", /* +10 */ + "db11", /* +11 */ + "db12", /* +12 */ + "db13", /* +13 */ + "db14", /* +14 */ + "db15", /* +15 */ +}; + + +/* ===================================================== + * control registers + * ===================================================== */ +char RegistersCR[16][8] = { + "cr0", /* +0 */ + "cr1", /* +1 */ + "cr2", /* +2 */ + "cr3", /* +3 */ + "cr4", /* +4 */ + "cr5", /* +5 */ + "cr6", /* +6 */ + "cr7", /* +7 */ + "cr8", /* +8 */ + "cr9", /* +9 */ + "cr10", /* +10 */ + "cr11", /* +11 */ + "cr12", /* +12 */ + "cr13", /* +13 */ + "cr14", /* +14 */ + "cr15", /* +15 */ +}; + + + +/* ===================================================== + * 64 bits registers + * ===================================================== */ +char Registers64Bits[16][4] = { + "rax", /* +0 */ + "rcx", /* +1 */ + "rdx", /* +2 */ + "rbx", /* +3 */ + "rsp", /* +4 */ + "rbp", /* +5 */ + "rsi", /* +6 */ + "rdi", /* +7 */ + "r8", /* +8 */ + "r9", /* +9 */ + "r10", /* +10 */ + "r11", /* +11 */ + "r12", /* +12 */ + "r13", /* +13 */ + "r14", /* +14 */ + "r15", /* +15 */ +}; + +/* ===================================================== + * 32 bits registers + * ===================================================== */ +char Registers32Bits[16][8] = { + "eax", + "ecx", + "edx", + "ebx", + "esp", + "ebp", + "esi", + "edi", + "r8d", + "r9d", + "r10d", + "r11d", + "r12d", + "r13d", + "r14d", + "r15d", +}; + +/* ===================================================== + * 16 bits registers + * ===================================================== */ +char Registers16Bits[16][8] = { + "ax", + "cx", + "dx", + "bx", + "sp", + "bp", + "si", + "di", + "r8w", + "r9w", + "r10w", + "r11w", + "r12w", + "r13w", + "r14w", + "r15w", +}; +/* ===================================================== + * 8 bits registers + * ===================================================== */ +char Registers8BitsLegacy[8][4] = { + "al", + "cl", + "dl", + "bl", + "ah", + "ch", + "dh", + "bh", +}; + +Int32 REGS8BITS[] = { + REG0, + REG1, + REG2, + REG3, + REG0, + REG1, + REG2, + REG3, +}; + +/* ===================================================== + * 8 bits registers + * ===================================================== */ +char Registers8Bits[16][8] = { + "al", + "cl", + "dl", + "bl", + "spl", + "bpl", + "sil", + "dil", + "r8L", + "r9L", + "r10L", + "r11L", + "r12L", + "r13L", + "r14L", + "r15L", +}; +/* ===================================================== + * MMX Registers + * ===================================================== */ +char RegistersMMX[8][4] = { + "mm0", + "mm1", + "mm2", + "mm3", + "mm4", + "mm5", + "mm6", + "mm7", +}; + +/* ===================================================== + * SSE Registers + * ===================================================== */ +char RegistersSSE[16][8] = { + "xmm0", + "xmm1", + "xmm2", + "xmm3", + "xmm4", + "xmm5", + "xmm6", + "xmm7", + "xmm8", /* SSE3, SSSE3, SSE4 */ + "xmm9", /* SSE3, SSSE3, SSE4 */ + "xmm10", /* SSE3, SSSE3, SSE4 */ + "xmm11", /* SSE3, SSSE3, SSE4 */ + "xmm12", /* SSE3, SSSE3, SSE4 */ + "xmm13", /* SSE3, SSSE3, SSE4 */ + "xmm14", /* SSE3, SSSE3, SSE4 */ + "xmm15", /* SSE3, SSSE3, SSE4 */ +}; + +Int32 REGS[] = { + REG0, /* REG0 */ + REG1, /* REG1 */ + REG2, /* REG2 */ + REG3, /* REG3 */ + REG4, /* REG4 */ + REG5, /* REG5 */ + REG6, /* REG6 */ + REG7, /* REG7 */ + REG8, /* REG8 */ + REG9, /* REG9 */ + REG10, /* REG10 */ + REG11, /* REG11 */ + REG12, /* REG12 */ + REG13, /* REG13 */ + REG14, /* REG14 */ + REG15, /* REG15 */ +}; + +char BXSI_[] = "bx+si"; +char BXDI_[] = "bx+di"; +char BPSI_[] = "bp+si"; +char BPDI_[] = "bp+di"; + + + diff --git a/csrc/Includes/protos.h b/csrc/Includes/protos.h new file mode 100644 index 0000000..7f8568b --- /dev/null +++ b/csrc/Includes/protos.h @@ -0,0 +1,705 @@ +/* Copyright 2006-2009, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + + +/* ====================================== Routines_MODRM */ +void __bea_callspec__ MOD_RM(ARGTYPE*, PDISASM); +void __bea_callspec__ Reg_Opcode(ARGTYPE*, PDISASM); + +void __bea_callspec__ Addr_EAX(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ECX(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDX(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EBX(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_SIB(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ESI(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDI(ARGTYPE*, PDISASM); + +void __bea_callspec__ Addr_EAX_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ECX_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDX_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EBX_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_SIB_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EBP_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ESI_disp8(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDI_disp8(ARGTYPE*, PDISASM); + +void __bea_callspec__ Addr_EAX_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ECX_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDX_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EBX_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_SIB_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EBP_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_ESI_disp32(ARGTYPE*, PDISASM); +void __bea_callspec__ Addr_EDI_disp32(ARGTYPE*, PDISASM); + +void __bea_callspec__ _rEAX(ARGTYPE*, PDISASM); +void __bea_callspec__ _rECX(ARGTYPE*, PDISASM); +void __bea_callspec__ _rEDX(ARGTYPE*, PDISASM); +void __bea_callspec__ _rEBX(ARGTYPE*, PDISASM); +void __bea_callspec__ _rESP(ARGTYPE*, PDISASM); +void __bea_callspec__ _rEBP(ARGTYPE*, PDISASM); +void __bea_callspec__ _rESI(ARGTYPE*, PDISASM); +void __bea_callspec__ _rEDI(ARGTYPE*, PDISASM); + +size_t __bea_callspec__ SIB_0(ARGTYPE*, size_t, PDISASM); +size_t __bea_callspec__ SIB_1(ARGTYPE*, size_t, PDISASM); +size_t __bea_callspec__ SIB_2(ARGTYPE*, size_t, PDISASM); +size_t __bea_callspec__ SIB_3(ARGTYPE*, size_t, PDISASM); + +/* ====================================== Routines_Disasm */ +void __bea_callspec__ CompleteInstructionFields (PDISASM); +void __bea_callspec__ EbGb(PDISASM); +void __bea_callspec__ EvGv(PDISASM); +void __bea_callspec__ EvIb(PDISASM); +void __bea_callspec__ ExGx(PDISASM); +void __bea_callspec__ EvIv(PDISASM); +void __bea_callspec__ EbIb(PDISASM); +void __bea_callspec__ Eb(PDISASM); +void __bea_callspec__ Ev(PDISASM); +void __bea_callspec__ GvEv(PDISASM); +void __bea_callspec__ GvEb(PDISASM); +void __bea_callspec__ GxEx(PDISASM); +void __bea_callspec__ GvEw(PDISASM); +void __bea_callspec__ GbEb(PDISASM); +void __bea_callspec__ ALIb(PDISASM); +void __bea_callspec__ eAX_Iv(PDISASM); +int __bea_callspec__ AnalyzeOpcode (PDISASM); +int __bea_callspec__ Security(int, PDISASM); +void __bea_callspec__ CalculateRelativeAddress(UInt64 *, Int64, PDISASM); +size_t __bea_callspec__ CopyFormattedNumber(PDISASM, char*, const char*, Int64); +void __bea_callspec__ BuildCompleteInstruction(PDISASM); +void __bea_callspec__ BuildCompleteInstructionATSyntax(PDISASM); +int __bea_callspec__ InitVariables (PDISASM); +void __bea_callspec__ FillFlags(PDISASM, int); +void __bea_callspec__ FillSegmentsRegisters (PDISASM); +void __bea_callspec__ FixArgSizeForMemoryOperand (PDISASM); +void __bea_callspec__ FixREXPrefixes (PDISASM); + +/* ====================================== opcodes_prefix */ +void __bea_callspec__ PrefLock(PDISASM); +void __bea_callspec__ PrefREPNE(PDISASM); +void __bea_callspec__ PrefREPE(PDISASM); +void __bea_callspec__ PrefSEGCS(PDISASM); +void __bea_callspec__ PrefSEGDS(PDISASM); +void __bea_callspec__ PrefSEGES(PDISASM); +void __bea_callspec__ PrefSEGFS(PDISASM); +void __bea_callspec__ PrefSEGGS(PDISASM); +void __bea_callspec__ PrefSEGSS(PDISASM); +void __bea_callspec__ PrefOpSize(PDISASM); +void __bea_callspec__ PrefAdSize(PDISASM); +void __bea_callspec__ Esc_2byte(PDISASM); +void __bea_callspec__ Esc_tableA4(PDISASM); +void __bea_callspec__ Esc_tableA5(PDISASM); + + +/* ====================================== opcodes_A_M */ +void __bea_callspec__ FailDecode(PDISASM); +void __bea_callspec__ aaa_(PDISASM); +void __bea_callspec__ aad_(PDISASM); +void __bea_callspec__ aas_(PDISASM); +void __bea_callspec__ aam_(PDISASM); +void __bea_callspec__ add_EbGb(PDISASM); +void __bea_callspec__ add_EvGv(PDISASM); +void __bea_callspec__ add_GbEb(PDISASM); +void __bea_callspec__ add_GvEv(PDISASM); +void __bea_callspec__ add_ALIb(PDISASM); +void __bea_callspec__ add_eAX_Iv(PDISASM); +void __bea_callspec__ adc_ALIb(PDISASM); +void __bea_callspec__ adc_eAX_Iv(PDISASM); +void __bea_callspec__ adc_EbGb(PDISASM); +void __bea_callspec__ adc_EvGv(PDISASM); +void __bea_callspec__ adc_GbEb(PDISASM); +void __bea_callspec__ adc_GvEv(PDISASM); +void __bea_callspec__ and_EbGb(PDISASM); +void __bea_callspec__ and_ALIb(PDISASM); +void __bea_callspec__ and_eAX_Iv(PDISASM); +void __bea_callspec__ and_EvGv(PDISASM); +void __bea_callspec__ and_GbEb(PDISASM); +void __bea_callspec__ and_GvEv(PDISASM); +void __bea_callspec__ arpl_(PDISASM); +void __bea_callspec__ bound_(PDISASM); +void __bea_callspec__ bswap_eax(PDISASM); +void __bea_callspec__ bswap_ebp(PDISASM); +void __bea_callspec__ bswap_ebx(PDISASM); +void __bea_callspec__ bswap_ecx(PDISASM); +void __bea_callspec__ bswap_edi(PDISASM); +void __bea_callspec__ bswap_edx(PDISASM); +void __bea_callspec__ bswap_esi(PDISASM); +void __bea_callspec__ bswap_esp(PDISASM); +void __bea_callspec__ bsf_GvEv(PDISASM); +void __bea_callspec__ bsr_GvEv(PDISASM); +void __bea_callspec__ btc_EvGv(PDISASM); +void __bea_callspec__ btr_EvGv(PDISASM); +void __bea_callspec__ bt_EvGv(PDISASM); +void __bea_callspec__ bts_EvGv(PDISASM); +void __bea_callspec__ callf_(PDISASM); +void __bea_callspec__ call_(PDISASM); +void __bea_callspec__ cdq_(PDISASM); +void __bea_callspec__ clts_(PDISASM); +void __bea_callspec__ cmc_(PDISASM); +void __bea_callspec__ cmovo_(PDISASM); +void __bea_callspec__ cmovno_(PDISASM); +void __bea_callspec__ cmovb_(PDISASM); +void __bea_callspec__ cmovnb_(PDISASM); +void __bea_callspec__ cmove_(PDISASM); +void __bea_callspec__ cmovne_(PDISASM); +void __bea_callspec__ cmovbe_(PDISASM); +void __bea_callspec__ cmovnbe_(PDISASM); +void __bea_callspec__ cmovs_(PDISASM); +void __bea_callspec__ cmovns_(PDISASM); +void __bea_callspec__ cmovp_(PDISASM); +void __bea_callspec__ cmovnp_(PDISASM); +void __bea_callspec__ cmovl_(PDISASM); +void __bea_callspec__ cmovnl_(PDISASM); +void __bea_callspec__ cmovle_(PDISASM); +void __bea_callspec__ cmovnle_(PDISASM); +void __bea_callspec__ cmpx_EbGb(PDISASM); +void __bea_callspec__ cmpx_EvGv(PDISASM); +void __bea_callspec__ cmp_EbGb(PDISASM); +void __bea_callspec__ cmp_EvGv(PDISASM); +void __bea_callspec__ cmp_GbEb(PDISASM); +void __bea_callspec__ cmp_GvEv(PDISASM); +void __bea_callspec__ cmp_ALIb(PDISASM); +void __bea_callspec__ cmp_eAX_Iv(PDISASM); +void __bea_callspec__ cmpsb_(PDISASM); +void __bea_callspec__ cmps_(PDISASM); +void __bea_callspec__ cwde_(PDISASM); +void __bea_callspec__ clc_(PDISASM); +void __bea_callspec__ cld_(PDISASM); +void __bea_callspec__ cli_(PDISASM); +void __bea_callspec__ cpuid_(PDISASM); +void __bea_callspec__ daa_(PDISASM); +void __bea_callspec__ das_(PDISASM); +void __bea_callspec__ dec_eax(PDISASM); +void __bea_callspec__ dec_ecx(PDISASM); +void __bea_callspec__ dec_edx(PDISASM); +void __bea_callspec__ dec_ebx(PDISASM); +void __bea_callspec__ dec_esp(PDISASM); +void __bea_callspec__ dec_ebp(PDISASM); +void __bea_callspec__ dec_esi(PDISASM); +void __bea_callspec__ dec_edi(PDISASM); +void __bea_callspec__ enter_(PDISASM); +void __bea_callspec__ femms_(PDISASM); +void __bea_callspec__ hlt_(PDISASM); +void __bea_callspec__ invd_(PDISASM); +void __bea_callspec__ inc_eax(PDISASM); +void __bea_callspec__ inc_ecx(PDISASM); +void __bea_callspec__ inc_edx(PDISASM); +void __bea_callspec__ inc_ebx(PDISASM); +void __bea_callspec__ inc_esp(PDISASM); +void __bea_callspec__ inc_ebp(PDISASM); +void __bea_callspec__ inc_esi(PDISASM); +void __bea_callspec__ inc_edi(PDISASM); +void __bea_callspec__ iret_(PDISASM); +void __bea_callspec__ in_ALDX(PDISASM); +void __bea_callspec__ in_ALIb(PDISASM); +void __bea_callspec__ in_eAX_Ib(PDISASM); +void __bea_callspec__ insb_(PDISASM); +void __bea_callspec__ ins_(PDISASM); +void __bea_callspec__ into_(PDISASM); +void __bea_callspec__ in_eAX(PDISASM); +void __bea_callspec__ int_(PDISASM); +void __bea_callspec__ int1_(PDISASM); +void __bea_callspec__ int3_(PDISASM); +void __bea_callspec__ imul_GvEvIv(PDISASM); +void __bea_callspec__ imul_GvEv(PDISASM); +void __bea_callspec__ imul_GvEvIb(PDISASM); +void __bea_callspec__ jo_(PDISASM); +void __bea_callspec__ jno_(PDISASM); +void __bea_callspec__ jc_(PDISASM); +void __bea_callspec__ jnc_(PDISASM); +void __bea_callspec__ je_(PDISASM); +void __bea_callspec__ jne_(PDISASM); +void __bea_callspec__ jbe_(PDISASM); +void __bea_callspec__ jnbe_(PDISASM); +void __bea_callspec__ js_(PDISASM); +void __bea_callspec__ jns_(PDISASM); +void __bea_callspec__ jp_(PDISASM); +void __bea_callspec__ jnp_(PDISASM); +void __bea_callspec__ jl_(PDISASM); +void __bea_callspec__ jnl_(PDISASM); +void __bea_callspec__ jle_(PDISASM); +void __bea_callspec__ jnle_(PDISASM); +void __bea_callspec__ jo_near(PDISASM); +void __bea_callspec__ jno_near(PDISASM); +void __bea_callspec__ jc_near(PDISASM); +void __bea_callspec__ jnc_near(PDISASM); +void __bea_callspec__ je_near(PDISASM); +void __bea_callspec__ jne_near(PDISASM); +void __bea_callspec__ jbe_near(PDISASM); +void __bea_callspec__ ja_near(PDISASM); +void __bea_callspec__ js_near(PDISASM); +void __bea_callspec__ jns_near(PDISASM); +void __bea_callspec__ jp_near(PDISASM); +void __bea_callspec__ jnp_near(PDISASM); +void __bea_callspec__ jl_near(PDISASM); +void __bea_callspec__ jnl_near(PDISASM); +void __bea_callspec__ jle_near(PDISASM); +void __bea_callspec__ jnle_near(PDISASM); +void __bea_callspec__ jecxz_(PDISASM); +void __bea_callspec__ jmp_near(PDISASM); +void __bea_callspec__ jmp_far(PDISASM); +void __bea_callspec__ jmp_short(PDISASM); +void __bea_callspec__ lahf_(PDISASM); +void __bea_callspec__ lar_GvEw(PDISASM); +void __bea_callspec__ lds_GvM(PDISASM); +void __bea_callspec__ leave_(PDISASM); +void __bea_callspec__ lea_GvM(PDISASM); +void __bea_callspec__ les_GvM(PDISASM); +void __bea_callspec__ lodsb_(PDISASM); +void __bea_callspec__ lodsw_(PDISASM); +void __bea_callspec__ loop_(PDISASM); +void __bea_callspec__ loope_(PDISASM); +void __bea_callspec__ loopne_(PDISASM); +void __bea_callspec__ lsl_GvEw(PDISASM); +void __bea_callspec__ lss_Mp(PDISASM); +void __bea_callspec__ lfs_Mp(PDISASM); +void __bea_callspec__ lgs_Mp(PDISASM); +void __bea_callspec__ mov_RdCd(PDISASM); +void __bea_callspec__ mov_RdDd(PDISASM); +void __bea_callspec__ mov_CdRd(PDISASM); +void __bea_callspec__ mov_DdRd(PDISASM); +void __bea_callspec__ mov_EbGb(PDISASM); +void __bea_callspec__ mov_EvGv(PDISASM); +void __bea_callspec__ mov_GbEb(PDISASM); +void __bea_callspec__ mov_GvEv(PDISASM); +void __bea_callspec__ mov_ALOb(PDISASM); +void __bea_callspec__ mov_eAXOv(PDISASM); +void __bea_callspec__ mov_ObAL(PDISASM); +void __bea_callspec__ mov_OveAX(PDISASM); +void __bea_callspec__ mov_ALIb(PDISASM); +void __bea_callspec__ mov_CLIb(PDISASM); +void __bea_callspec__ mov_DLIb(PDISASM); +void __bea_callspec__ mov_BLIb(PDISASM); +void __bea_callspec__ mov_AHIb(PDISASM); +void __bea_callspec__ mov_CHIb(PDISASM); +void __bea_callspec__ mov_DHIb(PDISASM); +void __bea_callspec__ mov_BHIb(PDISASM); +void __bea_callspec__ movs_(PDISASM); +void __bea_callspec__ movsw_(PDISASM); +void __bea_callspec__ movzx_GvEb(PDISASM); +void __bea_callspec__ movsx_GvEb(PDISASM); +void __bea_callspec__ movzx_GvEw(PDISASM); +void __bea_callspec__ movsx_GvEw(PDISASM); +void __bea_callspec__ mov_EAX(PDISASM); +void __bea_callspec__ mov_ECX(PDISASM); +void __bea_callspec__ mov_EDX(PDISASM); +void __bea_callspec__ mov_EBX(PDISASM); +void __bea_callspec__ mov_ESP(PDISASM); +void __bea_callspec__ mov_EBP(PDISASM); +void __bea_callspec__ mov_ESI(PDISASM); +void __bea_callspec__ mov_EDI(PDISASM); +void __bea_callspec__ mov_EbIb(PDISASM); +void __bea_callspec__ mov_EvIv(PDISASM); +void __bea_callspec__ mov_EwSreg(PDISASM); +void __bea_callspec__ mov_SregEw(PDISASM); + +/* ====================================== opcodes_N_Z */ +void __bea_callspec__ nop_(PDISASM); +void __bea_callspec__ nop_Ev(PDISASM); +void __bea_callspec__ hint_nop(PDISASM); +void __bea_callspec__ or_EbGb(PDISASM); +void __bea_callspec__ or_EvGv(PDISASM); +void __bea_callspec__ or_GbEb(PDISASM); +void __bea_callspec__ or_GvEv(PDISASM); +void __bea_callspec__ or_ALIb(PDISASM); +void __bea_callspec__ or_eAX_Iv(PDISASM); +void __bea_callspec__ outsb_(PDISASM); +void __bea_callspec__ outsw_(PDISASM); +void __bea_callspec__ out_IbAL(PDISASM); +void __bea_callspec__ out_Ib_eAX(PDISASM); +void __bea_callspec__ out_DXAL(PDISASM); +void __bea_callspec__ out_DXeAX(PDISASM); +void __bea_callspec__ pop_Ev(PDISASM); +void __bea_callspec__ pop_eax(PDISASM); +void __bea_callspec__ pop_ecx(PDISASM); +void __bea_callspec__ pop_edx(PDISASM); +void __bea_callspec__ pop_ebx(PDISASM); +void __bea_callspec__ pop_esp(PDISASM); +void __bea_callspec__ pop_ebp(PDISASM); +void __bea_callspec__ pop_esi(PDISASM); +void __bea_callspec__ pop_edi(PDISASM); +void __bea_callspec__ pop_ds(PDISASM); +void __bea_callspec__ pop_es(PDISASM); +void __bea_callspec__ pop_fs(PDISASM); +void __bea_callspec__ pop_gs(PDISASM); +void __bea_callspec__ pop_ss(PDISASM); +void __bea_callspec__ popfd_(PDISASM); +void __bea_callspec__ popad_(PDISASM); +void __bea_callspec__ push_eax(PDISASM); +void __bea_callspec__ push_ecx(PDISASM); +void __bea_callspec__ push_edx(PDISASM); +void __bea_callspec__ push_ebx(PDISASM); +void __bea_callspec__ push_esp(PDISASM); +void __bea_callspec__ push_ebp(PDISASM); +void __bea_callspec__ push_esi(PDISASM); +void __bea_callspec__ push_edi(PDISASM); +void __bea_callspec__ push_cs(PDISASM); +void __bea_callspec__ push_ds(PDISASM); +void __bea_callspec__ push_es(PDISASM); +void __bea_callspec__ push_fs(PDISASM); +void __bea_callspec__ push_gs(PDISASM); +void __bea_callspec__ push_ss(PDISASM); +void __bea_callspec__ pushfd_(PDISASM); +void __bea_callspec__ pushad_(PDISASM); +void __bea_callspec__ push_Iv(PDISASM); +void __bea_callspec__ push_Ib(PDISASM); +void __bea_callspec__ pushfd_(PDISASM); +void __bea_callspec__ pushad_(PDISASM); +void __bea_callspec__ retn_(PDISASM); +void __bea_callspec__ ret_(PDISASM); +void __bea_callspec__ retf_(PDISASM); +void __bea_callspec__ retf_Iw(PDISASM); +void __bea_callspec__ rdtsc_(PDISASM); +void __bea_callspec__ rdmsr_(PDISASM); +void __bea_callspec__ rdpmc_(PDISASM); +void __bea_callspec__ rsm_(PDISASM); +void __bea_callspec__ sysenter_(PDISASM); +void __bea_callspec__ sysexit_(PDISASM); +void __bea_callspec__ sahf_(PDISASM); +void __bea_callspec__ salc_(PDISASM); +void __bea_callspec__ scasb_(PDISASM); +void __bea_callspec__ scas_(PDISASM); +void __bea_callspec__ stc_(PDISASM); +void __bea_callspec__ sti_(PDISASM); +void __bea_callspec__ stos_(PDISASM); +void __bea_callspec__ stosw_(PDISASM); +void __bea_callspec__ syscall_(PDISASM); +void __bea_callspec__ sysret_(PDISASM); +void __bea_callspec__ sbb_EbGb(PDISASM); +void __bea_callspec__ sbb_EvGv(PDISASM); +void __bea_callspec__ sbb_GbEb(PDISASM); +void __bea_callspec__ sbb_GvEv(PDISASM); +void __bea_callspec__ sbb_ALIb(PDISASM); +void __bea_callspec__ sbb_eAX_Iv(PDISASM); +void __bea_callspec__ seto_(PDISASM); +void __bea_callspec__ setno_(PDISASM); +void __bea_callspec__ setb_(PDISASM); +void __bea_callspec__ setnb_(PDISASM); +void __bea_callspec__ sete_(PDISASM); +void __bea_callspec__ setne_(PDISASM); +void __bea_callspec__ setbe_(PDISASM); +void __bea_callspec__ setnbe_(PDISASM); +void __bea_callspec__ sets_(PDISASM); +void __bea_callspec__ setns_(PDISASM); +void __bea_callspec__ setp_(PDISASM); +void __bea_callspec__ setnp_(PDISASM); +void __bea_callspec__ setnge_(PDISASM); +void __bea_callspec__ setge_(PDISASM); +void __bea_callspec__ setle_(PDISASM); +void __bea_callspec__ setnle_(PDISASM); +void __bea_callspec__ shld_EvGvIb(PDISASM); +void __bea_callspec__ shld_EvGvCL(PDISASM); +void __bea_callspec__ shrd_EvGvIb(PDISASM); +void __bea_callspec__ shrd_EvGvCL(PDISASM); +void __bea_callspec__ std_(PDISASM); +void __bea_callspec__ sub_ALIb(PDISASM); +void __bea_callspec__ sub_eAX_Iv(PDISASM); +void __bea_callspec__ sub_EbGb(PDISASM); +void __bea_callspec__ sub_EvGv(PDISASM); +void __bea_callspec__ sub_GbEb(PDISASM); +void __bea_callspec__ sub_GvEv(PDISASM); +void __bea_callspec__ test_ALIb(PDISASM); +void __bea_callspec__ test_eAX_Iv(PDISASM); +void __bea_callspec__ test_EbGb(PDISASM); +void __bea_callspec__ test_EvGv(PDISASM); +void __bea_callspec__ test_GbEb(PDISASM); +void __bea_callspec__ test_GvEv(PDISASM); +void __bea_callspec__ ud2_(PDISASM); +void __bea_callspec__ vmread_(PDISASM); +void __bea_callspec__ vmwrite_(PDISASM); +void __bea_callspec__ wbinvd_(PDISASM); +void __bea_callspec__ wait_(PDISASM); +void __bea_callspec__ wrmsr_(PDISASM); +void __bea_callspec__ xadd_EbGb(PDISASM); +void __bea_callspec__ xadd_EvGv(PDISASM); +void __bea_callspec__ xchg_EbGb(PDISASM); +void __bea_callspec__ xchg_ebp(PDISASM); +void __bea_callspec__ xchg_ebx(PDISASM); +void __bea_callspec__ xchg_ecx(PDISASM); +void __bea_callspec__ xchg_edi(PDISASM); +void __bea_callspec__ xchg_edx(PDISASM); +void __bea_callspec__ xchg_esi(PDISASM); +void __bea_callspec__ xchg_esp(PDISASM); +void __bea_callspec__ xchg_EvGv(PDISASM); +void __bea_callspec__ xlat_(PDISASM); +void __bea_callspec__ xor_ALIb(PDISASM); +void __bea_callspec__ xor_eAX_Iv(PDISASM); +void __bea_callspec__ xor_EbGb(PDISASM); +void __bea_callspec__ xor_EvGv(PDISASM); +void __bea_callspec__ xor_GbEb(PDISASM); +void __bea_callspec__ xor_GvEv(PDISASM); + +/* ====================================== opcodes_Grp1 */ +void __bea_callspec__ G1_EbIb(PDISASM); +void __bea_callspec__ G1_EbIb2(PDISASM); +void __bea_callspec__ G1_EvIv(PDISASM); +void __bea_callspec__ G1_EvIb(PDISASM); + +/* ====================================== opcodes_Grp2 */ +void __bea_callspec__ G2_EbIb(PDISASM); +void __bea_callspec__ G2_EvIb(PDISASM); +void __bea_callspec__ G2_Ev1(PDISASM); +void __bea_callspec__ G2_Eb1(PDISASM); +void __bea_callspec__ G2_EbCL(PDISASM); +void __bea_callspec__ G2_EvCL(PDISASM); + +/* ====================================== opcodes_Grp3 */ +void __bea_callspec__ G3_Eb(PDISASM); +void __bea_callspec__ G3_Ev(PDISASM); + +/* ====================================== opcodes_Grp4 */ +void __bea_callspec__ G4_Eb(PDISASM); + +/* ====================================== opcodes_Grp5 */ +void __bea_callspec__ G5_Ev(PDISASM); + +/* ====================================== opcodes_Grp6 */ +void __bea_callspec__ G6_(PDISASM); + +/* ====================================== opcodes_Grp7 */ +void __bea_callspec__ G7_(PDISASM); + +/* ====================================== opcodes_Grp8 */ +void __bea_callspec__ G8_EvIb(PDISASM); + +/* ====================================== opcodes_Grp9 */ +void __bea_callspec__ G9_(PDISASM); + +/* ====================================== opcodes_Grp12 */ +void __bea_callspec__ G12_(PDISASM); + +/* ====================================== opcodes_Grp13 */ +void __bea_callspec__ G13_(PDISASM); + +/* ====================================== opcodes_Grp14 */ +void __bea_callspec__ G14_(PDISASM); + +/* ====================================== opcodes_Grp15 */ +void __bea_callspec__ G15_(PDISASM); + +/* ====================================== opcodes_Grp16 */ +void __bea_callspec__ G16_(PDISASM); + +/* ====================================== opcodes_FPU */ +void __bea_callspec__ D8_(PDISASM); +void __bea_callspec__ D9_(PDISASM); +void __bea_callspec__ DA_(PDISASM); +void __bea_callspec__ DB_(PDISASM); +void __bea_callspec__ DC_(PDISASM); +void __bea_callspec__ DD_(PDISASM); +void __bea_callspec__ DE_(PDISASM); +void __bea_callspec__ DF_(PDISASM); + +/* ====================================== opcodes_MMX */ +void __bea_callspec__ emms_(PDISASM); +void __bea_callspec__ movd_EP(PDISASM); +void __bea_callspec__ movd_PE(PDISASM); +void __bea_callspec__ movq_PQ(PDISASM); +void __bea_callspec__ movq_QP(PDISASM); +void __bea_callspec__ movq_WV(PDISASM); +void __bea_callspec__ pabsb_(PDISASM); +void __bea_callspec__ pabsd_(PDISASM); +void __bea_callspec__ pabsw_(PDISASM); +void __bea_callspec__ packssdw_(PDISASM); +void __bea_callspec__ packsswb_(PDISASM); +void __bea_callspec__ packuswb_(PDISASM); +void __bea_callspec__ paddb_(PDISASM); +void __bea_callspec__ paddd_(PDISASM); +void __bea_callspec__ paddsb_(PDISASM); +void __bea_callspec__ paddsw_(PDISASM); +void __bea_callspec__ paddusb_(PDISASM); +void __bea_callspec__ paddusw_(PDISASM); +void __bea_callspec__ paddw_(PDISASM); +void __bea_callspec__ pandn_(PDISASM); +void __bea_callspec__ pand_(PDISASM); +void __bea_callspec__ pcmpeqb_(PDISASM); +void __bea_callspec__ pcmpeqd_(PDISASM); +void __bea_callspec__ pcmpeqw_(PDISASM); +void __bea_callspec__ pcmpgtb_(PDISASM); +void __bea_callspec__ pcmpgtd_(PDISASM); +void __bea_callspec__ pcmpgtw_(PDISASM); +void __bea_callspec__ pmulhw_(PDISASM); +void __bea_callspec__ pmullw_(PDISASM); +void __bea_callspec__ pmaddwd_(PDISASM); +void __bea_callspec__ por_(PDISASM); +void __bea_callspec__ pslld_(PDISASM); +void __bea_callspec__ psllq_(PDISASM); +void __bea_callspec__ psllw_(PDISASM); +void __bea_callspec__ psrld_(PDISASM); +void __bea_callspec__ psrlq_(PDISASM); +void __bea_callspec__ psrlw_(PDISASM); +void __bea_callspec__ psrad_(PDISASM); +void __bea_callspec__ psraw_(PDISASM); +void __bea_callspec__ psubb_(PDISASM); +void __bea_callspec__ psubd_(PDISASM); +void __bea_callspec__ psubsb_(PDISASM); +void __bea_callspec__ psubsw_(PDISASM); +void __bea_callspec__ psubusb_(PDISASM); +void __bea_callspec__ psubusw_(PDISASM); +void __bea_callspec__ psubw_(PDISASM); +void __bea_callspec__ punpckhbw_(PDISASM); +void __bea_callspec__ punpckhdq_(PDISASM); +void __bea_callspec__ punpckhwd_(PDISASM); +void __bea_callspec__ punpcklbw_(PDISASM); +void __bea_callspec__ punpckldq_(PDISASM); +void __bea_callspec__ punpcklwd_(PDISASM); +void __bea_callspec__ pxor_(PDISASM); + +/* ====================================== opcodes_SSE */ +void __bea_callspec__ addps_VW(PDISASM); +void __bea_callspec__ addsubpd_(PDISASM); +void __bea_callspec__ andnps_VW(PDISASM); +void __bea_callspec__ andps_VW(PDISASM); +void __bea_callspec__ blendpd_(PDISASM); +void __bea_callspec__ blendps_(PDISASM); +void __bea_callspec__ blendvpd_(PDISASM); +void __bea_callspec__ blendvps_(PDISASM); +void __bea_callspec__ cmpps_VW(PDISASM); +void __bea_callspec__ crc32_GvEb(PDISASM); +void __bea_callspec__ crc32_GvEv(PDISASM); +void __bea_callspec__ comiss_VW(PDISASM); +void __bea_callspec__ cvtdq2ps_(PDISASM); +void __bea_callspec__ cvtpd2dq_(PDISASM); +void __bea_callspec__ cvtpi2ps_(PDISASM); +void __bea_callspec__ cvtps2pd_(PDISASM); +void __bea_callspec__ cvtps2pi_(PDISASM); +void __bea_callspec__ cvttps2pi_(PDISASM); +void __bea_callspec__ dppd_(PDISASM); +void __bea_callspec__ dpps_(PDISASM); +void __bea_callspec__ divps_VW(PDISASM); +void __bea_callspec__ extractps_(PDISASM); +void __bea_callspec__ haddpd_VW(PDISASM); +void __bea_callspec__ hsubpd_VW(PDISASM); +void __bea_callspec__ insertps_(PDISASM); +void __bea_callspec__ lddqu_(PDISASM); +void __bea_callspec__ maskmovq_(PDISASM); +void __bea_callspec__ maxps_VW(PDISASM); +void __bea_callspec__ minps_VW(PDISASM); +void __bea_callspec__ movaps_VW(PDISASM); +void __bea_callspec__ movaps_WV(PDISASM); +void __bea_callspec__ movhps_MV(PDISASM); +void __bea_callspec__ movhps_VM(PDISASM); +void __bea_callspec__ movlps_MV(PDISASM); +void __bea_callspec__ movlps_VM(PDISASM); +void __bea_callspec__ movmskps_(PDISASM); +void __bea_callspec__ movntdqa_(PDISASM); +void __bea_callspec__ movnti_(PDISASM); +void __bea_callspec__ movntps_(PDISASM); +void __bea_callspec__ movntq_(PDISASM); +void __bea_callspec__ movups_VW(PDISASM); +void __bea_callspec__ movups_WV(PDISASM); +void __bea_callspec__ mpsadbw_(PDISASM); +void __bea_callspec__ mulps_VW(PDISASM); +void __bea_callspec__ orps_VW(PDISASM); +void __bea_callspec__ packusdw_(PDISASM); +void __bea_callspec__ paddq_(PDISASM); +void __bea_callspec__ pavgb_(PDISASM); +void __bea_callspec__ pavgw_(PDISASM); +void __bea_callspec__ palignr_(PDISASM); +void __bea_callspec__ pblendvb_(PDISASM); +void __bea_callspec__ pblendw_(PDISASM); +void __bea_callspec__ pcmpeqq_(PDISASM); +void __bea_callspec__ pcmpestri_(PDISASM); +void __bea_callspec__ pcmpestrm_(PDISASM); +void __bea_callspec__ pcmpgtq_(PDISASM); +void __bea_callspec__ pcmpistri_(PDISASM); +void __bea_callspec__ pcmpistrm_(PDISASM); +void __bea_callspec__ pextrb_(PDISASM); +void __bea_callspec__ pextrd_(PDISASM); +void __bea_callspec__ pextrw2_(PDISASM); +void __bea_callspec__ pextrw_(PDISASM); +void __bea_callspec__ phaddd_(PDISASM); +void __bea_callspec__ phaddsw_(PDISASM); +void __bea_callspec__ phaddw_(PDISASM); +void __bea_callspec__ phminposuw_(PDISASM); +void __bea_callspec__ phsubd_(PDISASM); +void __bea_callspec__ phsubsw_(PDISASM); +void __bea_callspec__ phsubw_(PDISASM); +void __bea_callspec__ pinsrb_(PDISASM); +void __bea_callspec__ pinsrd_(PDISASM); +void __bea_callspec__ pinsrw_(PDISASM); +void __bea_callspec__ pmaxsb_(PDISASM); +void __bea_callspec__ pmaxsd_(PDISASM); +void __bea_callspec__ pmaxsw_(PDISASM); +void __bea_callspec__ pmaxub_(PDISASM); +void __bea_callspec__ pmaxud_(PDISASM); +void __bea_callspec__ pmaxuw_(PDISASM); +void __bea_callspec__ pminsb_(PDISASM); +void __bea_callspec__ pminsd_(PDISASM); +void __bea_callspec__ pminsw_(PDISASM); +void __bea_callspec__ pminub_(PDISASM); +void __bea_callspec__ pminud_(PDISASM); +void __bea_callspec__ pminuw_(PDISASM); +void __bea_callspec__ pmaddubsw_(PDISASM); +void __bea_callspec__ pmovmskb_(PDISASM); +void __bea_callspec__ pmovsxbd_(PDISASM); +void __bea_callspec__ pmovsxbq_(PDISASM); +void __bea_callspec__ pmovsxbw_(PDISASM); +void __bea_callspec__ pmovsxdq_(PDISASM); +void __bea_callspec__ pmovsxwd_(PDISASM); +void __bea_callspec__ pmovsxwq_(PDISASM); +void __bea_callspec__ pmovzxbd_(PDISASM); +void __bea_callspec__ pmovzxbq_(PDISASM); +void __bea_callspec__ pmovzxbw_(PDISASM); +void __bea_callspec__ pmovzxdq_(PDISASM); +void __bea_callspec__ pmovzxwd_(PDISASM); +void __bea_callspec__ pmovzxwq_(PDISASM); +void __bea_callspec__ pmuldq_(PDISASM); +void __bea_callspec__ pmulhrsw_(PDISASM); +void __bea_callspec__ pmulhuw_(PDISASM); +void __bea_callspec__ pmulhw_(PDISASM); +void __bea_callspec__ pmulld_(PDISASM); +void __bea_callspec__ pmullw_(PDISASM); +void __bea_callspec__ pmuludq_(PDISASM); +void __bea_callspec__ popcnt_(PDISASM); +void __bea_callspec__ psadbw_(PDISASM); +void __bea_callspec__ pshufb_(PDISASM); +void __bea_callspec__ pshufw_(PDISASM); +void __bea_callspec__ psignb_(PDISASM); +void __bea_callspec__ psignd_(PDISASM); +void __bea_callspec__ psignw_(PDISASM); +void __bea_callspec__ psubq_(PDISASM); +void __bea_callspec__ ptest_(PDISASM); +void __bea_callspec__ punpcklqdq_(PDISASM); +void __bea_callspec__ punpckhqdq_(PDISASM); +void __bea_callspec__ rcpps_(PDISASM); +void __bea_callspec__ roundpd_(PDISASM); +void __bea_callspec__ roundps_(PDISASM); +void __bea_callspec__ roundsd_(PDISASM); +void __bea_callspec__ roundss_(PDISASM); +void __bea_callspec__ rsqrtps_(PDISASM); +void __bea_callspec__ shufps_(PDISASM); +void __bea_callspec__ sqrtps_VW(PDISASM); +void __bea_callspec__ subps_VW(PDISASM); +void __bea_callspec__ ucomiss_VW(PDISASM); +void __bea_callspec__ unpckhps_(PDISASM); +void __bea_callspec__ unpcklps_(PDISASM); +void __bea_callspec__ xorps_VW(PDISASM); + +/* ====================================== opcodes_AES */ +void __bea_callspec__ aesimc(PDISASM); +void __bea_callspec__ aesdec(PDISASM); +void __bea_callspec__ aesdeclast(PDISASM); +void __bea_callspec__ aesenc(PDISASM); +void __bea_callspec__ aesenclast(PDISASM); +void __bea_callspec__ aeskeygen(PDISASM); + +/* ====================================== opcodes_CLMUL */ +void __bea_callspec__ pclmulqdq_(PDISASM); diff --git a/csrc/README.txt b/csrc/README.txt new file mode 100644 index 0000000..64c3a08 --- /dev/null +++ b/csrc/README.txt @@ -0,0 +1,30 @@ +; ======================================== +; +; BeaEngine 4 +; +; ======================================== + +1) LICENSE +========== + +This software is distributed under the LGPL license. +See the COPYING and COPYING.LESSER files for more details. + + +2) ONLINE DOCUMENTATION +======================= + +For online documentation, visit : + + http://www.beaengine.org + + +3) AUTHOR, CONTRIBUTORS, BETA-TESTERS +========================================== + +BeatriX - Author (France) : beaengine (at) gmail.com +Igor Gutnik - Developer (ported the project on linux) + +Contributors : + + andrewl, bax, William Pomian, Ange Albertini, Pyrae, Vincent Roy, Kharneth, Eedy, Neitsa, KumaT, Rafal Cyran, 29a metal, sessiondiy, Tim, vince, Igor Gutnik, ouadji, Helle, Baboon, pop9080, ktion23. diff --git a/include/beaengine/BeaEngine.h b/include/beaengine/BeaEngine.h new file mode 100644 index 0000000..9f381b7 --- /dev/null +++ b/include/beaengine/BeaEngine.h @@ -0,0 +1,362 @@ +#ifndef _BEA_ENGINE_ +#define _BEA_ENGINE_ +#if defined(__cplusplus) && defined(__BORLANDC__) +namespace BeaEngine { +#endif + +#include +#include +#include + +#if !defined(BEA_ENGINE_STATIC) + #if defined(BUILD_BEA_ENGINE_DLL) + #define BEA_API bea__api_export__ + #else + #define BEA_API bea__api_import__ + #endif +#else + #define BEA_API +#endif + + +#define INSTRUCT_LENGTH 64 + +#pragma pack(1) +typedef struct { + UInt8 W_; + UInt8 R_; + UInt8 X_; + UInt8 B_; + UInt8 state; +} REX_Struct ; +#pragma pack() + +#pragma pack(1) +typedef struct { + int Number; + int NbUndefined; + UInt8 LockPrefix; + UInt8 OperandSize; + UInt8 AddressSize; + UInt8 RepnePrefix; + UInt8 RepPrefix; + UInt8 FSPrefix; + UInt8 SSPrefix; + UInt8 GSPrefix; + UInt8 ESPrefix; + UInt8 CSPrefix; + UInt8 DSPrefix; + UInt8 BranchTaken; + UInt8 BranchNotTaken; + REX_Struct REX; + char alignment[2]; +} PREFIXINFO ; +#pragma pack() + +#pragma pack(1) +typedef struct { + UInt8 OF_; + UInt8 SF_; + UInt8 ZF_; + UInt8 AF_; + UInt8 PF_; + UInt8 CF_; + UInt8 TF_; + UInt8 IF_; + UInt8 DF_; + UInt8 NT_; + UInt8 RF_; + UInt8 alignment; +} EFLStruct ; +#pragma pack() + +#pragma pack(4) +typedef struct { + Int32 BaseRegister; + Int32 IndexRegister; + Int32 Scale; + Int64 Displacement; +} MEMORYTYPE ; +#pragma pack() + + +#pragma pack(1) +typedef struct { + Int32 Category; + Int32 Opcode; + char Mnemonic[16]; + Int32 BranchType; + EFLStruct Flags; + UInt64 AddrValue; + Int64 Immediat; + UInt32 ImplicitModifiedRegs; +} INSTRTYPE; +#pragma pack() + +#pragma pack(1) +typedef struct { + char ArgMnemonic[64]; + Int32 ArgType; + Int32 ArgSize; + Int32 ArgPosition; + UInt32 AccessMode; + MEMORYTYPE Memory; + UInt32 SegmentReg; +} ARGTYPE; +#pragma pack() + +/* reserved structure used for thread-safety */ +/* unusable by customer */ +#pragma pack(1) +typedef struct { + UIntPtr EIP_; + UInt64 EIP_VA; + UIntPtr EIP_REAL; + Int32 OriginalOperandSize; + Int32 OperandSize; + Int32 MemDecoration; + Int32 AddressSize; + Int32 MOD_; + Int32 RM_; + Int32 INDEX_; + Int32 SCALE_; + Int32 BASE_; + Int32 MMX_; + Int32 SSE_; + Int32 CR_; + Int32 DR_; + Int32 SEG_; + Int32 REGOPCODE; + UInt32 DECALAGE_EIP; + Int32 FORMATNUMBER; + Int32 SYNTAX_; + UInt64 EndOfBlock; + Int32 RelativeAddress; + UInt32 Architecture; + Int32 ImmediatSize; + Int32 NB_PREFIX; + Int32 PrefRepe; + Int32 PrefRepne; + UInt32 SEGMENTREGS; + UInt32 SEGMENTFS; + Int32 third_arg; + Int32 TAB_; + Int32 ERROR_OPCODE; + REX_Struct REX; + Int32 OutOfBlock; +} InternalDatas; +#pragma pack() + +/* ************** main structure ************ */ +#pragma pack(1) +typedef struct _Disasm { + UIntPtr EIP; + UInt64 VirtualAddr; + UInt32 SecurityBlock; + char CompleteInstr[INSTRUCT_LENGTH]; + UInt32 Archi; + UInt64 Options; + INSTRTYPE Instruction; + ARGTYPE Argument1; + ARGTYPE Argument2; + ARGTYPE Argument3; + PREFIXINFO Prefix; + InternalDatas Reserved_; +} DISASM, *PDISASM, *LPDISASM; +#pragma pack() + +#define ESReg 1 +#define DSReg 2 +#define FSReg 3 +#define GSReg 4 +#define CSReg 5 +#define SSReg 6 + +#define InvalidPrefix 4 +#define SuperfluousPrefix 2 +#define NotUsedPrefix 0 +#define MandatoryPrefix 8 +#define InUsePrefix 1 + +#define LowPosition 0 +#define HighPosition 1 + +enum INSTRUCTION_TYPE +{ + GENERAL_PURPOSE_INSTRUCTION = 0x10000, + FPU_INSTRUCTION = 0x20000, + MMX_INSTRUCTION = 0x40000, + SSE_INSTRUCTION = 0x80000, + SSE2_INSTRUCTION = 0x100000, + SSE3_INSTRUCTION = 0x200000, + SSSE3_INSTRUCTION = 0x400000, + SSE41_INSTRUCTION = 0x800000, + SSE42_INSTRUCTION = 0x1000000, + SYSTEM_INSTRUCTION = 0x2000000, + VM_INSTRUCTION = 0x4000000, + UNDOCUMENTED_INSTRUCTION = 0x8000000, + AMD_INSTRUCTION = 0x10000000, + ILLEGAL_INSTRUCTION = 0x20000000, + AES_INSTRUCTION = 0x40000000, + CLMUL_INSTRUCTION = (int)0x80000000, + + + DATA_TRANSFER = 0x1, + ARITHMETIC_INSTRUCTION, + LOGICAL_INSTRUCTION, + SHIFT_ROTATE, + BIT_UInt8, + CONTROL_TRANSFER, + STRING_INSTRUCTION, + InOutINSTRUCTION, + ENTER_LEAVE_INSTRUCTION, + FLAG_CONTROL_INSTRUCTION, + SEGMENT_REGISTER, + MISCELLANEOUS_INSTRUCTION, + COMPARISON_INSTRUCTION, + LOGARITHMIC_INSTRUCTION, + TRIGONOMETRIC_INSTRUCTION, + UNSUPPORTED_INSTRUCTION, + LOAD_CONSTANTS, + FPUCONTROL, + STATE_MANAGEMENT, + CONVERSION_INSTRUCTION, + SHUFFLE_UNPACK, + PACKED_SINGLE_PRECISION, + SIMD128bits, + SIMD64bits, + CACHEABILITY_CONTROL, + FP_INTEGER_CONVERSION, + SPECIALIZED_128bits, + SIMD_FP_PACKED, + SIMD_FP_HORIZONTAL , + AGENT_SYNCHRONISATION, + PACKED_ALIGN_RIGHT , + PACKED_SIGN, + PACKED_BLENDING_INSTRUCTION, + PACKED_TEST, + PACKED_MINMAX, + HORIZONTAL_SEARCH, + PACKED_EQUALITY, + STREAMING_LOAD, + INSERTION_EXTRACTION, + DOT_PRODUCT, + SAD_INSTRUCTION, + ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ + ROUND_INSTRUCTION + +}; + +enum EFLAGS_STATES +{ + TE_ = 1, + MO_ = 2, + RE_ = 4, + SE_ = 8, + UN_ = 0x10, + PR_ = 0x20 +}; + +enum BRANCH_TYPE +{ + JO = 1, + JC = 2, + JE = 3, + JA = 4, + JS = 5, + JP = 6, + JL = 7, + JG = 8, + JB = 2, // JC == JB + JECXZ = 10, + JmpType = 11, + CallType = 12, + RetType = 13, + JNO = -1, + JNC = -2, + JNE = -3, + JNA = -4, + JNS = -5, + JNP = -6, + JNL = -7, + JNG = -8, + JNB = -2 // JNC == JNB +}; + +enum ARGUMENTS_TYPE +{ + NO_ARGUMENT = 0x10000000, + REGISTER_TYPE = 0x20000000, + MEMORY_TYPE = 0x40000000, + CONSTANT_TYPE = (int)0x80000000, + + MMX_REG = 0x10000, + GENERAL_REG = 0x20000, + FPU_REG = 0x40000, + SSE_REG = 0x80000, + CR_REG = 0x100000, + DR_REG = 0x200000, + SPECIAL_REG = 0x400000, + MEMORY_MANAGEMENT_REG = 0x800000, + SEGMENT_REG = 0x1000000, + + RELATIVE_ = 0x4000000, + ABSOLUTE_ = 0x8000000, + + READ = 0x1, + WRITE = 0x2, + + REG0 = 0x1, + REG1 = 0x2, + REG2 = 0x4, + REG3 = 0x8, + REG4 = 0x10, + REG5 = 0x20, + REG6 = 0x40, + REG7 = 0x80, + REG8 = 0x100, + REG9 = 0x200, + REG10 = 0x400, + REG11 = 0x800, + REG12 = 0x1000, + REG13 = 0x2000, + REG14 = 0x4000, + REG15 = 0x8000 +}; + +enum SPECIAL_INFO +{ + UNKNOWN_OPCODE = -1, + OUT_OF_BLOCK = 0, + + /* === mask = 0xff */ + NoTabulation = 0x00000000, + Tabulation = 0x00000001, + + /* === mask = 0xff00 */ + MasmSyntax = 0x00000000, + GoAsmSyntax = 0x00000100, + NasmSyntax = 0x00000200, + ATSyntax = 0x00000400, + + /* === mask = 0xff0000 */ + PrefixedNumeral = 0x00010000, + SuffixedNumeral = 0x00000000, + + /* === mask = 0xff000000 */ + ShowSegmentRegs = 0x01000000 +}; + + +#ifdef __cplusplus +extern "C" +#endif + +BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm); +BEA_API const__ char* __bea_callspec__ BeaEngineVersion (void); +BEA_API const__ char* __bea_callspec__ BeaEngineRevision (void); +#if defined(__cplusplus) && defined(__BORLANDC__) +}; +using namespace BeaEngine; +#endif +#endif diff --git a/include/beaengine/basic_types.h b/include/beaengine/basic_types.h new file mode 100644 index 0000000..4d080df --- /dev/null +++ b/include/beaengine/basic_types.h @@ -0,0 +1,272 @@ +/** + * @file basic_types.h + * @author + * @date Thu Dec 24 19:31:22 2009 + * + * @brief Definitions of fixed-size integer types for various platforms + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +#ifndef __BEA_BASIC_TYPES_HPP__ +#define __BEA_BASIC_TYPES_HPP__ + +#include + +#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) +#include +#endif + +#if defined(_MSC_VER) && !defined(__BORLANDC__) + /* + * Windows/Visual C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed __int64 Int64; + typedef unsigned __int64 UInt64; + #if defined(_WIN64) + #define BEA_PTR_IS_64_BIT 1 + typedef signed __int64 IntPtr; + typedef unsigned __int64 UIntPtr; + #else + typedef signed long IntPtr; + typedef size_t UIntPtr; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__POCC__) + /* + * PellesC + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long long Int64; + typedef unsigned long long UInt64; + #if defined(_WIN64) + #define BEA_PTR_IS_64_BIT 1 + typedef signed long long IntPtr; + typedef unsigned long long UIntPtr; + #else + typedef signed long IntPtr; + typedef size_t UIntPtr; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__GNUC__) || defined(__LCC__) + /* + * Unix/GCC + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef intptr_t IntPtr; + typedef uintptr_t UIntPtr; + #if defined(__LP64__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) + typedef __int64 Int64; + typedef unsigned __int64 UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__DECCXX) + /* + * Compaq C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed __int64 Int64; + typedef unsigned __int64 UInt64; + #if defined(__VMS) + #if defined(__32BITS) + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #else + typedef Int64 IntPtr; + typedef UInt64 UIntPtr; + #define BEA_PTR_IS_64_BIT 1 + #endif + #else + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__HP_aCC) + /* + * HP Ansi C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__LP64__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) + /* + * SUN Forte C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__sparcv9) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__IBMCPP__) + /* + * IBM XL C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__64BIT__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__BORLANDC__) + /* + * Borland C/C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef unsigned __int64 Int64; + typedef signed __int64 UInt64; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #define BEA_HAVE_INT64 1 +#elif defined(__WATCOMC__) + /* + * Watcom C/C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef unsigned __int64 Int64; + typedef signed __int64 UInt64; + #define BEA_HAVE_INT64 1 + typedef size_t UIntPtr; +#elif defined(__sgi) + /* + * MIPSpro C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if _MIPS_SZLONG == 64 + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#endif + +#if defined(_MSC_VER) || defined(__BORLANDC__) + #define W64LIT(x) x##ui64 +#else + #define W64LIT(x) x##ULL +#endif + + +#ifndef C_STATIC_ASSERT +#define C_STATIC_ASSERT(tag_name, x) \ + typedef int cache_static_assert_ ## tag_name[(x) * 2-1] +#endif + +C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); +C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); + +C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); +C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); + +C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); +C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); + +C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); +C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); + +#endif diff --git a/include/beaengine/export.h b/include/beaengine/export.h new file mode 100644 index 0000000..6e550db --- /dev/null +++ b/include/beaengine/export.h @@ -0,0 +1,173 @@ +/** + * @file export.h + * @author igor.gutnik@gmail.com + * @date Mon Sep 22 09:28:54 2008 + * + * @brief This file sets things up for C dynamic library function definitions and + * static inlined functions + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see . */ + +#ifndef __BEA_EXPORT_H__ +#define __BEA_EXPORT_H__ + + +/* Set up for C function definitions, even when using C++ */ + +#ifdef __cplusplus +#define CPP_VISIBLE_BEGIN extern "C" { +#define CPP_VISIBLE_END } +#else +#define CPP_VISIBLE_BEGIN +#define CPP_VISIBLE_END +#endif + +#if defined(_MSC_VER) +#pragma warning( disable: 4251 ) +#endif + +/* Some compilers use a special export keyword */ +#ifndef bea__api_export__ +# if defined(__BEOS__) +# if defined(__GNUC__) +# define bea__api_export__ __declspec(dllexport) +# else +# define bea__api_export__ __declspec(export) +# endif +# elif defined(_WIN32) || defined(_WIN64) +# ifdef __BORLANDC__ +# define bea__api_export__ __declspec(dllexport) +# define bea__api_import__ __declspec(dllimport) +# elif defined(__WATCOMC__) +# define bea__api_export__ __declspec(dllexport) +# define bea__api_import__ +# else +# define bea__api_export__ __declspec(dllexport) +# define bea__api_import__ __declspec(dllimport) +# endif +# elif defined(__OS2__) +# ifdef __WATCOMC__ +# define bea__api_export__ __declspec(dllexport) +# define bea__api_import__ +# else +# define bea__api_export__ +# define bea__api_import__ +# endif +# else +# if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 +# define bea__api_export__ __attribubea__ ((visibility("default"))) +# define bea__api_import__ __attribubea__ ((visibility("default"))) +# else +# define bea__api_export__ +# define bea__api_import__ +# endif +# endif +#endif + +/* Use C calling convention by default*/ + +#ifndef __bea_callspec__ +#if defined(BEA_USE_STDCALL) + #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) + #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) + #define __bea_callspec__ __stdcall + #else + #define __bea_callspec__ + #endif + #else + #ifdef __OS2__ + #define __bea_callspec__ _System + #else + #define __bea_callspec__ + #endif + #endif +#else + #define __bea_callspec__ +#endif +#endif + +#ifdef __SYMBIAN32__ +# ifndef EKA2 +# undef bea__api_export__ +# undef bea__api_import__ +# define bea__api_export__ +# define bea__api_import__ +# elif !defined(__WINS__) +# undef bea__api_export__ +# undef bea__api_import__ +# define bea__api_export__ __declspec(dllexport) +# define bea__api_import__ __declspec(dllexport) +# endif /* !EKA2 */ +#endif /* __SYMBIAN32__ */ + + +#if defined(__GNUC__) && (__GNUC__ > 2) +#define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) +#define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) +#else +#define BEA_EXPECT_CONDITIONAL(c) (c) +#define BEA_UNEXPECT_CONDITIONAL(c) (c) +#endif + + +/* Set up compiler-specific options for inlining functions */ +#ifndef BEA_HAS_INLINE +#if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) +#define BEA_HAS_INLINE +#else +/* Add any special compiler-specific cases here */ +#if defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__EABI__) +#ifndef __inline__ +#define __inline__ __inline +#endif +#define BEA_HAS_INLINE +#else +#if !defined(__MRC__) && !defined(_SGI_SOURCE) +#ifndef __inline__ +#define __inline__ inline +#endif +#define BEA_HAS_INLINE +#endif /* Not a funky compiler */ +#endif /* Visual C++ */ +#endif /* GNU C */ +#endif /* CACHE_HAS_INLINE */ + +/* If inlining isn't supported, remove "__inline__", turning static + inlined functions into static functions (resulting in code bloat + in all files which include the offending header files) +*/ +#ifndef BEA_HAS_INLINE +#define __inline__ +#endif + +/* fix a bug with gcc under windows */ + +#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) + #if defined(__MINGW32__) + #define const__ + #else + #define const__ const + #endif +#else + #define const__ const +#endif + + + +#endif diff --git a/include/beaengine/macros.h b/include/beaengine/macros.h new file mode 100644 index 0000000..8a5dc99 --- /dev/null +++ b/include/beaengine/macros.h @@ -0,0 +1,41 @@ +#ifndef __BEAENGINE_MACROS_H__ +#define __BEAENGINE_MACROS_H__ +/* +============================================================================ + Compiler Silencing macros + + Some compilers complain about parameters that are not used. This macro + should keep them quiet. + ============================================================================ + */ + +# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) +# define BEA_UNUSED_ARG(a) (void) (a) +#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__) +/* + Some compilers complain about "statement with no effect" with (a). + This eliminates the warnings, and no code is generated for the null + conditional statement. Note, that may only be true if -O is enabled, + such as with GreenHills (ghs) 1.8.8. + */ + +# define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) +#elif defined (__DMC__) + #if defined(__cplusplus) + #define BEA_UNUSED_ID(identifier) + template + inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { } + #else + #define BEA_UNUSED_ARG(a) + #endif +#else /* ghs || __GNUC__ || ..... */ +# define BEA_UNUSED_ARG(a) (a) +#endif /* ghs || __GNUC__ || ..... */ + +#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)) +# define BEA_NOTREACHED(a) +#else /* __sgi || ghs || ..... */ +# define BEA_NOTREACHED(a) a +#endif /* __sgi || ghs || ..... */ + +#endif /* __BEAENGINE_MACROS_H__ */ diff --git a/include/bindings.dsl.custom.h b/include/bindings.dsl.custom.h new file mode 100644 index 0000000..ced558c --- /dev/null +++ b/include/bindings.dsl.custom.h @@ -0,0 +1,365 @@ +/****** + * Copyright © 2008–2011 Maurício C. Antunes + * This file is distributed under the BSD license. + * Check LICENSE file in distribution package for + * details. +******/ + +#ifndef __BINDINGS_DSL_H__ +#define __BINDINGS_DSL_H__ + +#include +#include +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +#define hsc_strict_import(dummy) printf( \ + "import Foreign.Ptr (Ptr,FunPtr,plusPtr)\n" \ + "import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)\n" \ + "import Foreign.Storable\n" \ + "import Foreign.C.Types\n" \ + "import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)\n" \ + "import Foreign.Marshal.Alloc (alloca)\n" \ + "import Foreign.Marshal.Array (peekArray,pokeArray)\n" \ + "import Data.Int\n" \ + "import Data.Word\n" \ + ); \ + +#define bc_word(name) \ + { \ + char *p, *q, buffer_w[strlen(name)+1]; \ + strcpy(buffer_w,name); \ + for (p=strtok(buffer_w," \t");(q=strtok(NULL," \t"));p=q); \ + printf("%s",p); \ + } \ + + +#define bc_glue(type,field) \ + { \ + char *p, buffer_g[strlen(field)+1]; \ + strcpy(buffer_g,field); \ + for (p=buffer_g;*p;p++) \ + *p = *p=='.' ? '\'' : ispunct(*p) ? '_' : *p; \ + bc_word(buffer_g); \ + } \ + +#define bc_typemarkup(name) \ + { \ + char buffer_t[strlen(name)+1]; \ + strcpy(buffer_t,name); \ + char *p1,*p2,*p3; \ + p1 = buffer_t; \ + while (*p1) \ + { \ + for (p2=p1;*p2 && *p2!='<';p2++); \ + for (p3=p2;*p3 && *p3!='>';p3++); \ + if (*p2 == '<') *p2++ = '\0'; \ + if (*p3 == '>') *p3++ = '\0'; \ + printf("%s",p1); \ + if (*p2) bc_conid(p2); \ + p1 = p3; \ + } \ + } \ + +#define bc_varid(name) {printf("c");bc_word(name);}; \ + +#define bc_conid(name) {printf("C");bc_word(name);}; \ + +#define bc_ptrid(name) {printf("p");bc_word(name);}; \ + +#define bc_wrapper(name) {printf("mk");bc_word(name);}; \ + +#define bc_dynamic(name) {printf("mK");bc_word(name);}; \ + +#define bc_decimal(name) (name) > 0 \ + ? printf("%" PRIuMAX,(uintmax_t)(name)) \ + : printf("%" PRIdMAX,(intmax_t)(name)) \ + +#define bc_wordptr(name) printf("%" PRIuPTR,(uintptr_t)(name)) \ + +#define bc_float(name) printf("%Le",(long double)(name)) \ + +#define hsc_num(name) \ + bc_varid(# name);printf(" = ");bc_decimal(name);printf("\n"); \ + bc_varid(# name);printf(" :: (Num a) => a\n"); \ + +#define hsc_fractional(name) \ + bc_varid(# name);printf(" = ");bc_float(name);printf("\n"); \ + bc_varid(# name);printf(" :: (Fractional a) => a\n"); \ + +#define hsc_pointer(name) \ + bc_varid(# name);printf(" = wordPtrToPtr "); \ + bc_wordptr(name);printf("\n"); \ + bc_varid(# name);printf(" :: Ptr a\n"); \ + +#define hsc_function_pointer(name) \ + bc_varid(# name);printf(" = (castPtrToFunPtr . wordPtrToPtr) "); \ + bc_wordptr(name);printf("\n"); \ + bc_varid(# name);printf(" :: FunPtr a\n"); \ + +#ifdef BINDINGS_STDCALLCONV +#define hsc_ccall(name,type) hsc_callconv(name,stdcall,type) +#else +#define hsc_ccall(name,type) hsc_callconv(name,ccall,type) +#endif + +#define hsc_callconv(name,conv,type) \ + printf("foreign import "# conv" \"%s\" ",# name); \ + bc_varid(# name);printf("\n"); \ + printf(" :: ");bc_typemarkup(# type);printf("\n"); \ + printf("foreign import "# conv" \"&%s\" ",# name); \ + bc_ptrid(# name);printf("\n"); \ + printf(" :: FunPtr (");bc_typemarkup(# type);printf(")\n"); \ + +/* experimental support for unsafe calls */ +#define hsc_ccall_unsafe(name,type) \ + printf("foreign import ccall unsafe \"%s\" unsafe'",# name); \ + bc_varid(# name);printf("\n"); \ + printf(" :: ");bc_typemarkup(# type);printf("\n"); \ + printf("foreign import ccall unsafe \"&%s\" unsafe'",# name); \ + bc_ptrid(# name);printf("\n"); \ + printf(" :: FunPtr (");bc_typemarkup(# type);printf(")\n"); \ + +#define hsc_cinline(name,type) \ + printf("foreign import ccall \"inline_%s\" ",# name); \ + bc_varid(# name);printf("\n"); \ + printf(" :: ");bc_typemarkup(# type);printf("\n"); \ + +#define hsc_globalvar(name,type) \ + printf("foreign import ccall \"&%s\" ",# name); \ + bc_ptrid(# name);printf("\n"); \ + printf(" :: Ptr (");bc_typemarkup(# type);printf(")\n"); \ + +#define hsc_globalarray(name,type) \ + printf("foreign import ccall \"array_%s\" ",# name); \ + bc_varid(# name);printf("\n"); \ + printf(" :: Ptr (");bc_typemarkup(# type);printf(")\n"); \ + +#define hsc_integral_t(name) \ + printf("type ");bc_conid(# name);printf(" = "); \ + { \ + int sign = (name)(-1)<0; \ + size_t size = sizeof(name); \ + if (size==sizeof(int)) printf("%s",sign?"CInt":"CUInt"); \ + else if (size==sizeof(char)) printf("%s", \ + (char)(-1)<0?(sign?"CChar":"CUChar"):(sign?"CSChar":"CChar")); \ + else printf("%s%" PRIuMAX,sign?"Int":"Word",(uintmax_t)(8*size)); \ + printf("\n"); \ + } \ + +#define hsc_opaque_t(name) \ + printf("data ");bc_conid(# name); \ + printf(" = "); \ + bc_conid(# name);printf("\n"); \ + +#define hsc_synonym_t(name,type) \ + printf("type ");bc_conid(# name); \ + printf(" = "); \ + bc_typemarkup(# type); \ + printf("\n"); \ + +#ifdef BINDINGS_STDCALLCONV +#define hsc_callback(name,type) hsc_callbackconv(name,stdcall,type) +#define hsc_callback_t(name,type) hsc_callbackconv(name,stdcall,type) +#else +#define hsc_callback(name,type) hsc_callbackconv(name,ccall,type) +#define hsc_callback_t(name,type) hsc_callbackconv(name,ccall,type) +#endif + +#define hsc_callbackconv(name,conv,type) \ + printf("type ");bc_conid(# name);printf(" = FunPtr ("); \ + bc_typemarkup(# type);printf(")\n"); \ + printf("foreign import "# conv" \"wrapper\" "); \ + bc_wrapper(# name);printf("\n"); \ + printf(" :: (");bc_typemarkup(# type); \ + printf(") -> IO ");bc_conid(# name);printf("\n"); \ + printf("foreign import "# conv" \"dynamic\" "); \ + bc_dynamic(# name);printf("\n"); \ + printf(" :: ");bc_conid(# name); \ + printf(" -> (");bc_typemarkup(# type);printf(")\n"); \ + +static struct { + int n, array_size[500], is_union[500], is_fam[500]; + uintmax_t offset[500]; + char fname[500][1000], ftype[500][1000]; +} bc_fielddata; + +#define bc_fieldname(type,field) {printf("c");bc_glue(type,field);}; \ + +#define bc_unionupdate(type,field) {printf("u");bc_glue(type,field);}; \ + +#define bc_fieldoffset(type,field) {printf("p");bc_glue(type,field);}; \ + +#define hsc_starttype(name) \ + { \ + struct {char _; name v;} bc_refdata; \ + size_t typesize = sizeof bc_refdata.v; \ + ptrdiff_t typealign = (char*)&bc_refdata.v - (char*)&bc_refdata; \ + bc_fielddata.n = 0; \ + char typename[] = # name; \ + int index; \ + int standalone_deriving = 0; \ + +#define bc_basicfield(name,type,u,f) \ + index = bc_fielddata.n++; \ + bc_fielddata.offset[index] = (uintmax_t) \ + ((char*)&bc_refdata.v.name - (char*)&bc_refdata.v); \ + bc_fielddata.array_size[index] = 0; \ + bc_fielddata.is_union[index] = u; \ + bc_fielddata.is_fam[index] = f; \ + strcpy(bc_fielddata.fname[index],# name); \ + strcpy(bc_fielddata.ftype[index],type); \ + +#define hsc_field(name,type) \ + bc_basicfield(name,# type,0,0); \ + +#define hsc_union_field(name,type) \ + bc_basicfield(name,# type,1,0); \ + +#define hsc_flexible_array_member(name,type) \ + bc_basicfield(name,# type,0,1); \ + +#define hsc_array_field(name,type) \ + bc_basicfield(name,# type,0,0); \ + bc_fielddata.array_size[index] = sizeof bc_refdata.v.name \ + +#define hsc_union_array_field(name,type) \ + bc_basicfield(name,# type,1,0); \ + bc_fielddata.array_size[index] = sizeof bc_refdata.v.name \ + +#define hsc_stoptype(dummy) \ + printf("data ");bc_conid(typename);printf(" = "); \ + bc_conid(typename);printf("{\n"); \ + int i; \ + for (i=0; i < bc_fielddata.n; i++) \ + { \ + printf(" "); \ + bc_fieldname(typename,bc_fielddata.fname[i]); \ + printf(" :: "); \ + if (bc_fielddata.array_size[i] > 0 || bc_fielddata.is_fam[i]) \ + printf("["); \ + bc_typemarkup(bc_fielddata.ftype[i]); \ + if (bc_fielddata.array_size[i] > 0 || bc_fielddata.is_fam[i]) \ + printf("]"); \ + if (i+1 < bc_fielddata.n) printf(","); \ + printf("\n"); \ + } \ + if (!standalone_deriving) \ + printf("} deriving (Eq,Show)\n"); \ + else \ + { \ + printf("}\n"); \ + printf("deriving instance Eq ");bc_conid(typename);printf("\n"); \ + printf("deriving instance Show ");bc_conid(typename);printf("\n"); \ + } \ + for (i=0; i < bc_fielddata.n; i++) \ + { \ + bc_fieldoffset(typename,bc_fielddata.fname[i]); \ + printf(" p = plusPtr p %" PRIuMAX "\n",bc_fielddata.offset[i]); \ + bc_fieldoffset(typename,bc_fielddata.fname[i]); \ + printf(" :: Ptr (");bc_conid(typename);printf(") -> "); \ + printf("Ptr (");bc_typemarkup(bc_fielddata.ftype[i]);printf(")\n"); \ + } \ + for (i=0; i < bc_fielddata.n; i++) if (bc_fielddata.is_union[i]) \ + { \ + bc_unionupdate(typename,bc_fielddata.fname[i]); \ + printf(" :: ");bc_conid(typename);printf(" -> "); \ + if (bc_fielddata.array_size[i] > 0) printf("["); \ + bc_typemarkup(bc_fielddata.ftype[i]); \ + if (bc_fielddata.array_size[i] > 0) printf("]"); \ + printf(" -> IO ");bc_conid(typename); \ + printf("\n"); \ + bc_unionupdate(typename,bc_fielddata.fname[i]); \ + printf(" v vf = alloca $ \\p -> do\n"); \ + printf(" poke p v\n"); \ + if (bc_fielddata.array_size[i] > 0) \ + { \ + printf(" let s = div %" PRIuMAX " $ sizeOf $ (undefined :: ", \ + bc_fielddata.array_size[i]); \ + bc_typemarkup(bc_fielddata.ftype[i]); \ + printf(")\n pokeArray (plusPtr p %" PRIuMAX ") $ take s vf", \ + bc_fielddata.offset[i]); \ + } \ + else \ + printf(" pokeByteOff p %" PRIuMAX " vf", \ + bc_fielddata.offset[i]); \ + printf("\n"); \ + printf(" vu <- peek p\n"); \ + printf(" return $ v\n"); \ + int j; \ + for (j=0; j < bc_fielddata.n; j++) if (bc_fielddata.is_union[j]) \ + { \ + printf(" {"); bc_fieldname(typename,bc_fielddata.fname[j]); \ + printf(" = "); bc_fieldname(typename,bc_fielddata.fname[j]); \ + printf(" vu}\n"); \ + } \ + } \ + printf("instance Storable "); \ + bc_conid(typename);printf(" where\n"); \ + printf(" sizeOf _ = %" PRIuMAX "\n alignment _ = %" PRIuMAX "\n", \ + (uintmax_t)(typesize),(uintmax_t)(typealign)); \ + printf(" peek p = do\n"); \ + for (i=0; i < bc_fielddata.n; i++) \ + { \ + printf(" v%d <- ",i); \ + if (bc_fielddata.is_fam[i]) \ + printf("return []"); \ + else if (bc_fielddata.array_size[i] > 0) \ + { \ + printf ("let s = div %" PRIuMAX " $ sizeOf $ (undefined :: ", \ + bc_fielddata.array_size[i]); \ + bc_typemarkup(bc_fielddata.ftype[i]); \ + printf(") in peekArray s (plusPtr p %" PRIuMAX ")", \ + bc_fielddata.offset[i]); \ + } \ + else \ + printf("peekByteOff p %" PRIuMAX "", bc_fielddata.offset[i]); \ + printf("\n"); \ + } \ + printf(" return $ ");bc_conid(typename); \ + for (i=0; i < bc_fielddata.n; i++) printf(" v%d",i); \ + printf("\n"); \ + printf(" poke p (");bc_conid(typename); \ + for (i=0; i < bc_fielddata.n; i++) printf(" v%d",i); \ + printf(") = do\n"); \ + for (i=0; i < bc_fielddata.n; i++) \ + { \ + if (bc_fielddata.is_fam[i]) \ + printf(" pokeArray (plusPtr p %" PRIuMAX ") v%d", \ + bc_fielddata.offset[i],i); \ + else if (bc_fielddata.array_size[i] > 0) \ + { \ + printf(" let s = div %" PRIuMAX " $ sizeOf $ (undefined :: ", \ + bc_fielddata.array_size[i]); \ + bc_typemarkup(bc_fielddata.ftype[i]); \ + printf(")\n pokeArray (plusPtr p %" PRIuMAX ") (take s v%d)", \ + bc_fielddata.offset[i], i); \ + } \ + else \ + printf(" pokeByteOff p %" PRIuMAX " v%d", \ + bc_fielddata.offset[i],i); \ + printf("\n"); \ + } \ + printf(" return ()\n"); \ + } \ + +#define hsc_gobject_notclassed(prefix,object,CamelCase) \ + hsc_opaque_t(CamelCase) \ + hsc_cinline(prefix##_TYPE_##object,) \ + hsc_cinline(prefix##_##object,Ptr a -> Ptr ) \ + hsc_cinline(prefix##_IS_##object,Ptr a -> ) \ + +#define hsc_gobject(prefix,object,CamelCase) \ + hsc_opaque_t(CamelCase##Class) \ + hsc_gobject_notclassed(prefix,object,CamelCase) \ + hsc_cinline(prefix##_##object##_CLASS,Ptr a -> Ptr ) \ + hsc_cinline(prefix##_IS_##object##_CLASS,Ptr a -> ) \ + hsc_cinline(prefix##_##object##_GET_CLASS,Ptr a -> Ptr ) \ + +#endif /* __BINDINGS_DSL_H__ */ + diff --git a/test/Test_Disasm.hs b/test/Test_Disasm.hs new file mode 100644 index 0000000..e7c461c --- /dev/null +++ b/test/Test_Disasm.hs @@ -0,0 +1,61 @@ +module Main where +import Foreign.C.String +import Foreign.C.Types +import Foreign +import BeaEngine +import qualified Data.ByteString as B +import qualified Data.ByteString.Internal as B +import System.Exit (exitFailure,exitSuccess) +import System.IO.Unsafe +import Debug.Trace + +{-- objdump (gnu binutils): + 4013c0: 55 push %ebp + 4013c1: 89 e5 mov %esp,%ebp + 4013c3: 83 ec 10 sub $0x10,%esp + 4013c6: c7 45 fc 88 77 66 55 movl $0x55667788,-0x4(%ebp) + 4013cd: b8 c3 f5 48 40 mov $0x4048f5c3,%eax + 4013d2: 89 45 f4 mov %eax,-0xc(%ebp) + 4013d5: 8d 45 f4 lea -0xc(%ebp),%eax + 4013d8: 89 45 f8 mov %eax,-0x8(%ebp) + 4013db: 8b 45 f8 mov -0x8(%ebp),%eax +--} + +asm32 = [ "push ebp", + "mov ebp, esp", + "sub esp, 10h", + "mov dword ptr [ebp-04h], 55667788h", + "mov eax, 4048F5C3h", + "mov dword ptr [ebp-0Ch], eax", + "lea eax, dword ptr [ebp-0Ch]", + "mov dword ptr [ebp-08h], eax", + "mov eax, dword ptr [ebp-08h]" ] + + +code32 :: MachineCode +code32 = X86_32 $ B.pack [0x55,0x89,0xe5,0x83,0xec,0x10,0xc7,0x45,0xfc,0x88,0x77,0x66,0x55,0xb8,0xc3,0xf5,0x48,0x40,0x89,0x45,0xf4,0x8d,0x45,0xf4,0x89,0x45,0xf8,0x8b,0x45,0xf8] + + +{- dumpbin (visual studio): + 0000000140001000: 48 89 4C 24 08 mov qword ptr [rsp+8],rcx + 0000000140001005: 48 83 EC 28 sub rsp,28h + 0000000140001009: 48 B8 88 77 66 55 mov rax,1122334455667788h + 44 33 22 11 + 0000000140001013: 48 89 44 24 08 mov qword ptr [rsp+8],rax -} + +asm64 = [ "mov qword ptr [rsp+08h], rcx", + "sub rsp, 28h", + "mov rax, 1122334455667788h", + "mov qword ptr [rsp+08h], rax" ] + +code64 :: MachineCode +code64 = X86_64 $ B.pack [0x48,0x89,0x4C,0x24,0x08,0x48,0x83,0xEC,0x28,0x48,0xB8,0x88,0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x48,0x89,0x44,0x24,0x08] + + +toAsm = map cCompleteInstrS . dasm cATSyntax + +main = if (toAsm code64 /= asm64) + then exitFailure + else if (toAsm code32 /= asm32) + then exitFailure + else exitSuccess \ No newline at end of file diff --git a/test/Test_Marshal.c b/test/Test_Marshal.c new file mode 100644 index 0000000..b21b57d --- /dev/null +++ b/test/Test_Marshal.c @@ -0,0 +1,235 @@ +#include +#include +#include +#include + +void +print_EFL(EFLStruct *x) +{ + printf("EFLStruct:\n OF=%d, SF=%d, ZF=%d, AF=%d, PF=%d, CF=%d, TF=%d, IF=%d, DF=%d, NT=%d, RF=%d, alignment=%d\n\n", + x->OF_, x->SF_, x->ZF_, x->AF_, x->PF_, + x->CF_, x->TF_, x->IF_, x->DF_, x->NT_, + x->RF_, x->alignment); + +} + +void print_memtype(MEMORYTYPE *x) +{ + printf("MEMORYTYPE:\n BaseRegister=%d, IndexRegister=%d, Scale=%d, Displacement=%"PRId64"\n\n", + x->BaseRegister, + x->IndexRegister, + x->Scale, + x->Displacement); +} + + +void +print_instruction(INSTRTYPE *x) +{ + printf("INSTRTYPE:\n Category=%d,\n Opcode=%d,\n Mnemonic=%s,\n BranchType=%d,\n Flags=...,\n AddrValue=%"PRId64"\n Immediat=%"PRId64"\n ImplicitModifiedRegs=%d\n\n", + x->Category, + x->Opcode, + x->Mnemonic, + x->BranchType, + x->AddrValue, + x->Immediat, + x->ImplicitModifiedRegs); + + print_EFL(&x->Flags); +} + +void print_argument(ARGTYPE *x) +{ + printf("ARGTYPE:\n ArgMnemonic=%s,\n ArgType=%d,\n ArgSize=%d,\n ArgPosition=%d,\n AccessMode=%d,\n Memory=...,\n SegmentReg=%d\n\n", + x->ArgMnemonic, + x->ArgType, + x->ArgSize, + x->ArgPosition, + x->AccessMode, + x->SegmentReg); + + print_memtype(&x->Memory); +} + + +void print_rex(REX_Struct *x) +{ + printf("REX: W_=%d, R=%d, X=%d, B=%d, state=%d\n", x->W_, x->R_, x->X_, x->B_, x->state); +} + + +void print_prefix(PREFIXINFO *x) +{ + printf("PREFIXINFO:\n Number=%d,\n nbUndefined=%d,\n LockPrefix=%d,\n OperandSize=%d,\n AddressSize=%d,\n " + "RepnePrefix=%d,\n RepPrefix=%d,\n FSPrefix=%d,\n SSPrefix=%d,\n GSPrefix=%d,\n " + "ESPrefix=%d,\n CSPrefix=%d,\n DSPrefix=%d,\n BranchTaken=%d,\n BranchNotTaken=%d,\n REX=...\n\n", + x->Number, + x->NbUndefined, + x->LockPrefix, + x->OperandSize, + x->AddressSize, + x->RepnePrefix, + x->RepPrefix, + x->FSPrefix, + x->SSPrefix, + x->GSPrefix, + x->ESPrefix, + x->CSPrefix, + x->DSPrefix, + x->BranchTaken, + x->BranchNotTaken); + + print_rex(&x->REX); +} + +void +print_disasm(DISASM *d) +{ + printf("DISASM:\n EIP=%d,\n VirtualAddr=%"PRId64",\n SecurityBlock=%d,\n CompleteInstr=%s,\n Archi=%d,\n Options=%"PRId64",\n Instruction,Argument1,Argument2,Argument3,Prefix=...\n\n", + d->EIP, + d->VirtualAddr, + d->SecurityBlock, + d->CompleteInstr, + d->Archi, + d->Options); + + print_instruction(&d->Instruction); + print_argument(&d->Argument1); + print_argument(&d->Argument2); + print_argument(&d->Argument3); + print_prefix(&d->Prefix); +} + + +#define T(K,V) if (x->K != V){ printf("failed: %s: %d != %d \n", #K, x->K, V); return -1; } +#define S(K,V) if (strcmp(x->K,V) != 0){ printf("failed: %s: %s != %s \n", #K, x->K, V); return -1; } + + +int test_efl(EFLStruct *x) +{ + T(OF_, 1); + T(SF_, 2); + T(ZF_, 3); + T(AF_, 4); + T(PF_, 5); + T(CF_, 6); + T(TF_, 7); + T(IF_, 8); + T(DF_, 9); + T(NT_, 10); + T(RF_, 11); + T(alignment, 12); + return 0; +} + + +int test_instr(INSTRTYPE *x) +{ + T(Category, 0); + T(Opcode, 1); + S(Mnemonic, "InstrMnemonic"); + T(BranchType, 2); + + if (test_efl(&x->Flags) != 0) + return -1; + + T(AddrValue, 3); + T(Immediat, 4); + T(ImplicitModifiedRegs, 5); + + return 0; +} + + +int test_memory(MEMORYTYPE *x) +{ + T(BaseRegister,0); + T(IndexRegister,1); + T(Scale,2); + T(Displacement,3); + return 0; +} + + +int test_argtype(ARGTYPE *x) +{ + S(ArgMnemonic, "ArgMnemonic"); + T(ArgType, 1); + T(ArgSize, 2); + T(ArgPosition, 3); + T(AccessMode, 4); + + if (test_memory(&x->Memory) != 0) + return -1; + + T(SegmentReg, 5); + return 0; + } + + +int +test_rex(REX_Struct *x) +{ + T(W_, 0); + T(R_, 1); + T(X_, 2); + T(B_, 3); + T(state, 4); + return 0; +} + + +int +test_prefix(PREFIXINFO *x) +{ + T(Number, 0); + T(NbUndefined, 1); + T(LockPrefix, 2); + T(OperandSize, 3); + T(AddressSize, 4); + T(RepnePrefix, 5); + T(RepPrefix, 6); + T(FSPrefix, 7); + T(SSPrefix, 8); + T(GSPrefix, 9); + T(ESPrefix, 10); + T(CSPrefix, 11); + T(DSPrefix, 12); + T(BranchTaken, 13); + T(BranchNotTaken, 14); + S(alignment, "8"); + + if (test_rex(&x->REX) != 0) + return -1; + + return 0; +} + + +int +test_marshal(DISASM *x) +{ + T(EIP,1); + T(VirtualAddr,2); + T(SecurityBlock,3); + S(CompleteInstr, "inst"); + T(Archi,4); + T(Options,5); + + if (test_instr(&x->Instruction) != 0) + return -1; + + if (test_argtype(&x->Argument1) != 0) + return -1; + + if (test_argtype(&x->Argument2) != 0) + return -1; + + if (test_argtype(&x->Argument3) != 0) + return -1; + + if (test_prefix(&x->Prefix) != 0) + return -1; + + return 0; +} diff --git a/test/Test_Marshal.hs b/test/Test_Marshal.hs new file mode 100644 index 0000000..9cb2a6b --- /dev/null +++ b/test/Test_Marshal.hs @@ -0,0 +1,120 @@ +module Main where +import Foreign.C.String +import Foreign.C.Types +import Foreign +import BeaEngine.Disasm +import BeaEngine.REX +import BeaEngine.PrefixInfo +import BeaEngine.EFL +import BeaEngine.MemoryType +import BeaEngine.InstrType +import BeaEngine.ArgType +import BeaEngine.Constants + +import System.Exit (exitFailure,exitSuccess) + + +testMEMORYTYPE = CMEMORYTYPE{ + cBaseRegister = 0, + cIndexRegister = 1, + cScale = 2, + cDisplacement = 3 + } + +testARGTYPE = CARGTYPE{ + cArgMnemonic = toCSTRZ "ArgMnemonic", + cArgType = 1, + cArgSize = 2, + cArgPosition = 3, + cAccessMode = 4, + cMemory = testMEMORYTYPE, + cSegmentReg = 5 + } + +testEFLStruct = CEFLStruct{ + cOF_ = 1, + cSF_ = 2, + cZF_ = 3, + cAF_ = 4, + cPF_ = 5, + cCF_ = 6, + cTF_ = 7, + cIF_ = 8, + cDF_ = 9, + cNT_ = 10, + cRF_ = 11, + BeaEngine.EFL.calignment = 12 + } + +testINSTRTYPE = CINSTRTYPE{ + cCategory = 0, + cOpcode = 1, + cMnemonic = toCSTRZ "InstrMnemonic", + cBranchType = 2, + cFlags = testEFLStruct, + cAddrValue = 3, + cImmediat = 4, + cImplicitModifiedRegs = 5 + } + +testREXSTRUCT = CREX_Struct{ + cW_ = 0, + cR_ = 1, + cX_ = 2, + cB_ = 3, + cstate = 4 + } + +testPREFIXINFO = CPREFIXINFO{ + cNumber = 0, + cNbUndefined = 1, + cLockPrefix = 2, + cOperandSize = 3, + cAddressSize = 4, + cRepnePrefix = 5, + cRepPrefix = 6, + cFSPrefix = 7, + cSSPrefix = 8, + cGSPrefix = 9, + cESPrefix = 10, + cCSPrefix = 11, + cDSPrefix = 12, + cBranchTaken = 13, + cBranchNotTaken = 14, + cREX = testREXSTRUCT, + BeaEngine.PrefixInfo.calignment = toCSTRZ "8" + } + +test_Disasm :: C_Disasm +test_Disasm = C_Disasm{ + cEIP=1, + cVirtualAddr=2, + cSecurityBlock=3, + cCompleteInstr=toCSTRZ "inst", + cArchi=4, + cOptions=5, + cInstruction=testINSTRTYPE, + cArgument1=testARGTYPE, + cArgument2=testARGTYPE, + cArgument3=testARGTYPE, + cPrefix=testPREFIXINFO, + cReserved_=[9,10,11]} + +toCSTRZ x = (map castCharToCChar x) ++ [0] + + + +foreign import ccall unsafe "print_disasm" + c_print_disasm :: Ptr C_Disasm -> IO () + +foreign import ccall unsafe "test_marshal" + c_test_marshal :: Ptr C_Disasm -> IO CInt + +main = alloca $ \p -> do + poke p test_Disasm + x <- c_test_marshal p + if (x /= 0) + then exitFailure + else exitSuccess + --c_print_disasm p + \ No newline at end of file