zydiskell 0.1.1.0 → 0.2.0.0
raw patch · 8 files changed
+312/−54 lines, 8 filesdep +containersdep −vector
Dependencies added: containers
Dependencies removed: vector
Files
- ChangeLog.md +11/−2
- README.md +9/−4
- src/Zydis/Decoder.hs +21/−22
- src/Zydis/Operand.hs +4/−4
- src/Zydis/Status.hs +244/−0
- src/Zydis/Types.hs +17/−17
- test/Main.hs +2/−2
- zydiskell.cabal +4/−3
ChangeLog.md view
@@ -1,3 +1,12 @@-# Changelog for zydiskell+[0.2.0.0] - Unreleased -## Unreleased changes+ * **Note**: breaking change.+ * `Zydis.Decoder.decodeFullBuffer` now return a `Seq` instead of a `Vector`.+ * introduce `ZyanStatus`, `ZyanCoreStatus` and `ZydisStatus` in `Zydis.Status` which are directly mapped from their C counterparts.++ * remove `vector` dependency+ * introduce `containers` dependency++[0.1.1.0] - November 2020++ * initial release
README.md view
@@ -1,3 +1,6 @@+[](https://github.com/nerded1337/zydiskell/actions)+[](https://hackage.haskell.org/package/zydiskell)+ # Zydiskell Haskell langage binding for the [Zydis library](https://github.com/zyantific/zydis), a fast and lightweight x86/x86-64 disassembler.@@ -7,7 +10,9 @@ - Recursively clone the project: `git clone --recursive https://github.com/nerded1337/zydiskell` - Either use Stack or Cabal: `stack build` | `cabal v2-build` -Note: The [Zydis library](https://github.com/zyantific/zydis) will be directly compiled by GHC.+Notes:+- the [Zydis library](https://github.com/zyantific/zydis) is directly embedded and compiled by GHC.+- we support the last three major GHC versions, currently: `8.6`, `8.8` and `8.10` ## Interface @@ -27,7 +32,7 @@ -> IO (Either Z.ZyanStatus Z.DecodedInstruction) Z.decodeFullBuffer- :: Z.Decoder -> ByteString -> IO (Either Z.ZyanStatus (Vector Z.DecodedInstruction))+ :: Z.Decoder -> ByteString -> IO (Either Z.ZyanStatus (Seq Z.DecodedInstruction)) ``` ## Example@@ -36,7 +41,7 @@ module Main where -import Data.Vector+import Data.Sequence import Data.Bifoldable import qualified Zydis as Z @@ -68,7 +73,7 @@ {- Given the decoded buffer, should output: [MnemonicMov,MnemonicPush,MnemonicRet] -}- printMnemonics :: Vector Z.DecodedInstruction -> IO ()+ printMnemonics :: Seq Z.DecodedInstruction -> IO () printMnemonics = print . fmap Z.decodedInstructionMnemonic decode :: Z.Decoder -> IO ()
src/Zydis/Decoder.hs view
@@ -23,6 +23,8 @@ module Zydis.Decoder ( ZyanStatus+ , ZydisStatus(..)+ , ZyanCoreStatus(..) , ZyanUSize , Offset , Length@@ -32,16 +34,17 @@ ) where -import Data.Bits import Data.ByteString as BS import Data.ByteString.Internal-import Data.Vector+import Data.Sequence import Data.Word import Foreign.ForeignPtr import Foreign.Marshal import Foreign.Ptr import Foreign.Storable+ import Zydis.Types+import Zydis.Status -- * FFI types @@ -49,8 +52,6 @@ type AddressWidthC = Word32 -type ZyanStatus = Word32- type ZyanUSize = Word64 type Offset = ZyanUSize@@ -60,27 +61,24 @@ -- * FFI declarations foreign import ccall unsafe "ZydisDecoderInit" c_ZydisDecoderInit- :: Ptr Decoder -> MachineModeC -> AddressWidthC -> IO ZyanStatus+ :: Ptr Decoder -> MachineModeC -> AddressWidthC -> IO ZyanNativeStatus foreign import ccall unsafe "ZydisDecoderDecodeBuffer" c_ZydisDecoderDecodeBuffer- :: Ptr Decoder -> Ptr Word8 -> ZyanUSize -> Ptr DecodedInstruction -> IO ZyanStatus+ :: Ptr Decoder -> Ptr Word8 -> ZyanUSize -> Ptr DecodedInstruction -> IO ZyanNativeStatus -- * FFI bridges --- | Directly stolen from https://github.com/zyantific/zycore-c/blob/71440fa634d1313db735d3262d453be641bb404f/include/Zycore/Status.h#L81-zyanSuccess :: Word32 -> Bool-zyanSuccess x = (x .&. 0x80000000) == 0-{-# INLINE zyanSuccess #-}- -- | Initialize a Zydis decoder, required to decode instructions. initialize :: MachineMode -> AddressWidth -> IO (Either ZyanStatus Decoder) initialize mm aw = alloca go where- go decoder = do- r <- c_ZydisDecoderInit decoder+ go decoderPtr = do+ r <- c_ZydisDecoderInit decoderPtr (fromIntegral $ fromEnum mm) (fromIntegral $ fromEnum aw)- if zyanSuccess r then Right <$> peek decoder else pure $ Left r+ case fromZyanNativeStatus r of+ Left ZyanCoreStatusSuccess -> Right <$> peek decoderPtr+ x -> pure $ Left x {-# INLINE initialize #-} -- | Decode a single intruction.@@ -106,27 +104,26 @@ -- | Efficiently decode an entire buffer of instructions. decodeFullBuffer- :: Decoder -> ByteString -> IO (Either ZyanStatus (Vector DecodedInstruction))+ :: Decoder -> ByteString -> IO (Either ZyanStatus (Seq DecodedInstruction)) decodeFullBuffer d bs = alloca @Decoder go where (bufferForeignPtr, _, bufferLength) = toForeignPtr bs - go decoderPtr = alloca @DecodedInstruction $ go' decoderPtr+ go = alloca @DecodedInstruction . go' - go' decoderPtr decodedInstructionPtr =- withForeignPtr bufferForeignPtr $ go'' decoderPtr decodedInstructionPtr+ go' decoderPtr = withForeignPtr bufferForeignPtr . go'' decoderPtr go'' decoderPtr decodedInstructionPtr bufferPtr = do poke decoderPtr d- loop (mempty @(Vector DecodedInstruction), 0, fromIntegral bufferLength)+ loop mempty 0 (fromIntegral bufferLength) where- loop (!v, !o, !l)+ loop !v !o !l | l > 0 = do x <- doDecodeInstruction decoderPtr decodedInstructionPtr bufferPtr o l case x of Right i -> do let il = fromIntegral $ decodedInstructionLength i- loop (v <> pure i, o + il, l - il)+ loop (v :|> i) (o + il) (l - il) Left s -> pure $ Left s | otherwise = pure $ Right v {-# INLINE decodeFullBuffer #-}@@ -143,5 +140,7 @@ (plusPtr bufferPtr (fromIntegral o)) l decodedInstructionPtr- if zyanSuccess r then Right <$> peek decodedInstructionPtr else pure $ Left r+ case fromZyanNativeStatus r of+ Left ZyanCoreStatusSuccess -> Right <$> peek decodedInstructionPtr+ x -> pure $ Left x {-# INLINE doDecodeInstruction #-}
src/Zydis/Operand.hs view
@@ -111,7 +111,7 @@ , operandMemoryBase :: !Register , operandMemoryIndex :: !Register , operandMemoryScale :: {-# UNPACK #-}!Word8- , operandMemoryDisplacement :: !OperandMemoryDisplacement+ , operandMemoryDisplacement :: {-# UNPACK #-}!OperandMemoryDisplacement } deriving stock (Show, Eq) @@ -144,9 +144,9 @@ , operandElementSize :: {-# UNPACK #-}!Word16 , operandElementCount :: {-# UNPACK #-}!Word16 , operandRegister :: !Register- , operandMemory :: !OperandMemory- , operandPointer :: !OperandPointer- , operandImmediate :: !OperandImmediate+ , operandMemory :: {-# UNPACK #-}!OperandMemory+ , operandPointer :: {-# UNPACK #-}!OperandPointer+ , operandImmediate :: {-# UNPACK #-}!OperandImmediate } deriving stock (Show, Eq)
+ src/Zydis/Status.hs view
@@ -0,0 +1,244 @@+-- Status.hs ---++-- Copyright (C) 2020 Nerd Ed++-- Author: Nerd Ed <nerded.nerded@gmail.com>++-- 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 <http://www.gnu.org/licenses/>.++{-# LANGUAGE DerivingStrategies #-}++-- | This module implement the zycore/zydis status codes.+--+-- Zycore ref: https://github.com/zyantific/zycore-c/blob/71440fa634d1313db735d3262d453be641bb404f/include/Zycore/Status.h#L134+--+-- Zydis ref: https://github.com/zyantific/zydis/blob/675c90ee7bc80d1aa6273e5ecfba0bd293bf89e9/include/Zydis/Status.h#L55+--+module Zydis.Status+ ( ZyanCoreStatus(..)+ , ZydisStatus(..)+ , ZyanStatus+ , ZyanNativeStatus+ , fromZyanNativeStatus+ )+where++import Data.Bits+import Data.Word++data ZyanCoreStatus+ = ZyanCoreStatusSuccess+ | ZyanCoreStatusFailed+ | ZyanCoreStatusTrue+ | ZyanCoreStatusFalse+ | ZyanCoreStatusInvalidArgument+ | ZyanCoreStatusInvalidOperation+ | ZyanCoreStatusAccessDenied+ | ZyanCoreStatusNotFound+ | ZyanCoreStatusOutOfRange+ | ZyanCoreStatusInsufficientBufferSize+ | ZyanCoreStatusNotEnoughMemory+ | ZyanCoreStatusBadSystemCall+ | ZyanCoreStatusOutOfResources+ | ZyanCoreStatusMissingDependency+ deriving stock (Show, Eq)++data ZydisStatus+ = ZydisStatusInvalidMask+ | ZydisStatusMalformedMvex+ | ZydisStatusMalformedEvex+ | ZydisStatusInvalidMap+ | ZydisStatusIllegalRex+ | ZydisStatusIllegalLegacyPFX+ | ZydisStatusIllegalLock+ | ZydisStatusBadRegister+ | ZydisStatusInstructionTooLong+ | ZydisStatusNoMoreData+ | ZydisStatusDecodingError+ | ZydisStatusSkipToken+ deriving stock (Show, Eq)++type ZyanStatus = Either ZyanCoreStatus ZydisStatus++type IsError = Bool++type ZyanNativeModule = Word16++type ZyanNativeStatusCode = Word32++type ZyanNativeStatus = Word32++-- | Combine the values into a unique error code.+--+-- This function is a direct copy of https://github.com/zyantific/zycore-c/blob/71440fa634d1313db735d3262d453be641bb404f/include/Zycore/Status.h#L67+--+makeZyanNativeStatus+ :: IsError -> ZyanNativeModule -> ZyanNativeStatusCode -> ZyanNativeStatus+makeZyanNativeStatus e m c =+ ((if e then 1 else 0) `shiftL` 31)+ .|. ((fromIntegral m .&. 0x7FF) `shiftL` 20)+ .|. (c .&. 0xFFFFF)+{-# INLINE makeZyanNativeStatus #-}++-- * Core status++zyanModuleCore :: ZyanNativeModule+zyanModuleCore = 0x001+{-# INLINE zyanModuleCore #-}++zyanCoreStatusSuccess :: ZyanNativeStatus+zyanCoreStatusSuccess = makeZyanNativeStatus False zyanModuleCore 0x00+{-# INLINE zyanCoreStatusSuccess #-}++zyanCoreStatusFailed :: ZyanNativeStatus+zyanCoreStatusFailed = makeZyanNativeStatus True zyanModuleCore 0x01+{-# INLINE zyanCoreStatusFailed #-}++zyanCoreStatusTrue :: ZyanNativeStatus+zyanCoreStatusTrue = makeZyanNativeStatus False zyanModuleCore 0x02+{-# INLINE zyanCoreStatusTrue #-}++zyanCoreStatusFalse :: ZyanNativeStatus+zyanCoreStatusFalse = makeZyanNativeStatus False zyanModuleCore 0x03+{-# INLINE zyanCoreStatusFalse #-}++zyanCoreStatusInvalidArgument :: ZyanNativeStatus+zyanCoreStatusInvalidArgument = makeZyanNativeStatus True zyanModuleCore 0x04+{-# INLINE zyanCoreStatusInvalidArgument #-}++zyanCoreStatusInvalidOperation :: ZyanNativeStatus+zyanCoreStatusInvalidOperation = makeZyanNativeStatus True zyanModuleCore 0x05+{-# INLINE zyanCoreStatusInvalidOperation #-}++zyanCoreStatusAccessDenied :: ZyanNativeStatus+zyanCoreStatusAccessDenied = makeZyanNativeStatus True zyanModuleCore 0x06+{-# INLINE zyanCoreStatusAccessDenied #-}++zyanCoreStatusNotFound :: ZyanNativeStatus+zyanCoreStatusNotFound = makeZyanNativeStatus True zyanModuleCore 0x07+{-# INLINE zyanCoreStatusNotFound #-}++zyanCoreStatusOutOfRange :: ZyanNativeStatus+zyanCoreStatusOutOfRange = makeZyanNativeStatus True zyanModuleCore 0x08+{-# INLINE zyanCoreStatusOutOfRange #-}++zyanCoreStatusInsufficientBufferSize :: ZyanNativeStatus+zyanCoreStatusInsufficientBufferSize =+ makeZyanNativeStatus True zyanModuleCore 0x09+{-# INLINE zyanCoreStatusInsufficientBufferSize #-}++zyanCoreStatusNotEnoughMemory :: ZyanNativeStatus+zyanCoreStatusNotEnoughMemory = makeZyanNativeStatus True zyanModuleCore 0x0A+{-# INLINE zyanCoreStatusNotEnoughMemory #-}++zyanCoreStatusBadSystemCall :: ZyanNativeStatus+zyanCoreStatusBadSystemCall = makeZyanNativeStatus True zyanModuleCore 0x0B+{-# INLINE zyanCoreStatusBadSystemCall #-}++zyanCoreStatusOutOfResources :: ZyanNativeStatus+zyanCoreStatusOutOfResources = makeZyanNativeStatus True zyanModuleCore 0x0C+{-# INLINE zyanCoreStatusOutOfResources #-}++zyanCoreStatusMissingDependency :: ZyanNativeStatus+zyanCoreStatusMissingDependency = makeZyanNativeStatus True zyanModuleCore 0x0D+{-# INLINE zyanCoreStatusMissingDependency #-}++-- * Zydis status+zyanModuleZydis :: ZyanNativeModule+zyanModuleZydis = 0x002+{-# INLINE zyanModuleZydis #-}++zydisStatusNoMoreData :: ZyanNativeStatus+zydisStatusNoMoreData = makeZyanNativeStatus True zyanModuleZydis 0x00+{-# INLINE zydisStatusNoMoreData #-}++zydisStatusDecodingError :: ZyanNativeStatus+zydisStatusDecodingError = makeZyanNativeStatus True zyanModuleZydis 0x01+{-# INLINE zydisStatusDecodingError #-}++zydisStatusInstructionTooLong :: ZyanNativeStatus+zydisStatusInstructionTooLong = makeZyanNativeStatus True zyanModuleZydis 0x02+{-# INLINE zydisStatusInstructionTooLong #-}++zydisStatusBadRegister :: ZyanNativeStatus+zydisStatusBadRegister = makeZyanNativeStatus True zyanModuleZydis 0x03+{-# INLINE zydisStatusBadRegister #-}++zydisStatusIllegalLock :: ZyanNativeStatus+zydisStatusIllegalLock = makeZyanNativeStatus True zyanModuleZydis 0x04+{-# INLINE zydisStatusIllegalLock #-}++zydisStatusIllegalLegacyPFX :: ZyanNativeStatus+zydisStatusIllegalLegacyPFX = makeZyanNativeStatus True zyanModuleZydis 0x05+{-# INLINE zydisStatusIllegalLegacyPFX #-}++zydisStatusIllegalRex :: ZyanNativeStatus+zydisStatusIllegalRex = makeZyanNativeStatus True zyanModuleZydis 0x06+{-# INLINE zydisStatusIllegalRex #-}++zydisStatusInvalidMap :: ZyanNativeStatus+zydisStatusInvalidMap = makeZyanNativeStatus True zyanModuleZydis 0x07+{-# INLINE zydisStatusInvalidMap #-}++zydisStatusMalformedEvex :: ZyanNativeStatus+zydisStatusMalformedEvex = makeZyanNativeStatus True zyanModuleZydis 0x08+{-# INLINE zydisStatusMalformedEvex #-}++zydisStatusMalformedMvex :: ZyanNativeStatus+zydisStatusMalformedMvex = makeZyanNativeStatus True zyanModuleZydis 0x09+{-# INLINE zydisStatusMalformedMvex #-}++zydisStatusInvalidMask :: ZyanNativeStatus+zydisStatusInvalidMask = makeZyanNativeStatus True zyanModuleZydis 0x0A+{-# INLINE zydisStatusInvalidMask #-}++zydisStatusSkipToken :: ZyanNativeStatus+zydisStatusSkipToken = makeZyanNativeStatus False zyanModuleZydis 0x0B+{-# INLINE zydisStatusSkipToken #-}++-- | Marshal low level Zyan/Zydis status to our "ZyanStatus".+--+-- This function must cover the complete range of possibilities.+--+fromZyanNativeStatus :: ZyanNativeStatus -> ZyanStatus+fromZyanNativeStatus s+ | s == zyanCoreStatusSuccess = Left ZyanCoreStatusSuccess+ | s == zyanCoreStatusFailed = Left ZyanCoreStatusFailed+ | s == zyanCoreStatusTrue = Left ZyanCoreStatusTrue+ | s == zyanCoreStatusFalse = Left ZyanCoreStatusFalse+ | s == zyanCoreStatusInvalidArgument = Left ZyanCoreStatusInvalidArgument+ | s == zyanCoreStatusInvalidOperation = Left ZyanCoreStatusInvalidOperation+ | s == zyanCoreStatusAccessDenied = Left ZyanCoreStatusAccessDenied+ | s == zyanCoreStatusNotFound = Left ZyanCoreStatusNotFound+ | s == zyanCoreStatusOutOfRange = Left ZyanCoreStatusOutOfRange+ | s == zyanCoreStatusInsufficientBufferSize = Left+ ZyanCoreStatusInsufficientBufferSize+ | s == zyanCoreStatusNotEnoughMemory = Left ZyanCoreStatusNotEnoughMemory+ | s == zyanCoreStatusBadSystemCall = Left ZyanCoreStatusBadSystemCall+ | s == zyanCoreStatusOutOfResources = Left ZyanCoreStatusOutOfResources+ | s == zyanCoreStatusMissingDependency = Left ZyanCoreStatusMissingDependency+ | s == zydisStatusNoMoreData = Right ZydisStatusNoMoreData+ | s == zydisStatusInvalidMask = Right ZydisStatusInvalidMask+ | s == zydisStatusMalformedMvex = Right ZydisStatusMalformedMvex+ | s == zydisStatusMalformedEvex = Right ZydisStatusMalformedEvex+ | s == zydisStatusInvalidMap = Right ZydisStatusInvalidMap+ | s == zydisStatusIllegalRex = Right ZydisStatusIllegalRex+ | s == zydisStatusIllegalLegacyPFX = Right ZydisStatusIllegalLegacyPFX+ | s == zydisStatusIllegalLock = Right ZydisStatusIllegalLock+ | s == zydisStatusBadRegister = Right ZydisStatusBadRegister+ | s == zydisStatusInstructionTooLong = Right ZydisStatusInstructionTooLong+ | s == zydisStatusDecodingError = Right ZydisStatusDecodingError+ | s == zydisStatusSkipToken = Right ZydisStatusSkipToken+ | otherwise = error $ "Fatal error, missing zyan status code: " <> show s+{-# INLINE fromZyanNativeStatus #-}
src/Zydis/Types.hs view
@@ -380,16 +380,16 @@ data DecodedInstructionRaw = DecodedInstructionRaw { decodedInstructionRawPrefixCount :: {-# UNPACK #-}!Word8- , decodedInstructionRawPrefixes :: !(Vec ZydisMaxInstructionLength DecodedInstructionRawPrefix)- , decodedInstructionRawRex :: !DecodedInstructionRawRex- , decodedInstructionRawXop :: !DecodedInstructionRawXop- , decodedInstructionRawVex :: !DecodedInstructionRawVex- , decodedInstructionRawEvex :: !DecodedInstructionRawEvex- , decodedInstructionRawMvex :: !DecodedInstructionRawMvex- , decodedInstructionRawModRm :: !DecodedInstructionModRm- , decodedInstructionRawSib :: !DecodedInstructionRawSib- , decodedInstructionRawDisp :: !DecodedInstructionRawDisp- , decodedInstructionRawImmediates :: !(Vec ZydisRawImmediateCount DecodedInstructionRawImmediate)+ , decodedInstructionRawPrefixes :: {-# UNPACK #-}!(Vec ZydisMaxInstructionLength DecodedInstructionRawPrefix)+ , decodedInstructionRawRex :: {-# UNPACK #-}!DecodedInstructionRawRex+ , decodedInstructionRawXop :: {-# UNPACK #-}!DecodedInstructionRawXop+ , decodedInstructionRawVex :: {-# UNPACK #-}!DecodedInstructionRawVex+ , decodedInstructionRawEvex :: {-# UNPACK #-}!DecodedInstructionRawEvex+ , decodedInstructionRawMvex :: {-# UNPACK #-}!DecodedInstructionRawMvex+ , decodedInstructionRawModRm :: {-# UNPACK #-}!DecodedInstructionModRm+ , decodedInstructionRawSib :: {-# UNPACK #-}!DecodedInstructionRawSib+ , decodedInstructionRawDisp :: {-# UNPACK #-}!DecodedInstructionRawDisp+ , decodedInstructionRawImmediates :: {-# UNPACK #-}!(Vec ZydisRawImmediateCount DecodedInstructionRawImmediate) } deriving stock (Show, Eq) @@ -485,8 +485,8 @@ data DecodedInstructionAvx = DecodedInstructionAvx { decodedInstructionAvxVectorLength :: {-# UNPACK #-}!Word16- , decodedInstructionAvxMask :: !DecodedInstructionAvxMask- , decodedInstructionAvxBroadcast :: !DecodedInstructionAvxBroadcast+ , decodedInstructionAvxMask :: {-# UNPACK #-}!DecodedInstructionAvxMask+ , decodedInstructionAvxBroadcast :: {-# UNPACK #-}!DecodedInstructionAvxBroadcast , decodedInstructionAvxRoundingMode :: !RoundingMode , decodedInstructionAvxSwizzleMode :: !SwizzleMode , decodedInstructionAvxConversionMode :: !ConversionMode@@ -526,12 +526,12 @@ , decodedInstructionOperandWidth :: {-# UNPACK #-}!Word8 , decodedInstructionAddressWidth :: {-# UNPACK #-}!Word8 , decodedInstructionOperandCount :: {-# UNPACK #-}!Word8- , decodedInstructionOperands :: !(Vec ZydisMaxOperandCount Operand)+ , decodedInstructionOperands :: {-# UNPACK #-}!(Vec ZydisMaxOperandCount Operand) , decodedInstructionAttributes :: {-# UNPACK #-}!Word64- , decodedInstructionAccessedFlags :: !(Vec (ZydisCpuFlagMaxValue + 1) CPUFlagAction)- , decodedInstructionAvx :: !DecodedInstructionAvx- , decodedInstructionMeta :: !DecodedInstructionMeta- , decodedInstructionRaw :: !DecodedInstructionRaw+ , decodedInstructionAccessedFlags :: {-# UNPACK #-}!(Vec (ZydisCpuFlagMaxValue + 1) CPUFlagAction)+ , decodedInstructionAvx :: {-# UNPACK #-}!DecodedInstructionAvx+ , decodedInstructionMeta :: {-# UNPACK #-}!DecodedInstructionMeta+ , decodedInstructionRaw :: {-# UNPACK #-}!DecodedInstructionRaw } deriving stock (Show, Eq)
test/Main.hs view
@@ -21,7 +21,7 @@ module Main where -import Data.Vector+import Data.Sequence import Data.Bifoldable import qualified Zydis as Z @@ -53,7 +53,7 @@ {- Given the decoded buffer, should output: [MnemonicMov,MnemonicPush,MnemonicRet] -}- printMnemonics :: Vector Z.DecodedInstruction -> IO ()+ printMnemonics :: Seq Z.DecodedInstruction -> IO () printMnemonics = print . fmap Z.decodedInstructionMnemonic decode :: Z.Decoder -> IO ()
zydiskell.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: zydiskell-version: 0.1.1.0+version: 0.2.0.0 synopsis: Haskell language binding for the Zydis library, a x86/x86-64 disassembler. description: Please see the README on GitHub at <https://github.com/nerded1337/zydiskell#readme> category: System, Parsing, Disassembler@@ -53,6 +53,7 @@ Zydis.PrefixType Zydis.Register Zydis.RoundingMode+ Zydis.Status Zydis.SwizzleMode Zydis.Types Zydis.Util@@ -140,9 +141,9 @@ build-depends: base >=4.7 && <4.15 , bytestring >=0.10 && <0.11+ , containers >=0.6 && <0.7 , fixed-vector >=1.2 && <1.3 , storable-record >=0.0.5 && <0.0.6- , vector >=0.12 && <0.13 default-language: Haskell2010 test-suite zydiskell-tests@@ -156,8 +157,8 @@ build-depends: base >=4.7 && <4.15 , bytestring >=0.10 && <0.11+ , containers >=0.6 && <0.7 , fixed-vector >=1.2 && <1.3 , storable-record >=0.0.5 && <0.0.6- , vector >=0.12 && <0.13 , zydiskell default-language: Haskell2010