foxdec-0.1.0.0: Formally Verified x86-64 Decompilation
Safe HaskellSafe-Inferred
LanguageHaskell2010

OutputGeneration.NASM.L0ToNASM

Description

 
Synopsis

Documentation

lift_L0_to_NASM :: BinaryClass bin => LiftedC bin -> NASM Source #

Lift an L0 representation to position-independent NASM

render_NASM :: (BinaryClass a, Eq pred) => (a, Config, L0 pred finit v) -> NASM -> [Char] Source #

Rendering NASM to a String

externals :: BinaryClass a => (a, b, c) -> Set String Source #

get the external functions and objects

external_objects :: BinaryClass a => (a, b, c) -> [String] Source #

get the external objects

block_label :: (Show p, Integral p, Num p, Eq p, BinaryClass a) => (a, b, c) -> p -> Word64 -> p -> NASM_Label Source #

Creating labels Given the entry address of the current function, the blockID of the current basic block, map an address to a label. First, try to see if it matches the _start symbol. Then, try to map the address to a known internal synbol (unstripped binaries may have such symbols available) Then, try to see if at the address a relocation is stored, and use that lavel if so. Otherwise, make a new custom label.

is_ro_data_section :: (String, String, c, d, e) -> Bool Source #

Information on sections TODO: get from Binary interface

entry_to_NASM :: BinaryClass bin => LiftedC bin -> Word64 -> NASM_Section Source #

convert a given function entry to a NASM text section

cfg_blocks_to_NASM :: BinaryClass bin => LiftedC bin -> Word64 -> CFG -> [Int] -> [(Int, [NASM_Line])] Source #

convert a list of basic blocks to NASM instructions Note that the order dictates if additional jumps need to be inserted

cfg_block_to_NASM :: BinaryClass bin => LiftedC bin -> Word64 -> CFG -> Int -> Maybe Int -> [NASM_Line] Source #

convert a single basic block to NASM instructions A block is translated to a header and its instructions

instr_to_NASM :: BinaryClass bin => (bin, Config, L0 (Sstate SValue SPointer) (FInit SValue SPointer) SValue) -> Word64 -> CFG -> Int -> Instruction -> [NASM_Line] Source #

convert an instruction to a NASM instruction

operand_to_NASM :: (BinaryClass bin, Integral t) => (bin, Config, L0 (Sstate SValue SPointer) (FInit SValue SPointer) SValue) -> t -> CFG -> Instruction -> Bool -> Operand -> (NASM_Operand, [(Word64, NASM_Label, Word64)]) Source #

convert an operand to a NASM operand Return both the translation (a String) as well as an optional annotation

address_to_NASM :: Operand -> NASM_Address_Computation Source #

convert the address of an operand to a NASM address -- TODO remove this

size_directive_to_NASM :: Instruction -> Int -> (Int, Bool) Source #

convert size directive of an operand to a NASM size directive

opcode_to_NASM :: Opcode -> Maybe Opcode Source #

convert opcode to a NASM opcode

symbolize_address :: (BinaryClass bin, Integral a) => (bin, Config, L0 (Sstate SValue SPointer) (FInit SValue SPointer) SValue) -> a -> CFG -> Instruction -> Operand -> (NASM_Address, [(Word64, NASM_Label, Word64)]) Source #

Symbolization of an address of an operand Return an optional annotation as well.

symbolize_immediate :: BinaryClass bin => LiftedC bin -> Maybe (Int, CFG) -> Bool -> Word64 -> Maybe (NASM_Address, Annot) Source #

Symbolization of an immediate value that is used as an address

try_symbolize_base :: BinaryClass bin => LiftedC bin -> Bool -> Word64 -> Maybe (NASM_Address, Annot) Source #

Symbolize (try to) an immediate address falling into the range of a section

__gmon_start_implementation :: String Source #

There is one specific symbol frequently encountered for which we cannot find the appropiate library to load. It is related to debugging information (the -g option of GCC). We therefore pvodie our own implementation: just a dummy, which is what the real function seems to do as well.