heystone-0.1.0: Haskell bindings for the Keystone assembler framework
Copyright(c) Adrian Herrera 2016
LicenseGPL-2
Safe HaskellSafe-Inferred
LanguageHaskell2010

Heystone

Description

Keystone is a lightweight multi-platform, multi-architecture assembler framework.

Further information is available at http://www.keystone-engine.org.

Synopsis

Assembler control

type Assembler a = ExceptT Error IO a Source #

The assembler runs in the IO monad and allows for the handling of errors "under the hood".

data Engine Source #

The Keystone engine.

data Mode Source #

CPU hardware mode.

Instances

Instances details
Bounded Mode Source # 
Instance details

Defined in Heystone.Internal.Keystone

Enum Mode Source # 
Instance details

Defined in Heystone.Internal.Keystone

Methods

succ :: Mode -> Mode #

pred :: Mode -> Mode #

toEnum :: Int -> Mode #

fromEnum :: Mode -> Int #

enumFrom :: Mode -> [Mode] #

enumFromThen :: Mode -> Mode -> [Mode] #

enumFromTo :: Mode -> Mode -> [Mode] #

enumFromThenTo :: Mode -> Mode -> Mode -> [Mode] #

Show Mode Source # 
Instance details

Defined in Heystone.Internal.Keystone

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

Eq Mode Source # 
Instance details

Defined in Heystone.Internal.Keystone

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

runAssembler Source #

Arguments

:: Assembler a

The assembler code to execute

-> IO (Either Error a)

A result on success, or an Error on failure

Run the Keystone assembler and return a result on success, or an Error on failure.

open Source #

Arguments

:: Architecture

CPU architecture

-> [Mode]

CPU hardware mode

-> Assembler Engine

A Keystone engine on success, or an Error on failure

Create a new instance of the Keystone assembler.

option Source #

Arguments

:: Engine

Keystone engine handle

-> OptionType

Type of option to set

-> OptionValue

Option value corresponding with the type

-> Assembler ()

An Error on failure

assemble Source #

Arguments

:: Engine

Keystone engine handle

-> [String]

List of statements to assemble.

-> Maybe Word64

Optional address of the first assembly instruction

-> Assembler (ByteString, Int)

Returns the encoded input assembly string and the number of statements successfully processed. Returns an Error on failure

Assemble a list of statements.

Error handling

data Error Source #

Errors encountered by the Keystone API. These values are returned by errno.

Instances

Instances details
Bounded Error Source # 
Instance details

Defined in Heystone.Internal.Core

Enum Error Source # 
Instance details

Defined in Heystone.Internal.Core

Show Error Source # 
Instance details

Defined in Heystone.Internal.Core

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Heystone.Internal.Core

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

errno Source #

Arguments

:: Engine

Keystone engine handle

-> Assembler Error

The last Error code

Report the Error number when some API function failed.

strerror Source #

Arguments

:: Error

The Error code

-> String

Description of the error code

Return a string describing the given Error.

Misc.

version :: Int Source #

Combined API version & major and minor version numbers. Returns a hexadecimal number as (major << 8 | minor), which encodes both major and minor versions.