libhd  5.0
Defines | Functions
decode.c File Reference
#include "x86emu/x86emui.h"
#include <time.h>

Defines

#define GET_SEGMENT(segment)

Functions

static void x86emu_intr_handle (void)
void x86emu_intr_raise (u8 intrnum)
void X86EMU_exec (unsigned timeout)
void X86EMU_halt_sys (void)
void fetch_decode_modrm (int *mod, int *regh, int *regl)
u8 fetch_byte_imm (void)
u16 fetch_word_imm (void)
u32 fetch_long_imm (void)
_INLINE u32 get_data_segment (void)
u8 fetch_data_byte (uint offset)
u16 fetch_data_word (uint offset)
u32 fetch_data_long (uint offset)
u8 fetch_data_byte_abs (uint segment, uint offset)
u16 fetch_data_word_abs (uint segment, uint offset)
u32 fetch_data_long_abs (uint segment, uint offset)
void store_data_byte (uint offset, u8 val)
void store_data_word (uint offset, u16 val)
void store_data_long (uint offset, u32 val)
void store_data_byte_abs (uint segment, uint offset, u8 val)
void store_data_word_abs (uint segment, uint offset, u16 val)
void store_data_long_abs (uint segment, uint offset, u32 val)
u8decode_rm_byte_register (int reg)
u16decode_rm_word_register (int reg)
u32decode_rm_long_register (int reg)
u16decode_rm_seg_register (int reg)
u32 decode_sib_address (int sib, int mod)
u32 decode_rm00_address (int rm)
u32 decode_rm01_address (int rm)
u32 decode_rm10_address (int rm)

Define Documentation

#define GET_SEGMENT (   segment)

Function Documentation

u32 decode_rm00_address ( int  rm)

References DECODE_PRINTF, DECODE_PRINTF2, decode_sib_address(), fetch_byte_imm(), fetch_long_imm(), fetch_word_imm(), HALT_SYS, M, SYSMODE_PREFIX_ADDR, and SYSMODE_SEG_DS_SS.

