28 #ifndef FCML_COMMON_UTILS_H_
29 #define FCML_COMMON_UTILS_H_
430 #define FCML_IMM8_S( x ) fcml_fn_cu_operand_signed_imm_8( x )
431 #define FCML_IMM8( x ) fcml_fn_cu_operand_unsigned_imm_8( x )
432 #define FCML_IMM16_S( x ) fcml_fn_cu_operand_signed_imm_16( x )
433 #define FCML_IMM16( x ) fcml_fn_cu_operand_unsigned_imm_16( x )
434 #define FCML_IMM32_S( x ) fcml_fn_cu_operand_signed_imm_32( x )
435 #define FCML_IMM32( x ) fcml_fn_cu_operand_unsigned_imm_32( x )
436 #define FCML_IMM64_S( x ) fcml_fn_cu_operand_signed_imm_64( x )
437 #define FCML_IMM64( x ) fcml_fn_cu_operand_unsigned_imm_64( x )
439 #ifdef FCML_USE_SHORT_REG
440 #define FCML_REG( x ) fcml_fn_cu_operand_reg( &fcml_reg_##x )
442 #define FCML_REG( x ) fcml_fn_cu_operand_reg( &x )
445 #define FCML_FAR_POINTER_16( seg, offset ) fcml_fn_cu_operand_addr_far_pointer_offset16( seg, offset )
446 #define FCML_FAR_POINTER_32( seg, offset ) fcml_fn_cu_operand_addr_far_pointer_offset32( seg, offset )
447 #define FCML_OFFSET_16( offset ) fcml_fn_cu_operand_addr_offset_16( offset )
448 #define FCML_OFFSET_32( offset ) fcml_fn_cu_operand_addr_offset_32( offset )
449 #define FCML_OFFSET_ABS_64( offset ) fcml_fn_cu_operand_addr_offset_abs_64( offset )
450 #define FCML_OFFSET_REL_64( offset ) fcml_fn_cu_operand_addr_offset_rel_64( offset )
451 #define FCML_DISP_16( offset ) fcml_fn_cu_operand_addr_disp_16( offset )
452 #define FCML_DISP_32( offset ) fcml_fn_cu_operand_addr_disp_32( offset )
453 #define FCML_DISP_64( offset ) fcml_fn_cu_operand_addr_disp_64( offset )
455 #ifdef FCML_USE_SHORT_REG
456 #define FCML_B_DISP_8( base, offset ) fcml_fn_cu_operand_addr_b_disp_8( &fcml_reg_##base, offset )
457 #define FCML_B_DISP_16( base, offset ) fcml_fn_cu_operand_addr_b_disp_16( &fcml_reg_##base, offset )
458 #define FCML_B_DISP_32( base, offset ) fcml_fn_cu_operand_addr_b_disp_32( &fcml_reg_##base, offset )
459 #define FCML_B_DISP_64( base, offset ) fcml_fn_cu_operand_addr_b_disp_64( &fcml_reg_##base, offset )
460 #define FCML_IS_DISP_8( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_8( &fcml_reg_##index, scale, offset )
461 #define FCML_IS_DISP_16( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_32( &fcml_reg_##index, scale, offset )
462 #define FCML_IS_DISP_32( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_64( &fcml_reg_##index, scale, offset )
463 #define FCML_BIS_DISP_8( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_8( &fcml_reg_##base, &fcml_reg_##index, scale, offset )
464 #define FCML_BIS_DISP_16( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_32( &fcml_reg_##base, &fcml_reg_##index, scale, offset )
465 #define FCML_BIS_DISP_32( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_64( &fcml_reg_##base, &fcml_reg_##index, scale, offset )
467 #define FCML_B_DISP_8( base, offset ) fcml_fn_cu_operand_addr_b_disp_8( &base, offset )
468 #define FCML_B_DISP_16( base, offset ) fcml_fn_cu_operand_addr_b_disp_16( &base, offset )
469 #define FCML_B_DISP_32( base, offset ) fcml_fn_cu_operand_addr_b_disp_32( &base, offset )
470 #define FCML_B_DISP_64( base, offset ) fcml_fn_cu_operand_addr_b_disp_64( &base, offset )
471 #define FCML_IS_DISP_8( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_8( &index, scale, offset )
472 #define FCML_IS_DISP_16( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_32( &index, scale, offset )
473 #define FCML_IS_DISP_32( index, scale, offset ) fcml_fn_cu_operand_addr_is_disp_64( &index, scale, offset )
474 #define FCML_BIS_DISP_8( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_8( &base, &index, scale, offset )
475 #define FCML_BIS_DISP_16( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_32( &base, &index, scale, offset )
476 #define FCML_BIS_DISP_32( base, index, scale, offset ) fcml_fn_cu_operand_addr_bis_disp_64( &base, &index, scale, offset )
479 #define FCML_IS_INSTRUCTION_GROUP( result, group ) ( result.instruction_details.instruction_group & ( group ) )
480 #define FCML_IS_INSTRUCTION_CODE( result, _ins ) ( result.instruction_details.instruction == _ins )
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_bis_disp_64(fcml_st_register *base, fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int64_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 32-bit displacement, base register, scale factor and index register.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_disp_16(fcml_int16_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 16-bit displacement.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_b_disp_32(fcml_st_register *base, fcml_int32_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 32-bit displacement and base register.
LIB_EXPORT fcml_st_instruction *LIB_CALL fcml_fn_cu_clone_instruction(fcml_st_instruction *instruction)
Clones given instruction.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_bis_disp_32(fcml_st_register *base, fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int32_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 16-bit displacement, base register, scale factor and index register.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_offset_abs_64(fcml_int64_t offset, fcml_usize size_operator)
Prepares memory addressing operand for 64-bit absolute offset.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_offset_rel_64(fcml_int64_t offset, fcml_usize size_operator)
Prepares memory addressing operand for 64-bit absolute offset.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_signed_imm_16(fcml_int16_t value)
Prepares immediate operand for signed int16.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_disp_32(fcml_int32_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 32-bit displacement.
fcml_en_operand_type
Supported operand types.
Definition: fcml_common.h:513
fcml_uint16_t fcml_hints
Type used for storing instruction and operand hint masks.
Definition: fcml_common.h:85
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_unsigned_imm_8(fcml_uint8_t value)
Prepares immediate operand for unsigned int8.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_unsigned_imm_64(fcml_uint64_t value)
Prepares immediate operand for unsigned int64.
Definitions of common structures used by FCML components.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_is_disp_64(fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int64_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 32-bit displacement, scale factor and index register...
Generic instruction model.
Definition: fcml_common.h:611
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_far_pointer_offset16(fcml_int16_t seg, fcml_int16_t offset)
Prepares far pointer operand for given segment and offset.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_signed_imm_8(fcml_int8_t value)
Prepares immediate operand for signed int8.
Handles Win32 DLL symbols importing/exporting.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_b_disp_16(fcml_st_register *base, fcml_int16_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 16-bit displacement and base register.
Structure describes x86_64 register.
Definition: fcml_common.h:325
Structures and functions declarations related to FCML disassembler.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_is_disp_8(fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int8_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 8-bit displacement, scale factor and index register...
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_far_pointer_offset32(fcml_int16_t seg, fcml_int32_t offset)
Prepares far pointer operand for given segment and offset.
LIB_EXPORT fcml_st_operand * fcml_fn_cu_find_operand(fcml_st_instruction *instruction, fcml_en_operand_type operand_type)
Gets operand of given type or NULL if there is no such operand.
LIB_EXPORT void LIB_CALL fcml_fn_cu_free_instruction(fcml_st_instruction *instruction)
Frees given instruction.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_is_disp_32(fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int32_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 16-bit displacement, scale factor and index register...
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_bis_disp_8(fcml_st_register *base, fcml_st_register *index, fcml_uint8_t scale_factor, fcml_int8_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 8-bit displacement, base register, scale factor and index register.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_disp_64(fcml_int64_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 64-bit displacement.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_offset_16(fcml_int16_t offset, fcml_usize size_operator)
Prepares memory addressing operand for 16-bit absolute offset.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_unsigned_imm_16(fcml_uint16_t value)
Prepares immediate operand for unsigned int16.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_b_disp_8(fcml_st_register *base, fcml_int8_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 8-bit displacement and base register.
Instruction operand.
Definition: fcml_common.h:567
Instruction codes and addressing modes/instruction forms.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_reg(fcml_st_register *reg)
Prepares register operand for given register.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_add_operand_hints(fcml_st_operand operand, fcml_hints hints)
Adds hints to the operand.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_signed_imm_64(fcml_int64_t value)
Prepares immediate operand for signed int64.
Structures and functions declarations related to one-line FCML assembler.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_signed_imm_32(fcml_int32_t value)
Prepares immediate operand for signed int32.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_offset_32(fcml_int32_t offset, fcml_usize size_operator)
Prepares memory addressing operand for 32-bit absolute offset.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_unsigned_imm_32(fcml_uint32_t value)
Prepares immediate operand for unsigned int32.
LIB_EXPORT fcml_st_operand LIB_CALL fcml_fn_cu_operand_addr_b_disp_64(fcml_st_register *base, fcml_int64_t disp, fcml_usize size_operator)
Prepares effective memory addressing operand for 64-bit displacement and base register.