28 #ifndef FCML_COMMON_UTILS_H_ 29 #define FCML_COMMON_UTILS_H_ 324 fcml_uint16_t value);
336 fcml_uint32_t value);
348 fcml_uint64_t value);
364 fcml_int16_t seg, fcml_int16_t offset);
371 fcml_int16_t seg, fcml_int32_t offset);
378 fcml_int16_t offset, fcml_usize size_operator);
385 fcml_int32_t offset, fcml_usize size_operator);
394 fcml_int64_t offset, fcml_usize size_operator);
403 fcml_int64_t offset, fcml_usize size_operator);
410 fcml_int16_t disp, fcml_usize size_operator);
417 fcml_int32_t disp, fcml_usize size_operator);
424 fcml_int64_t disp, fcml_usize size_operator);
471 fcml_usize size_operator);
482 fcml_usize size_operator);
493 fcml_usize size_operator);
505 fcml_uint8_t scale_factor, fcml_int8_t disp, fcml_usize size_operator);
517 fcml_uint8_t scale_factor, fcml_int32_t disp, fcml_usize size_operator);
529 fcml_uint8_t scale_factor, fcml_int64_t disp, fcml_usize size_operator);
570 #define FCML_IMM8_S( x ) fcml_fn_cu_operand_signed_imm_8( x ) 571 #define FCML_IMM8( x ) fcml_fn_cu_operand_unsigned_imm_8( x ) 572 #define FCML_IMM16_S( x ) fcml_fn_cu_operand_signed_imm_16( x ) 573 #define FCML_IMM16( x ) fcml_fn_cu_operand_unsigned_imm_16( x ) 574 #define FCML_IMM32_S( x ) fcml_fn_cu_operand_signed_imm_32( x ) 575 #define FCML_IMM32( x ) fcml_fn_cu_operand_unsigned_imm_32( x ) 576 #define FCML_IMM64_S( x ) fcml_fn_cu_operand_signed_imm_64( x ) 577 #define FCML_IMM64( x ) fcml_fn_cu_operand_unsigned_imm_64( x ) 579 #ifdef FCML_USE_SHORT_REG 580 #define FCML_REG( x ) fcml_fn_cu_operand_reg( &fcml_reg_##x ) 582 #define FCML_REG( x ) fcml_fn_cu_operand_reg( &x ) 585 #define FCML_FAR_POINTER_16( seg, offset ) \ 586 fcml_fn_cu_operand_addr_far_pointer_offset16( seg, offset ) 587 #define FCML_FAR_POINTER_32( seg, offset ) \ 588 fcml_fn_cu_operand_addr_far_pointer_offset32( seg, offset ) 589 #define FCML_OFFSET_16( offset ) \ 590 fcml_fn_cu_operand_addr_offset_16( offset ) 591 #define FCML_OFFSET_32( offset ) \ 592 fcml_fn_cu_operand_addr_offset_32( offset ) 593 #define FCML_OFFSET_ABS_64( offset ) \ 594 fcml_fn_cu_operand_addr_offset_abs_64( offset ) 595 #define FCML_OFFSET_REL_64( offset ) \ 596 fcml_fn_cu_operand_addr_offset_rel_64( offset ) 597 #define FCML_DISP_16( offset ) \ 598 fcml_fn_cu_operand_addr_disp_16( offset ) 599 #define FCML_DISP_32( offset ) \ 600 fcml_fn_cu_operand_addr_disp_32( offset ) 601 #define FCML_DISP_64( offset ) \ 602 fcml_fn_cu_operand_addr_disp_64( offset ) 604 #ifdef FCML_USE_SHORT_REG 605 #define FCML_B_DISP_8(base, offset) \ 606 fcml_fn_cu_operand_addr_b_disp_8( &fcml_reg_##base, offset ) 607 #define FCML_B_DISP_16(base, offset) \ 608 fcml_fn_cu_operand_addr_b_disp_16( &fcml_reg_##base, offset ) 609 #define FCML_B_DISP_32(base, offset) \ 610 fcml_fn_cu_operand_addr_b_disp_32( &fcml_reg_##base, offset ) 611 #define FCML_B_DISP_64(base, offset) \ 612 fcml_fn_cu_operand_addr_b_disp_64( &fcml_reg_##base, offset ) 613 #define FCML_IS_DISP_8(index, scale, offset) \ 614 fcml_fn_cu_operand_addr_is_disp_8( &fcml_reg_##index, scale, offset ) 615 #define FCML_IS_DISP_16(index, scale, offset) \ 616 fcml_fn_cu_operand_addr_is_disp_32( &fcml_reg_##index, scale, offset ) 617 #define FCML_IS_DISP_32(index, scale, offset) \ 618 fcml_fn_cu_operand_addr_is_disp_64( &fcml_reg_##index, scale, offset ) 619 #define FCML_BIS_DISP_8(base, index, scale, offset) \ 620 fcml_fn_cu_operand_addr_bis_disp_8( &fcml_reg_##base, &fcml_reg_##index, \ 622 #define FCML_BIS_DISP_16(base, index, scale, offset) \ 623 fcml_fn_cu_operand_addr_bis_disp_32( &fcml_reg_##base, &fcml_reg_##index, \ 625 #define FCML_BIS_DISP_32(base, index, scale, offset) \ 626 fcml_fn_cu_operand_addr_bis_disp_64( &fcml_reg_##base, &fcml_reg_##index, \ 629 #define FCML_B_DISP_8(base, offset) \ 630 fcml_fn_cu_operand_addr_b_disp_8( &base, offset ) 631 #define FCML_B_DISP_16(base, offset) \ 632 fcml_fn_cu_operand_addr_b_disp_16( &base, offset ) 633 #define FCML_B_DISP_32(base, offset) \ 634 fcml_fn_cu_operand_addr_b_disp_32( &base, offset ) 635 #define FCML_B_DISP_64(base, offset) \ 636 fcml_fn_cu_operand_addr_b_disp_64( &base, offset ) 637 #define FCML_IS_DISP_8(index, scale, offset) \ 638 fcml_fn_cu_operand_addr_is_disp_8( &index, scale, offset ) 639 #define FCML_IS_DISP_16(index, scale, offset) \ 640 fcml_fn_cu_operand_addr_is_disp_32( &index, scale, offset ) 641 #define FCML_IS_DISP_32(index, scale, offset) \ 642 fcml_fn_cu_operand_addr_is_disp_64( &index, scale, offset ) 643 #define FCML_BIS_DISP_8(base, index, scale, offset) \ 644 fcml_fn_cu_operand_addr_bis_disp_8( &base, &index, scale, offset ) 645 #define FCML_BIS_DISP_16(base, index, scale, offset) \ 646 fcml_fn_cu_operand_addr_bis_disp_32( &base, &index, scale, offset ) 647 #define FCML_BIS_DISP_32(base, index, scale, offset) \ 648 fcml_fn_cu_operand_addr_bis_disp_64( &base, &index, scale, offset ) 651 #define FCML_IS_INSTRUCTION_GROUP(result, group) \ 652 ( result.instruction_details.instruction_group & ( group ) ) 653 #define FCML_IS_INSTRUCTION_CODE(result, _ins) \ 654 ( 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:673
fcml_uint16_t fcml_hints
Type used for storing instruction and operand hint masks.
Definition: fcml_common.h:86
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:783
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:450
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:735
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.