Referenced by x86emuOp2_bsf(), x86emuOp2_bsr(), x86emuOp2_bt_R(), x86emuOp2_btc_R(), x86emuOp2_btr_R(), x86emuOp2_btX_I(), x86emuOp2_imul_R_RM(), x86emuOp2_lfs_R_IMM(), x86emuOp2_lgs_R_IMM(), x86emuOp2_lss_R_IMM(), x86emuOp2_movsx_byte_R_RM(), x86emuOp2_movsx_word_R_RM(), x86emuOp2_movzx_byte_R_RM(), x86emuOp2_movzx_word_R_RM(), x86emuOp2_set_byte(), x86emuOp2_shld_CL(), x86emuOp2_shld_IMM(), x86emuOp2_shrd_CL(), x86emuOp2_shrd_IMM(), x86emuOp_adc_byte_R_RM(), x86emuOp_adc_byte_RM_R(), x86emuOp_adc_word_R_RM(), x86emuOp_adc_word_RM_R(), x86emuOp_add_byte_R_RM(), x86emuOp_add_byte_RM_R(), x86emuOp_add_word_R_RM(), x86emuOp_add_word_RM_R(), x86emuOp_and_byte_R_RM(), x86emuOp_and_byte_RM_R(), x86emuOp_and_word_R_RM(), x86emuOp_and_word_RM_R(), x86emuOp_cmp_byte_R_RM(), x86emuOp_cmp_byte_RM_R(), x86emuOp_cmp_word_R_RM(), x86emuOp_cmp_word_RM_R(), x86emuOp_esc_coprocess_d9(), x86emuOp_esc_coprocess_da(), x86emuOp_esc_coprocess_db(), x86emuOp_esc_coprocess_dc(), x86emuOp_esc_coprocess_dd(), x86emuOp_esc_coprocess_de(), x86emuOp_esc_coprocess_df(), x86emuOp_imul_byte_IMM(), x86emuOp_imul_word_IMM(), x86emuOp_lds_R_IMM(), x86emuOp_lea_word_R_M(), x86emuOp_les_R_IMM(), x86emuOp_mov_byte_R_RM(), x86emuOp_mov_byte_RM_IMM(), x86emuOp_mov_byte_RM_R(), x86emuOp_mov_word_R_RM(), x86emuOp_mov_word_RM_IMM(), x86emuOp_mov_word_RM_R(), x86emuOp_mov_word_RM_SR(), x86emuOp_mov_word_SR_RM(), x86emuOp_opc80_byte_RM_IMM(), x86emuOp_opc81_word_RM_IMM(), x86emuOp_opc82_byte_RM_IMM(), x86emuOp_opc83_word_RM_IMM(), x86emuOp_opcC0_byte_RM_MEM(), x86emuOp_opcC1_word_RM_MEM(), x86emuOp_opcD0_byte_RM_1(), x86emuOp_opcD1_word_RM_1(), x86emuOp_opcD2_byte_RM_CL(), x86emuOp_opcD3_word_RM_CL(), x86emuOp_opcF6_byte_RM(), x86emuOp_opcF7_word_RM(), x86emuOp_opcFE_byte_RM(), x86emuOp_opcFF_word_RM(), x86emuOp_or_byte_R_RM(), x86emuOp_or_byte_RM_R(), x86emuOp_or_word_R_RM(), x86emuOp_or_word_RM_R(), x86emuOp_pop_RM(), x86emuOp_sbb_byte_R_RM(), x86emuOp_sbb_byte_RM_R(), x86emuOp_sbb_word_R_RM(), x86emuOp_sbb_word_RM_R(), x86emuOp_sub_byte_R_RM(), x86emuOp_sub_byte_RM_R(), x86emuOp_sub_word_R_RM(), x86emuOp_sub_word_RM_R(), x86emuOp_test_byte_RM_R(), x86emuOp_test_word_RM_R(), x86emuOp_xchg_byte_RM_R(), x86emuOp_xchg_word_RM_R(), x86emuOp_xor_byte_R_RM(), x86emuOp_xor_byte_RM_R(), x86emuOp_xor_word_R_RM(), and x86emuOp_xor_word_RM_R().

u32 decode_rm01_address ( int  rm)

References DECODE_PRINTF2, decode_sib_address(), fetch_byte_imm(), HALT_SYS, M, SYSMODE_PREFIX_ADDR, and SYSMODE_SEG_DS_SS.

