26#ifndef FCML_ASSEMBLER_H_
27#define FCML_ASSEMBLER_H_
100 fcml_uint8_t __def_index;
struct fcml_st_assembler fcml_st_assembler
Abstract assembler representation.
Definition fcml_assembler.h:43
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_assemble(fcml_st_assembler_context *context, const fcml_st_instruction *instruction, fcml_st_assembler_result *result)
Assembles one instruction encoded in the generic instruction model.
LIB_EXPORT void LIB_CALL fcml_fn_assembler_result_prepare(fcml_st_assembler_result *result)
Prepares reusable result holder for assembler.
LIB_EXPORT void LIB_CALL fcml_fn_assembler_free(fcml_st_assembler *assembler)
Frees assembler instance.
LIB_EXPORT void LIB_CALL fcml_fn_assembler_instruction_detach(fcml_st_assembled_instruction **chain, fcml_st_assembled_instruction *instruction)
Detaches given instruction from the instructions chain.
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_assembler_init(const fcml_st_dialect *dialect, fcml_st_assembler **assembler)
Initializes assembler for given dialect.
LIB_EXPORT void LIB_CALL fcml_fn_assembler_instruction_free(fcml_st_assembled_instruction *instruction)
Frees assembled instruction.
LIB_EXPORT void LIB_CALL fcml_fn_assembler_result_free(fcml_st_assembler_result *result)
Cleans result holder.
API for instruction choosers.
fcml_ptr(LIB_CALL * fcml_fnp_asm_instruction_chooser)(fcml_st_chooser_context *chooser_context)
Instruction chooser function pointer declaration.
Definition fcml_choosers.h:68
Definitions of common structures used by FCML components.
Structures and functions related to dialects.
struct fcml_st_dialect fcml_st_dialect
Assembler dialect.
Definition fcml_dialect.h:36
Global error handling related declarations.
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition fcml_errors.h:156
Handles Win32 DLL symbols importing/exporting.
API for assembler optimizers.
fcml_ceh_error(LIB_CALL * fcml_fnp_asm_optimizer)(fcml_st_asm_optimizer_context *context, fcml_st_asm_optimizer_processing_details *ds_flags, fcml_fnp_asm_optimizer_callback callback, fcml_ptr args)
Function pointer declaration for optimizers.
Definition fcml_optimizers.h:102
Details describing an assembled instruction.
Definition fcml_common.h:809
This structure represents an encoded instruction.
Definition fcml_assembler.h:87
struct fcml_st_assembled_instruction * next
The next assembled instruction in the chain, if there is any.
Definition fcml_assembler.h:89
fcml_usize code_length
The instruction code length in bytes.
Definition fcml_assembler.h:95
fcml_st_ceh_error_container warnings
Optional warning messages related to the assembled instruction.
Definition fcml_assembler.h:91
fcml_uint8_t * code
The instruction's machine code.
Definition fcml_assembler.h:93
fcml_st_assembled_instruction_details details
Instruction flags, which can be helpful while choosing the final instruction.
Definition fcml_assembler.h:98
Assembler runtime configuration.
Definition fcml_assembler.h:48
fcml_fnp_asm_optimizer optimizer
The optimizer implementation that should be used by the assembler.
Definition fcml_assembler.h:70
fcml_bool choose_sib_encoding
If there are SIB and "ModR/M only" encodings available, choose the SIB based one.
Definition fcml_assembler.h:57
fcml_bool force_rex_prefix
Sometimes REX prefix is useless so it is just omitted in the final machine code.
Definition fcml_assembler.h:64
fcml_bool force_three_byte_VEX
Every 2-byte VEX/XOP prefix can be encoded using three byte form.
Definition fcml_assembler.h:67
fcml_fnp_asm_instruction_chooser chooser
The instruction chooser implementation that should be used by the assembler to choose the most approp...
Definition fcml_assembler.h:78
fcml_bool increment_ip
Set to true in order to force assembler to increment IP address by length of the assembled instructio...
Definition fcml_assembler.h:51
fcml_bool enable_error_messages
True if optional error and warning messages should be collected during processing.
Definition fcml_assembler.h:54
fcml_uint16_t optimizer_flags
This field is passed to the chosen optimizer.
Definition fcml_assembler.h:73
fcml_bool choose_abs_encoding
If memory address can be encoded as relative or absolute value choose the absolute addressing.
Definition fcml_assembler.h:60
Representation of the assembler runtime context.
Definition fcml_assembler.h:117
fcml_st_entry_point entry_point
Instruction entry point configuration.
Definition fcml_assembler.h:123
fcml_st_assembler * assembler
The assembler instance that should be used to assemble instructions.
Definition fcml_assembler.h:119
fcml_st_assembler_conf configuration
Assembler behavior can be configured here.
Definition fcml_assembler.h:121
This structure represents the assembler result.
Definition fcml_assembler.h:105
fcml_st_assembled_instruction * chosen_instruction
Instruction chosen by the used instruction chooser.
Definition fcml_assembler.h:111
fcml_st_ceh_error_container errors
Error and warning messages generated by the assembler.
Definition fcml_assembler.h:107
fcml_usize number_of_instructions
Number of encoded instruction forms.
Definition fcml_assembler.h:113
fcml_st_assembled_instruction * instructions
Chain of assembled instructions.
Definition fcml_assembler.h:109
Container for all collected errors and warnings.
Definition fcml_errors.h:180
Describes the execution context for the instruction being assembled.
Definition fcml_common.h:838
Represents an instruction as a generic model.
Definition fcml_common.h:781