fcml
1.2.2
|
Structures and functions declarations related to FCML disassembler. More...
#include "fcml_lib_export.h"
#include "fcml_instructions.h"
#include "fcml_types.h"
#include "fcml_errors.h"
#include "fcml_common.h"
#include "fcml_dialect.h"
Go to the source code of this file.
Classes | |
struct | fcml_st_disassembler_conf |
Disassembler configuration. More... | |
struct | fcml_st_disassembler_context |
Disassembler context. More... | |
struct | fcml_st_instruction_prefix |
Describes one decoded prefix. More... | |
struct | fcml_st_prefixes_details |
Contains some additional information about all decoded instruction prefixes. More... | |
struct | fcml_st_operand_details |
Some additional disassembler specific information about decoded operands. More... | |
struct | fcml_st_raw_displacement |
Displacement in raw form. More... | |
struct | fcml_st_decoded_modrm_details |
Some basic information about decoded ModR/M and SIB bytes. More... | |
struct | fcml_st_instruction_details |
Additional instruction details provided by disassembler. More... | |
struct | fcml_st_disassembler_result |
Reusable disassembler result holder. More... | |
Macros | |
#define | FCML_DASM_PREFIXES_COUNT 12 |
Maximal number of instruction prefixes. More... | |
#define | FCML_DASM_CONDITIONAL_GROUP_1 0x00 |
First group of conditional suffixes (See FCML manual). More... | |
#define | FCML_DASM_CONDITIONAL_GROUP_2 0x01 |
Second group of conditional suffixes (See FCML manual). More... | |
Typedefs | |
typedef struct fcml_st_disassembler | fcml_st_disassembler |
This structure and type declaration represents an abstract disassembler. More... | |
typedef struct fcml_st_disassembler_conf | fcml_st_disassembler_conf |
Disassembler configuration. More... | |
typedef struct fcml_st_disassembler_context | fcml_st_disassembler_context |
Disassembler context. More... | |
typedef enum fcml_en_prefix_types | fcml_en_prefix_types |
Available types of instruction prefixes. More... | |
typedef struct fcml_st_instruction_prefix | fcml_st_instruction_prefix |
Describes one decoded prefix. More... | |
typedef struct fcml_st_prefixes_details | fcml_st_prefixes_details |
Contains some additional information about all decoded instruction prefixes. | |
typedef struct fcml_st_operand_details | fcml_st_operand_details |
Some additional disassembler specific information about decoded operands. More... | |
typedef struct fcml_st_raw_displacement | fcml_st_raw_displacement |
Displacement in raw form. | |
typedef struct fcml_st_decoded_modrm_details | fcml_st_decoded_modrm_details |
Some basic information about decoded ModR/M and SIB bytes. More... | |
typedef struct fcml_st_instruction_details | fcml_st_instruction_details |
Additional instruction details provided by disassembler. More... | |
typedef struct fcml_st_disassembler_result | fcml_st_disassembler_result |
Reusable disassembler result holder. More... | |
Enumerations | |
enum | fcml_en_prefix_types { FCML_PT_GROUP_UNKNOWN = 0, FCML_PT_GROUP_1 = 1, FCML_PT_GROUP_2, FCML_PT_GROUP_3, FCML_PT_GROUP_4, FCML_PT_REX, FCML_PT_VEX, FCML_PT_XOP, FCML_PT_EVEX } |
Available types of instruction prefixes. More... | |
Functions | |
LIB_EXPORT fcml_ceh_error LIB_CALL | fcml_fn_disassembler_init (const fcml_st_dialect *dialect, fcml_st_disassembler **disassembler) |
Initializes disassembler instance. More... | |
LIB_EXPORT fcml_ceh_error LIB_CALL | fcml_fn_disassemble (fcml_st_disassembler_context *context, fcml_st_disassembler_result *result) |
Disassembles one instruction from provided code buffer. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_disassembler_result_prepare (fcml_st_disassembler_result *result) |
Prepares reusable result holder for disassembler. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_disassembler_result_free (fcml_st_disassembler_result *result) |
Cleans result holder. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_disassembler_free (fcml_st_disassembler *disassembler) |
Frees disassembler instance. More... | |
Structures and functions declarations related to FCML disassembler.
#define FCML_DASM_CONDITIONAL_GROUP_1 0x00 |
First group of conditional suffixes (See FCML manual).
#define FCML_DASM_CONDITIONAL_GROUP_2 0x01 |
Second group of conditional suffixes (See FCML manual).
#define FCML_DASM_PREFIXES_COUNT 12 |
Maximal number of instruction prefixes.
typedef enum fcml_en_prefix_types fcml_en_prefix_types |
Available types of instruction prefixes.
For more information see Intel/AMD Architecture Manual.
typedef struct fcml_st_decoded_modrm_details fcml_st_decoded_modrm_details |
Some basic information about decoded ModR/M and SIB bytes.
typedef struct fcml_st_disassembler fcml_st_disassembler |
This structure and type declaration represents an abstract disassembler.
typedef struct fcml_st_disassembler_conf fcml_st_disassembler_conf |
Disassembler configuration.
typedef struct fcml_st_disassembler_context fcml_st_disassembler_context |
Disassembler context.
typedef struct fcml_st_disassembler_result fcml_st_disassembler_result |
Reusable disassembler result holder.
typedef struct fcml_st_instruction_details fcml_st_instruction_details |
Additional instruction details provided by disassembler.
typedef struct fcml_st_instruction_prefix fcml_st_instruction_prefix |
Describes one decoded prefix.
typedef struct fcml_st_operand_details fcml_st_operand_details |
Some additional disassembler specific information about decoded operands.
enum fcml_en_prefix_types |
Available types of instruction prefixes.
For more information see Intel/AMD Architecture Manual.
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_disassemble | ( | fcml_st_disassembler_context * | context, |
fcml_st_disassembler_result * | result | ||
) |
Disassembles one instruction from provided code buffer.
Disassembles the first instruction available in the provided code buffer using disassembler instance, configuration and entry point accessible through the disassembler context. Disassembled instruction model as well as potential errors are returned in reusable result holder given in the second parameter. Result holder has to be allocated by the user and appropriately prepared using fcml_fn_disassembler_result_prepare() function. As long as the instruction context and the result holder are not shared across multiple function calls disassembling process is thread safe.
context | Disassembler context. |
result | Appropriately prepared result holder. |
LIB_EXPORT void LIB_CALL fcml_fn_disassembler_free | ( | fcml_st_disassembler * | disassembler | ) |
Frees disassembler instance.
Every disassembler instance manages some resources internally and as such it has to be deallocated as soon as it is not needed anymore.
disassembler | Disassembler to be freed. |
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_disassembler_init | ( | const fcml_st_dialect * | dialect, |
fcml_st_disassembler ** | disassembler | ||
) |
Initializes disassembler instance.
Initializes disassembler instance for given dialect. Disassembler initialized in such a way is dialect dependent and generates generic instruction models compliant to the syntax supported by the dialect (Intel, AT&T). Every disassembler instance has to be freed using fcml_fn_disassembler_free() function as soon as it is not needed anymore.
dialect | Dialect for newly created disassembler. | |
[out] | disassembler | Initialized disassembler instance. |
LIB_EXPORT void LIB_CALL fcml_fn_disassembler_result_free | ( | fcml_st_disassembler_result * | result | ) |
Cleans result holder.
Frees all memory blocks allocated by the disassembler and held inside the result holder (Instructions, errors etc.). Notice that result holder itself is not freed and can be even safety reused after calling this function. In fact this function is also called internally by assembler in order to clean result holder before reusing it.
result | Result holder to clean. |
LIB_EXPORT void LIB_CALL fcml_fn_disassembler_result_prepare | ( | fcml_st_disassembler_result * | result | ) |
Prepares reusable result holder for disassembler.
Every instance of fcml_st_disassembler_result structure is reusable from the disassembler's point of view, so it has to be prepared in the right way in order to allow disassembler to reuse it correctly. It is up to the library user to allocate space for the holder itself. This function is only responsible for cleaning the structure correctly and preparing it for first disassembling process. Notice that disassembler has to clean the result holder at the beginning so you can not pass an uninitialized memory block because it can even cause a crash due to illegal memory access.
result | Result holder instance to be prepared. |