Referenced by x86emuOp2_bsf(), x86emuOp2_bsr(), x86emuOp2_bt_R(), x86emuOp2_btc_R(), x86emuOp2_btr_R(), x86emuOp2_btX_I(), x86emuOp2_imul_R_RM(), x86emuOp2_lfs_R_IMM(), x86emuOp2_lgs_R_IMM(), x86emuOp2_lss_R_IMM(), x86emuOp2_movsx_byte_R_RM(), x86emuOp2_movsx_word_R_RM(), x86emuOp2_movzx_byte_R_RM(), x86emuOp2_movzx_word_R_RM(), x86emuOp2_set_byte(), x86emuOp2_shld_CL(), x86emuOp2_shld_IMM(), x86emuOp2_shrd_CL(), x86emuOp2_shrd_IMM(), x86emuOp_adc_byte_R_RM(), x86emuOp_adc_byte_RM_R(), x86emuOp_adc_word_R_RM(), x86emuOp_adc_word_RM_R(), x86emuOp_add_byte_R_RM(), x86emuOp_add_byte_RM_R(), x86emuOp_add_word_R_RM(), x86emuOp_add_word_RM_R(), x86emuOp_and_byte_R_RM(), x86emuOp_and_byte_RM_R(), x86emuOp_and_word_R_RM(), x86emuOp_and_word_RM_R(), x86emuOp_cmp_byte_R_RM(), x86emuOp_cmp_byte_RM_R(), x86emuOp_cmp_word_R_RM(), x86emuOp_cmp_word_RM_R(), x86emuOp_esc_coprocess_d9(), x86emuOp_esc_coprocess_da(), x86emuOp_esc_coprocess_db(), x86emuOp_esc_coprocess_dc(), x86emuOp_esc_coprocess_dd(), x86emuOp_esc_coprocess_de(), x86emuOp_esc_coprocess_df(), x86emuOp_imul_byte_IMM(), x86emuOp_imul_word_IMM(), x86emuOp_lds_R_IMM(), x86emuOp_lea_word_R_M(), x86emuOp_les_R_IMM(), x86emuOp_mov_byte_R_RM(), x86emuOp_mov_byte_RM_IMM(), x86emuOp_mov_byte_RM_R(), x86emuOp_mov_word_R_RM(), x86emuOp_mov_word_RM_IMM(), x86emuOp_mov_word_RM_R(), x86emuOp_mov_word_RM_SR(), x86emuOp_mov_word_SR_RM(), x86emuOp_opc80_byte_RM_IMM(), x86emuOp_opc81_word_RM_IMM(), x86emuOp_opc82_byte_RM_IMM(), x86emuOp_opc83_word_RM_IMM(), x86emuOp_opcC0_byte_RM_MEM(), x86emuOp_opcC1_word_RM_MEM(), x86emuOp_opcD0_byte_RM_1(), x86emuOp_opcD1_word_RM_1(), x86emuOp_opcD2_byte_RM_CL(), x86emuOp_opcD3_word_RM_CL(), x86emuOp_opcF6_byte_RM(), x86emuOp_opcF7_word_RM(), x86emuOp_opcFE_byte_RM(), x86emuOp_opcFF_word_RM(), x86emuOp_or_byte_R_RM(), x86emuOp_or_byte_RM_R(), x86emuOp_or_word_R_RM(), x86emuOp_or_word_RM_R(), x86emuOp_pop_RM(), x86emuOp_sbb_byte_R_RM(), x86emuOp_sbb_byte_RM_R(), x86emuOp_sbb_word_R_RM(), x86emuOp_sbb_word_RM_R(), x86emuOp_sub_byte_R_RM(), x86emuOp_sub_byte_RM_R(), x86emuOp_sub_word_R_RM(), x86emuOp_sub_word_RM_R(), x86emuOp_test_byte_RM_R(), x86emuOp_test_word_RM_R(), x86emuOp_xchg_byte_RM_R(), x86emuOp_xchg_word_RM_R(), x86emuOp_xor_byte_R_RM(), x86emuOp_xor_byte_RM_R(), x86emuOp_xor_word_R_RM(), and x86emuOp_xor_word_RM_R().

u32 decode_rm10_address ( int  rm)

References DECODE_PRINTF2, decode_sib_address(), fetch_byte_imm(), fetch_long_imm(), fetch_word_imm(), HALT_SYS, M, SYSMODE_PREFIX_ADDR, SYSMODE_SEG_DS_SS, u16, and u32.

Referenced by x86emuOp2_bsf(), x86emuOp2_bsr(), x86emuOp2_bt_R(), x86emuOp2_btc_R(), x86emuOp2_btr_R(), x86emuOp2_btX_I(), x86emuOp2_imul_R_RM(), x86emuOp2_lfs_R_IMM(), x86emuOp2_lgs_R_IMM(), x86emuOp2_lss_R_IMM(), x86emuOp2_movsx_byte_R_RM(), x86emuOp2_movsx_word_R_RM(), x86emuOp2_movzx_byte_R_RM(), x86emuOp2_movzx_word_R_RM(), x86emuOp2_set_byte(), x86emuOp2_shld_CL(), x86emuOp2_shld_IMM(), x86emuOp2_shrd_CL(), x86emuOp2_shrd_IMM(), x86emuOp_adc_byte_R_RM(), x86emuOp_adc_byte_RM_R(), x86emuOp_adc_word_R_RM(), x86emuOp_adc_word_RM_R(), x86emuOp_add_byte_R_RM(), x86emuOp_add_byte_RM_R(), x86emuOp_add_word_R_RM(), x86emuOp_add_word_RM_R(), x86emuOp_and_byte_R_RM(), x86emuOp_and_byte_RM_R(), x86emuOp_and_word_R_RM(), x86emuOp_and_word_RM_R(), x86emuOp_cmp_byte_R_RM(), x86emuOp_cmp_byte_RM_R(), x86emuOp_cmp_word_R_RM(), x86emuOp_cmp_word_RM_R(), x86emuOp_esc_coprocess_d9(), x86emuOp_esc_coprocess_da(), x86emuOp_esc_coprocess_db(), x86emuOp_esc_coprocess_dc(), x86emuOp_esc_coprocess_dd(), x86emuOp_esc_coprocess_de(), x86emuOp_esc_coprocess_df(), x86emuOp_imul_byte_IMM(), x86emuOp_imul_word_IMM(), x86emuOp_lds_R_IMM(), x86emuOp_lea_word_R_M(), x86emuOp_les_R_IMM(), x86emuOp_mov_byte_R_RM(), x86emuOp_mov_byte_RM_IMM(), x86emuOp_mov_byte_RM_R(), x86emuOp_mov_word_R_RM(), x86emuOp_mov_word_RM_IMM(), x86emuOp_mov_word_RM_R(), x86emuOp_mov_word_RM_SR(), x86emuOp_mov_word_SR_RM(), x86emuOp_opc80_byte_RM_IMM(), x86emuOp_opc81_word_RM_IMM(), x86emuOp_opc82_byte_RM_IMM(), x86emuOp_opc83_word_RM_IMM(), x86emuOp_opcC0_byte_RM_MEM(), x86emuOp_opcC1_word_RM_MEM(), x86emuOp_opcD0_byte_RM_1(), x86emuOp_opcD1_word_RM_1(), x86emuOp_opcD2_byte_RM_CL(), x86emuOp_opcD3_word_RM_CL(), x86emuOp_opcF6_byte_RM(), x86emuOp_opcF7_word_RM(), x86emuOp_opcFE_byte_RM(), x86emuOp_opcFF_word_RM(), x86emuOp_or_byte_R_RM(), x86emuOp_or_byte_RM_R(), x86emuOp_or_word_R_RM(), x86emuOp_or_word_RM_R(), x86emuOp_pop_RM(), x86emuOp_sbb_byte_R_RM(), x86emuOp_sbb_byte_RM_R(), x86emuOp_sbb_word_R_RM(), x86emuOp_sbb_word_RM_R(), x86emuOp_sub_byte_R_RM(), x86emuOp_sub_byte_RM_R(), x86emuOp_sub_word_R_RM(), x86emuOp_sub_word_RM_R(), x86emuOp_test_byte_RM_R(), x86emuOp_test_word_RM_R(), x86emuOp_xchg_byte_RM_R(), x86emuOp_xchg_word_RM_R(), x86emuOp_xor_byte_R_RM(), x86emuOp_xor_byte_RM_R(), x86emuOp_xor_word_R_RM(), and x86emuOp_xor_word_RM_R().

u8* decode_rm_byte_register ( int  reg)

References DECODE_PRINTF, HALT_SYS, and M.

References DECODE_PRINTF, HALT_SYS, and M.

u16* decode_rm_seg_register ( int  reg)

References DECODE_PRINTF, HALT_SYS, and M.

u32 decode_sib_address ( int  sib,
int  mod 
)

References CHECK_IP_FETCH, DB, INC_DECODED_INST_LEN, M, u32, and x86emu_check_ip_access().

Referenced by decode_rm00_address(), decode_rm01_address(), decode_rm10_address(), x86emuOp2_btX_I(), x86emuOp2_shld_IMM(), x86emuOp2_shrd_IMM(), x86emuOp_aad(), x86emuOp_aam(), x86emuOp_adc_byte_AL_IMM(), x86emuOp_add_byte_AL_IMM(), x86emuOp_and_byte_AL_IMM(), x86emuOp_cmp_byte_AL_IMM(), x86emuOp_enter(), x86emuOp_imul_byte_IMM(), x86emuOp_in_byte_AL_IMM(), x86emuOp_in_word_AX_IMM(), x86emuOp_int_IMM(), x86emuOp_jcxz(), x86emuOp_jump_byte_IMM(), x86emuOp_jump_near_B(), x86emuOp_jump_near_BE(), x86emuOp_jump_near_L(), x86emuOp_jump_near_LE(), x86emuOp_jump_near_NB(), x86emuOp_jump_near_NBE(), x86emuOp_jump_near_NL(), x86emuOp_jump_near_NLE(), x86emuOp_jump_near_NO(), x86emuOp_jump_near_NP(), x86emuOp_jump_near_NS(), x86emuOp_jump_near_NZ(), x86emuOp_jump_near_O(), x86emuOp_jump_near_P(), x86emuOp_jump_near_S(), x86emuOp_jump_near_Z(), x86emuOp_loop(), x86emuOp_loope(), x86emuOp_loopne(), x86emuOp_mov_byte_AH_IMM(), x86emuOp_mov_byte_AL_IMM(), x86emuOp_mov_byte_BH_IMM(), x86emuOp_mov_byte_BL_IMM(), x86emuOp_mov_byte_CH_IMM(), x86emuOp_mov_byte_CL_IMM(), x86emuOp_mov_byte_DH_IMM(), x86emuOp_mov_byte_DL_IMM(), x86emuOp_mov_byte_RM_IMM(), x86emuOp_opc80_byte_RM_IMM(), x86emuOp_opc82_byte_RM_IMM(), x86emuOp_opc83_word_RM_IMM(), x86emuOp_opcC0_byte_RM_MEM(), x86emuOp_opcC1_word_RM_MEM(), x86emuOp_opcF6_byte_RM(), x86emuOp_or_byte_AL_IMM(), x86emuOp_out_byte_IMM_AL(), x86emuOp_out_word_IMM_AX(), x86emuOp_push_byte_IMM(), x86emuOp_sbb_byte_AL_IMM(), x86emuOp_sub_byte_AL_IMM(), x86emuOp_test_AL_IMM(), and x86emuOp_xor_byte_AL_IMM().

u8 fetch_data_byte ( uint  offset)
u8 fetch_data_byte_abs ( uint  segment,
uint  offset 
)
u32 fetch_data_long ( uint  offset)
u32 fetch_data_long_abs ( uint  segment,
uint  offset 
)
u16 fetch_data_word ( uint  offset)
u16 fetch_data_word_abs ( uint  segment,
uint  offset 
)
void fetch_decode_modrm ( int *  mod,
int *  regh,
int *  regl 
)
void store_data_byte ( uint  offset,
u8  val 
)
void store_data_byte_abs ( uint  segment,
uint  offset,
u8  val 
)
void store_data_long ( uint  offset,
u32  val 
)
void store_data_long_abs ( uint  segment,
uint  offset,
u32  val 
)
void store_data_word ( uint  offset,
u16  val 
)
void store_data_word_abs ( uint  segment,
uint  offset,
u16  val 
)
void X86EMU_exec ( unsigned  timeout)

References INTR_HALTED, and M.

Referenced by x86emuOp_illegal_op().

static void x86emu_intr_handle ( void  ) [static]
void x86emu_intr_raise ( u8  intrnum)

References INTR_SYNCH, and M.

Referenced by div_byte(), div_long(), div_word(), idiv_byte(), idiv_long(), and idiv_word().