diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/exporter.c | 4 | ||||
-rw-r--r-- | src/arch/x86/instruction.c | 4 | ||||
-rw-r--r-- | src/arch/x86/opcodes.h | 5 | ||||
-rw-r--r-- | src/arch/x86/operand.c | 3 | ||||
-rw-r--r-- | src/arch/x86/operand.h | 2 | ||||
-rw-r--r-- | src/arch/x86/processor.c | 884 | ||||
-rw-r--r-- | src/gtkext/gtkblockview.c | 8 |
7 files changed, 211 insertions, 699 deletions
diff --git a/src/analysis/exporter.c b/src/analysis/exporter.c index 54673d3..e78fd54 100644 --- a/src/analysis/exporter.c +++ b/src/analysis/exporter.c @@ -199,8 +199,6 @@ void g_content_exporter_insert_with_gtk_tag(GContentExporter *exporter, GtkTextB { size_t init; /* Point d'insertion initial */ - init = gtk_text_iter_get_offset(iter); - if (tag != RTT_NONE) gtk_text_buffer_insert_with_tags(buffer, iter, text, length, G_CONTENT_EXPORTER_GET_CLASS(exporter)->tags[tag], @@ -208,8 +206,6 @@ void g_content_exporter_insert_with_gtk_tag(GContentExporter *exporter, GtkTextB else gtk_text_buffer_insert_with_tags(buffer, iter, text, length, NULL); - gtk_text_iter_set_offset(iter, init + length); - } diff --git a/src/arch/x86/instruction.c b/src/arch/x86/instruction.c index dbfe1e9..6433c6f 100644 --- a/src/arch/x86/instruction.c +++ b/src/arch/x86/instruction.c @@ -87,8 +87,6 @@ static x86_instruction _instructions[XOP_COUNT] = { [XOP_ADD_AL_IMM8] = { false, 0x04, IDX_TO_EXT(-1), "add", XPX_NONE }, [XOP_ADD_E_AX_IMM1632] = { false, 0x05, IDX_TO_EXT(-1), "add", XPX_OPERAND_SIZE_OVERRIDE }, - [XOP_OR_R8_RM8] = { false, 0x0a, IDX_TO_EXT(-1), "or", XPX_NONE }, - [XOP_OR_RM8_R8] = { false, 0x08, IDX_TO_EXT(-1), "or", XPX_NONE }, [XOP_OR_RM1632_R1632] = { false, 0x09, IDX_TO_EXT(-1), "or", XPX_OPERAND_SIZE_OVERRIDE }, [XOP_OR_R8_RM8] = { false, 0x0a, IDX_TO_EXT(-1), "or", XPX_NONE }, @@ -588,6 +586,8 @@ static const char *x86_get_instruction_text(const GX86Instruction *instr, const { const char *result; /* Chaîne à retourner */ + return _instructions[instr->type].keyword; + result = strdup(_instructions[instr->type].keyword); /* FIXME : diff --git a/src/arch/x86/opcodes.h b/src/arch/x86/opcodes.h index e3c719c..aaa4b55 100644 --- a/src/arch/x86/opcodes.h +++ b/src/arch/x86/opcodes.h @@ -30,6 +30,11 @@ +/* Prototype de décodage d'une instruction x86. */ +typedef GArchInstruction * (* x86_read_instr) (const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + + + /* Décode une instruction de type 'adc' (8 bits). */ GArchInstruction *x86_read_instr_adc_rm8_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c index 09a3489..cf4c863 100644 --- a/src/arch/x86/operand.c +++ b/src/arch/x86/operand.c @@ -1180,6 +1180,9 @@ bool _x86_read_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, for (i = 0; i < count; i++) types[i] = va_arg(ap, AsmOperandSize); + for ( ; i < MAX_OPERANDS; i++) + types[i] = X86_OTP_NONE; + /* Initialisations */ if (types[0] & X86_OTP_RM_TYPE) diff --git a/src/arch/x86/operand.h b/src/arch/x86/operand.h index 2d8232d..497f99a 100644 --- a/src/arch/x86/operand.h +++ b/src/arch/x86/operand.h @@ -211,6 +211,8 @@ GArchOperand *g_x86_data_operand_new(MemoryDataSize, bool); /* Types d'opérandes supportés */ typedef enum _X86OperandType { + X86_OTP_NONE = 0, /* Aucun opérande de prévu */ + X86_OTP_IMM8 = X86_OTP_IMM(1), /* Valeur immédiate sur 8 bits */ X86_OTP_IMM1632 = X86_OTP_IMM(2), /* Valeur immédiate sur 16/32b */ X86_OTP_MOFFS8 = X86_OTP_IMM(3), /* Décallage immédiat 8 bits */ diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c index cafd91c..b9932a0 100644 --- a/src/arch/x86/processor.c +++ b/src/arch/x86/processor.c @@ -179,6 +179,201 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor bool care; /* Traitement des opcodes */ X86Opcodes id; /* Identifiant d'instruction */ + static const x86_read_instr decodings[XOP_COUNT] = { + + [XOP_ADD_RM8_R8] = x86_read_instr_add_rm8_r8, + [XOP_ADD_RM1632_R1632] = x86_read_instr_add_rm1632_r1632, + [XOP_ADD_R8_RM8] = x86_read_instr_add_r8_rm8, + [XOP_ADD_R1632_RM1632] = x86_read_instr_add_r1632_rm1632, + [XOP_ADD_AL_IMM8] = x86_read_instr_add_al_imm8, + [XOP_ADD_E_AX_IMM1632] = x86_read_instr_add_e_ax_imm1632, + [XOP_OR_RM8_R8] = x86_read_instr_or_rm8_r8, + [XOP_OR_RM1632_R1632] = x86_read_instr_or_rm1632_r1632, + [XOP_OR_R8_RM8] = x86_read_instr_or_r8_rm8, + [XOP_OR_R1632_RM1632] = x86_read_instr_or_r1632_rm1632, + [XOP_OR_AL_IMM8] = x86_read_instr_or_al_imm8, + [XOP_JE_REL1632] = x86_read_instr_je_rel1632, + [XOP_JNE_REL1632] = x86_read_instr_jne_rel1632, + [XOP_JBE_REL1632] = x86_read_instr_jbe_rel1632, + [XOP_JA_REL1632] = x86_read_instr_ja_rel1632, + [XOP_JGE_REL1632] = x86_read_instr_jge_rel1632, + [XOP_JLE_REL1632] = x86_read_instr_jle_rel1632, + [XOP_JG_REL1632] = x86_read_instr_jg_rel1632, + [XOP_SETE_RM8] = x86_read_instr_sete_rm8, + [XOP_SETNE_RM8] = x86_read_instr_setne_rm8, + [XOP_SETL_RM8] = x86_read_instr_setl_rm8, + [XOP_MOVZX_R1632_RM8] = x86_read_instr_movzx_r1632_rm8, + [XOP_MOVSX_R1632_RM8] = x86_read_instr_movsx_r1632_rm8, + [XOP_MOVSX_R1632_RM1632] = x86_read_instr_movsx_r1632_rm1632, + [XOP_ADC_RM8_R8] = x86_read_instr_adc_rm8_r8, + [XOP_AND_RM8_R8] = x86_read_instr_and_rm8_r8, + [XOP_AND_RM1632_R1632] = x86_read_instr_and_rm1632_r1632, + [XOP_AND_AL_IMM8] = x86_read_instr_and_al_imm8, + [XOP_AND_E_AX_IMM1632] = x86_read_instr_and_e_ax_imm1632, + [XOP_SUB_RM1632_R1632] = x86_read_instr_sub_rm1632_r1632, + [XOP_SUB_R8_RM8] = x86_read_instr_sub_r8_rm8, + [XOP_SUB_AL_IMM8] = x86_read_instr_sub_al_imm8, + [XOP_SUB_E_AX_IMM1632] = x86_read_instr_sub_e_ax_imm1632, + [XOP_XOR_RM8_R8] = x86_read_instr_xor_rm8_r8, + [XOP_XOR_RM1632_R1632] = x86_read_instr_xor_rm1632_r1632, + [XOP_XOR_R8_RM8] = x86_read_instr_xor_r8_rm8, + [XOP_XOR_R1632_RM1632] = x86_read_instr_xor_r1632_rm1632, + [XOP_XOR_AL_IMM8] = x86_read_instr_xor_al_imm8, + [XOP_XOR_E_AX_IMM1632] = x86_read_instr_xor_e_ax_imm1632, + [XOP_CMP_RM1632_R1632] = x86_read_instr_cmp_rm1632_r1632, + [XOP_CMP_R1632_RM1632] = x86_read_instr_cmp_r1632_rm1632, + [XOP_INC_E_AX] = x86_read_instr_inc_r1632, + [XOP_INC_E_CX] = x86_read_instr_inc_r1632, + [XOP_INC_E_DX] = x86_read_instr_inc_r1632, + [XOP_INC_E_BX] = x86_read_instr_inc_r1632, + [XOP_INC_E_SP] = x86_read_instr_inc_r1632, + [XOP_INC_E_BP] = x86_read_instr_inc_r1632, + [XOP_INC_E_SI] = x86_read_instr_inc_r1632, + [XOP_INC_E_DI] = x86_read_instr_inc_r1632, + [XOP_DEC_E_AX] = x86_read_instr_dec_r1632, + [XOP_DEC_E_CX] = x86_read_instr_dec_r1632, + [XOP_DEC_E_DX] = x86_read_instr_dec_r1632, + [XOP_DEC_E_BX] = x86_read_instr_dec_r1632, + [XOP_DEC_E_SP] = x86_read_instr_dec_r1632, + [XOP_DEC_E_BP] = x86_read_instr_dec_r1632, + [XOP_DEC_E_SI] = x86_read_instr_dec_r1632, + [XOP_DEC_E_DI] = x86_read_instr_dec_r1632, + [XOP_PUSH_E_AX] = x86_read_instr_push_r1632, + [XOP_PUSH_E_CX] = x86_read_instr_push_r1632, + [XOP_PUSH_E_DX] = x86_read_instr_push_r1632, + [XOP_PUSH_E_BX] = x86_read_instr_push_r1632, + [XOP_PUSH_E_SP] = x86_read_instr_push_r1632, + [XOP_PUSH_E_BP] = x86_read_instr_push_r1632, + [XOP_PUSH_E_SI] = x86_read_instr_push_r1632, + [XOP_PUSH_E_DI] = x86_read_instr_push_r1632, + [XOP_POP_E_AX] = x86_read_instr_pop_r1632, + [XOP_POP_E_CX] = x86_read_instr_pop_r1632, + [XOP_POP_E_DX] = x86_read_instr_pop_r1632, + [XOP_POP_E_BX] = x86_read_instr_pop_r1632, + [XOP_POP_E_SP] = x86_read_instr_pop_r1632, + [XOP_POP_E_BP] = x86_read_instr_pop_r1632, + [XOP_POP_E_SI] = x86_read_instr_pop_r1632, + [XOP_POP_E_DI] = x86_read_instr_pop_r1632, + [XOP_PUSH_IMM1632] = x86_read_instr_push_imm1632, + [XOP_IMUL_R1632_RM1632_IMM1632] = x86_read_instr_imul_r1632_rm1632_imm1632, + [XOP_IMUL_RM1632_IMM8] = x86_read_instr_imul_rm1632_imm8, + [XOP_JO_REL8] = x86_read_instr_jo_rel8, + [XOP_JNO_REL8] = x86_read_instr_jno_rel8, + [XOP_JB_REL8] = x86_read_instr_jb_rel8, + [XOP_JNB_REL8] = x86_read_instr_jnb_rel8, + [XOP_JE_REL8] = x86_read_instr_je_rel8, + [XOP_JNE_REL8] = x86_read_instr_jne_rel8, + [XOP_JNA_REL8] = x86_read_instr_jna_rel8, + [XOP_JA_REL8] = x86_read_instr_ja_rel8, + [XOP_JS_REL8] = x86_read_instr_js_rel8, + [XOP_JNS_REL8] = x86_read_instr_jns_rel8, + [XOP_JP_REL8] = x86_read_instr_jp_rel8, + [XOP_JNP_REL8] = x86_read_instr_jnp_rel8, + [XOP_JL_REL8] = x86_read_instr_jl_rel8, + [XOP_JNL_REL8] = x86_read_instr_jnl_rel8, + [XOP_JNG_REL8] = x86_read_instr_jng_rel8, + [XOP_JG_REL8] = x86_read_instr_jg_rel8, + [XOP_ADD_RM8_IMM8] = x86_read_instr_add_rm8_imm8, + [XOP_OR_RM8_IMM8] = x86_read_instr_or_rm8_imm8, + [XOP_ADC_RM8_IMM8] = x86_read_instr_adc_rm8_imm8, + [XOP_SBB_RM8_IMM8] = x86_read_instr_sbb_rm8_imm8, + [XOP_AND_RM8_IMM8] = x86_read_instr_and_rm8_imm8, + [XOP_SUB_RM8_IMM8] = x86_read_instr_sub_rm8_imm8, + [XOP_XOR_RM8_IMM8] = x86_read_instr_xor_rm8_imm8, + [XOP_CMP_RM8_IMM8] = x86_read_instr_cmp_rm8_imm8, + [XOP_ADD_RM1632_IMM1632] = x86_read_instr_add_rm1632_imm1632, + [XOP_OR_RM1632_IMM1632] = x86_read_instr_or_rm1632_imm1632, + [XOP_ADC_RM1632_IMM1632] = x86_read_instr_adc_rm1632_imm1632, + [XOP_SBB_RM1632_IMM1632] = x86_read_instr_sbb_rm1632_imm1632, + [XOP_AND_RM1632_IMM1632] = x86_read_instr_and_rm1632_imm1632, + [XOP_SUB_RM1632_IMM1632] = x86_read_instr_sub_rm1632_imm1632, + [XOP_XOR_RM1632_IMM1632] = x86_read_instr_xor_rm1632_imm1632, + [XOP_CMP_RM1632_IMM1632] = x86_read_instr_cmp_rm1632_imm1632, + [XOP_ADD_RM1632_IMM8] = x86_read_instr_add_rm1632_imm8, + [XOP_OR_RM1632_IMM8] = x86_read_instr_or_rm1632_imm8, + [XOP_ADC_RM1632_IMM8] = x86_read_instr_adc_rm1632_imm8, + [XOP_SBB_RM1632_IMM8] = x86_read_instr_sbb_rm1632_imm8, + [XOP_AND_RM1632_IMM8] = x86_read_instr_and_rm1632_imm8, + [XOP_SUB_RM1632_IMM8] = x86_read_instr_sub_rm1632_imm8, + [XOP_XOR_RM1632_IMM8] = x86_read_instr_xor_rm1632_imm8, + [XOP_CMP_RM1632_IMM8] = x86_read_instr_cmp_rm1632_imm8, + [XOP_TEST_RM8_R8] = x86_read_instr_test_rm8_r8, + [XOP_TEST_RM1632_R1632] = x86_read_instr_test_rm1632_r1632, + [XOP_MOV_RM8_R8] = x86_read_instr_mov_rm8_r8, + [XOP_MOV_RM1632_R1632] = x86_read_instr_mov_rm1632_r1632, + [XOP_MOV_R1632_RM1632] = x86_read_instr_mov_r1632_rm1632, + [XOP_LEA_R1632_M] = x86_read_instr_lea_r1632_m, + [XOP_NOP] = x86_read_instr_nop, + [XOP_XCHG_R1632_E_AX] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_CX] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_DX] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_BX] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_SP] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_BP] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_SI] = x86_read_instr_xchg_r1632_e_ax, + [XOP_XCHG_R1632_E_DI] = x86_read_instr_xchg_r1632_e_ax, + [XOP_MOV_AL_MOFFS8] = x86_read_instr_mov_al_moffs8, + [XOP_MOV_E_AX_MOFFS1632] = x86_read_instr_mov_e_ax_moffs1632, + [XOP_MOV_MOFFS8_AL] = x86_read_instr_mov_moffs8_al, + [XOP_MOV_MOFFS1632_E_AX] = x86_read_instr_mov_moffs1632_e_ax, + [XOP_MOVS_M1632_M1632] = x86_read_instr_movs_m1632_m1632, + [XOP_TEST_AL_IMM8] = x86_read_instr_test_al_imm8, + [XOP_TEST_E_AX_IMM1632] = x86_read_instr_test_e_ax_imm1632, + [XOP_STOS_M1632_E_AX] = x86_read_instr_stos_m1632_e_ax, + [XOP_SCAS_AL_M8] = x86_read_instr_scas_al_m8, + [XOP_MOV_AL_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_CL_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_DL_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_BL_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_AH_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_CH_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_DH_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_BH_IMM8] = x86_read_instr_mov_r8_imm8, + [XOP_MOV_E_AX_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_CX_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_DX_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_BX_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_SP_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_BP_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_SI_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_MOV_E_DI_IMM1632] = x86_read_instr_mov_r1632_imm1632, + [XOP_ROL_RM1632_IMM8] = x86_read_instr_rol_rm1632_imm8, + [XOP_ROR_RM1632_IMM8] = x86_read_instr_ror_rm1632_imm8, + [XOP_RCL_RM1632_IMM8] = x86_read_instr_rcl_rm1632_imm8, + [XOP_RCR_RM1632_IMM8] = x86_read_instr_rcr_rm1632_imm8, + [XOP_SHL_RM1632_IMM8] = x86_read_instr_shl_rm1632_imm8, + [XOP_SHR_RM1632_IMM8] = x86_read_instr_shr_rm1632_imm8, + [XOP_SAL_RM1632_IMM8] = x86_read_instr_sal_rm1632_imm8, + [XOP_SAR_RM1632_IMM8] = x86_read_instr_sar_rm1632_imm8, + [XOP_RET] = x86_read_instr_ret, + [XOP_MOV_RM8_IMM8] = x86_read_instr_mov_rm8_imm8, + [XOP_MOV_RM1632_IMM1632] = x86_read_instr_mov_rm1632_imm1632, + [XOP_LEAVE] = x86_read_instr_leave, + [XOP_INT_3] = x86_read_instr_int_3, + [XOP_INT] = x86_read_instr_int_imm8, + [XOP_SHL_RM1632_CL] = x86_read_instr_shl_rm1632_cl, + [XOP_CALL_REL1632] = x86_read_instr_call_rel1632, + [XOP_JMP_REL1632] = x86_read_instr_jmp_rel1632, + [XOP_JMP_REL8] = x86_read_instr_jmp_rel8, + [XOP_HLT] = x86_read_instr_hlt, + [XOP_TEST_RM8_IMM8] = x86_read_instr_test_rm8_imm8, + [XOP_TEST_RM8_IMM8_BIS] = x86_read_instr_test_rm8_imm8, + [XOP_NOT_RM8] = x86_read_instr_not_rm8, + [XOP_TEST_RM1632_IMM1632] = x86_read_instr_test_rm1632_imm1632, + [XOP_TEST_RM1632_IMM1632_BIS] = x86_read_instr_test_rm1632_imm1632, + [XOP_NOT_RM1632] = x86_read_instr_not_rm1632, + [XOP_IMUL_RM1632] = x86_read_instr_imul_rm1632, + [XOP_CLD] = x86_read_instr_cld, + [XOP_INC_RM8] = x86_read_instr_inc_rm8, + [XOP_DEC_RM8] = x86_read_instr_dec_rm8, + [XOP_INC_RM1632] = x86_read_instr_inc_rm1632, + [XOP_DEC_RM1632] = x86_read_instr_dec_rm1632, + [XOP_CALL_RM1632] = x86_read_instr_call_rm1632, + [XOP_JMP_RM1632] = x86_read_instr_jmp_rm1632, + [XOP_PUSH_RM1632] = x86_read_instr_push_rm1632 + + }; + id = x86_guess_next_instruction(data, *pos, len, &prefix, &care); if (prefix & XPX_TWO_BYTES) @@ -190,693 +385,8 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor if (id != XOP_COUNT && !care) (*pos)++; - switch (id) - { - case XOP_ADD_RM8_R8: - result = x86_read_instr_add_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_RM1632_R1632: - result = x86_read_instr_add_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_R8_RM8: - result = x86_read_instr_add_r8_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_R1632_RM1632: - result = x86_read_instr_add_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_AL_IMM8: - result = x86_read_instr_add_al_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_E_AX_IMM1632: - result = x86_read_instr_add_e_ax_imm1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_OR_RM8_R8: - result = x86_read_instr_or_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_RM1632_R1632: - result = x86_read_instr_or_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_AND_AL_IMM8: - result = x86_read_instr_and_al_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_AND_E_AX_IMM1632: - result = x86_read_instr_and_e_ax_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - - case XOP_OR_R8_RM8: - result = x86_read_instr_or_r8_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_R1632_RM1632: - result = x86_read_instr_or_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_AL_IMM8: - result = x86_read_instr_or_al_imm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_JE_REL1632: - result = x86_read_instr_je_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNE_REL1632: - result = x86_read_instr_jne_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JBE_REL1632: - result = x86_read_instr_jbe_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JA_REL1632: - result = x86_read_instr_ja_rel1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SETE_RM8: - result = x86_read_instr_sete_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SETNE_RM8: - result = x86_read_instr_setne_rm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SETL_RM8: - result = x86_read_instr_setl_rm8(data, pos, len, addr, prefix, proc); - break; - - - - - case XOP_JGE_REL1632: - result = x86_read_instr_jge_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JLE_REL1632: - result = x86_read_instr_jle_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JG_REL1632: - result = x86_read_instr_jg_rel1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_MOVZX_R1632_RM8: - result = x86_read_instr_movzx_r1632_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOVSX_R1632_RM8: - result = x86_read_instr_movsx_r1632_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOVSX_R1632_RM1632: - result = x86_read_instr_movsx_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - - - - case XOP_ADC_RM8_R8: - result = x86_read_instr_adc_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_AND_RM8_R8: - result = x86_read_instr_and_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_AND_RM1632_R1632: - result = x86_read_instr_and_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SUB_RM1632_R1632: - result = x86_read_instr_sub_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SUB_R8_RM8: - result = x86_read_instr_sub_r8_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SUB_AL_IMM8: - result = x86_read_instr_sub_al_imm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SUB_E_AX_IMM1632: - result = x86_read_instr_sub_e_ax_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_XOR_RM8_R8: - result = x86_read_instr_xor_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_RM1632_R1632: - result = x86_read_instr_xor_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_R8_RM8: - result = x86_read_instr_xor_r8_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_R1632_RM1632: - result = x86_read_instr_xor_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_AL_IMM8: - result = x86_read_instr_xor_al_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_E_AX_IMM1632: - result = x86_read_instr_xor_e_ax_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_CMP_RM1632_R1632: - result = x86_read_instr_cmp_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_CMP_R1632_RM1632: - result = x86_read_instr_cmp_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_INC_E_AX: - case XOP_INC_E_CX: - case XOP_INC_E_DX: - case XOP_INC_E_BX: - case XOP_INC_E_SP: - case XOP_INC_E_BP: - case XOP_INC_E_SI: - case XOP_INC_E_DI: - result = x86_read_instr_inc_r1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_DEC_E_AX: - case XOP_DEC_E_CX: - case XOP_DEC_E_DX: - case XOP_DEC_E_BX: - case XOP_DEC_E_SP: - case XOP_DEC_E_BP: - case XOP_DEC_E_SI: - case XOP_DEC_E_DI: - result = x86_read_instr_dec_r1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_PUSH_E_AX: - case XOP_PUSH_E_CX: - case XOP_PUSH_E_DX: - case XOP_PUSH_E_BX: - case XOP_PUSH_E_SP: - case XOP_PUSH_E_BP: - case XOP_PUSH_E_SI: - case XOP_PUSH_E_DI: - result = x86_read_instr_push_r1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_POP_E_AX: - case XOP_POP_E_CX: - case XOP_POP_E_DX: - case XOP_POP_E_BX: - case XOP_POP_E_SP: - case XOP_POP_E_BP: - case XOP_POP_E_SI: - case XOP_POP_E_DI: - result = x86_read_instr_pop_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_PUSH_IMM1632: - result = x86_read_instr_push_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_IMUL_R1632_RM1632_IMM1632: - result = x86_read_instr_imul_r1632_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_IMUL_RM1632_IMM8: - result = x86_read_instr_imul_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_JO_REL8: - result = x86_read_instr_jo_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNO_REL8: - result = x86_read_instr_jno_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JB_REL8: - result = x86_read_instr_jb_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNB_REL8: - result = x86_read_instr_jnb_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JE_REL8: - result = x86_read_instr_je_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNE_REL8: - result = x86_read_instr_jne_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNA_REL8: - result = x86_read_instr_jna_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JA_REL8: - result = x86_read_instr_ja_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JS_REL8: - result = x86_read_instr_js_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNS_REL8: - result = x86_read_instr_jns_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JP_REL8: - result = x86_read_instr_jp_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNP_REL8: - result = x86_read_instr_jnp_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JL_REL8: - result = x86_read_instr_jl_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNL_REL8: - result = x86_read_instr_jnl_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JNG_REL8: - result = x86_read_instr_jng_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_JG_REL8: - result = x86_read_instr_jg_rel8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_RM8_IMM8: - result = x86_read_instr_add_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_RM8_IMM8: - result = x86_read_instr_or_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADC_RM8_IMM8: - result = x86_read_instr_adc_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SBB_RM8_IMM8: - result = x86_read_instr_sbb_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_AND_RM8_IMM8: - result = x86_read_instr_and_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SUB_RM8_IMM8: - result = x86_read_instr_sub_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_RM8_IMM8: - result = x86_read_instr_xor_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_CMP_RM8_IMM8: - result = x86_read_instr_cmp_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADD_RM1632_IMM1632: - result = x86_read_instr_add_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_RM1632_IMM1632: - result = x86_read_instr_or_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADC_RM1632_IMM1632: - result = x86_read_instr_adc_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_SBB_RM1632_IMM1632: - result = x86_read_instr_sbb_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_AND_RM1632_IMM1632: - result = x86_read_instr_and_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_SUB_RM1632_IMM1632: - result = x86_read_instr_sub_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_RM1632_IMM1632: - result = x86_read_instr_xor_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_CMP_RM1632_IMM1632: - result = x86_read_instr_cmp_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - - - case XOP_ADD_RM1632_IMM8: - result = x86_read_instr_add_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_OR_RM1632_IMM8: - result = x86_read_instr_or_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ADC_RM1632_IMM8: - result = x86_read_instr_adc_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SBB_RM1632_IMM8: - result = x86_read_instr_sbb_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_AND_RM1632_IMM8: - result = x86_read_instr_and_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SUB_RM1632_IMM8: - result = x86_read_instr_sub_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_XOR_RM1632_IMM8: - result = x86_read_instr_xor_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_CMP_RM1632_IMM8: - result = x86_read_instr_cmp_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_TEST_RM8_R8: - result = x86_read_instr_test_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_TEST_RM1632_R1632: - result = x86_read_instr_test_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_MOV_RM8_R8: - result = x86_read_instr_mov_rm8_r8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_RM1632_R1632: - result = x86_read_instr_mov_rm1632_r1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_MOV_R1632_RM1632: - result = x86_read_instr_mov_r1632_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_LEA_R1632_M: - result = x86_read_instr_lea_r1632_m(data, pos, len, addr, prefix, proc); - break; - - - case XOP_NOP: - result = x86_read_instr_nop(data, pos, len, addr, prefix, proc); - break; - - case XOP_XCHG_R1632_E_AX: - case XOP_XCHG_R1632_E_CX: - case XOP_XCHG_R1632_E_DX: - case XOP_XCHG_R1632_E_BX: - case XOP_XCHG_R1632_E_SP: - case XOP_XCHG_R1632_E_BP: - case XOP_XCHG_R1632_E_SI: - case XOP_XCHG_R1632_E_DI: - result = x86_read_instr_xchg_r1632_e_ax(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_MOV_AL_MOFFS8: - result = x86_read_instr_mov_al_moffs8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_E_AX_MOFFS1632: - result = x86_read_instr_mov_e_ax_moffs1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_MOFFS8_AL: - result = x86_read_instr_mov_moffs8_al(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_MOFFS1632_E_AX: - result = x86_read_instr_mov_moffs1632_e_ax(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_MOVS_M1632_M1632: - result = x86_read_instr_movs_m1632_m1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_TEST_AL_IMM8: - result = x86_read_instr_test_al_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_TEST_E_AX_IMM1632: - result = x86_read_instr_test_e_ax_imm1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_STOS_M1632_E_AX: - result = x86_read_instr_stos_m1632_e_ax(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SCAS_AL_M8: - result = x86_read_instr_scas_al_m8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_MOV_AL_IMM8: - case XOP_MOV_CL_IMM8: - case XOP_MOV_DL_IMM8: - case XOP_MOV_BL_IMM8: - case XOP_MOV_AH_IMM8: - case XOP_MOV_CH_IMM8: - case XOP_MOV_DH_IMM8: - case XOP_MOV_BH_IMM8: - result = x86_read_instr_mov_r8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_E_AX_IMM1632: - case XOP_MOV_E_CX_IMM1632: - case XOP_MOV_E_DX_IMM1632: - case XOP_MOV_E_BX_IMM1632: - case XOP_MOV_E_SP_IMM1632: - case XOP_MOV_E_BP_IMM1632: - case XOP_MOV_E_SI_IMM1632: - case XOP_MOV_E_DI_IMM1632: - result = x86_read_instr_mov_r1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - - case XOP_ROL_RM1632_IMM8: - result = x86_read_instr_rol_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_ROR_RM1632_IMM8: - result = x86_read_instr_ror_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_RCL_RM1632_IMM8: - result = x86_read_instr_rcl_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_RCR_RM1632_IMM8: - result = x86_read_instr_rcr_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SHL_RM1632_IMM8: - result = x86_read_instr_shl_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SHR_RM1632_IMM8: - result = x86_read_instr_shr_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SAL_RM1632_IMM8: - result = x86_read_instr_sal_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_SAR_RM1632_IMM8: - result = x86_read_instr_sar_rm1632_imm8(data, pos, len, addr, prefix, proc); - break; - - - - - - - case XOP_RET: - result = x86_read_instr_ret(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_MOV_RM8_IMM8: - result = x86_read_instr_mov_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_MOV_RM1632_IMM1632: - result = x86_read_instr_mov_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - - - - case XOP_LEAVE: - result = x86_read_instr_leave(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_INT_3: - result = x86_read_instr_int_3(data, pos, len, addr, prefix, proc); - break; - - case XOP_INT: - result = x86_read_instr_int_imm8(data, pos, len, addr, prefix, proc); - break; - - - case XOP_SHL_RM1632_CL: - result = x86_read_instr_shl_rm1632_cl(data, pos, len, addr, prefix, proc); - break; - - - case XOP_CALL_REL1632: - result = x86_read_instr_call_rel1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JMP_REL1632: - result = x86_read_instr_jmp_rel1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_JMP_REL8: - result = x86_read_instr_jmp_rel8(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_HLT: - result = x86_read_instr_hlt(data, pos, len, addr, prefix, proc); - break; - - - case XOP_TEST_RM8_IMM8: - case XOP_TEST_RM8_IMM8_BIS: - result = x86_read_instr_test_rm8_imm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_NOT_RM8: - result = x86_read_instr_not_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_TEST_RM1632_IMM1632: - case XOP_TEST_RM1632_IMM1632_BIS: - result = x86_read_instr_test_rm1632_imm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_NOT_RM1632: - result = x86_read_instr_not_rm1632(data, pos, len, addr, prefix, proc); - break; - - - case XOP_IMUL_RM1632: - result = x86_read_instr_imul_rm1632(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_CLD: - result = x86_read_instr_cld(data, pos, len, addr, prefix, proc); - break; - - - - case XOP_INC_RM8: - result = x86_read_instr_inc_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_DEC_RM8: - result = x86_read_instr_dec_rm8(data, pos, len, addr, prefix, proc); - break; - - case XOP_INC_RM1632: - result = x86_read_instr_inc_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_DEC_RM1632: - result = x86_read_instr_dec_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_CALL_RM1632: - result = x86_read_instr_call_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_JMP_RM1632: - result = x86_read_instr_jmp_rm1632(data, pos, len, addr, prefix, proc); - break; - - case XOP_PUSH_RM1632: - result = x86_read_instr_push_rm1632(data, pos, len, addr, prefix, proc); - break; - - default: - result = NULL; - break; - - } + if (id == XOP_COUNT) result = NULL; + else result = decodings[id](data, pos, len, addr, prefix, proc); if (result != NULL) g_x86_instruction_set_prefixes(G_X86_INSTRUCTION(result), prefix); diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index a79b3ff..ae4b1a8 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -340,10 +340,7 @@ static void g_delayed_insertion_process(GDelayedInsertion *insertion, GtkExtStat gdk_threads_enter(); if (iter != lines) - { - gtk_text_buffer_get_end_iter(view->buffer, &pos); gtk_text_buffer_insert_with_tags(view->buffer, &pos, "\n", 1, NULL); - } gtk_text_buffer_get_end_iter(view->buffer, &pos); @@ -498,7 +495,6 @@ static void gtk_block_view_init(GtkBlockView *view) view->layout = gtk_text_layout_new(); - gtk_text_layout_set_buffer(view->layout, view->buffer); @@ -506,8 +502,6 @@ static void gtk_block_view_init(GtkBlockView *view) { done = true; - gtk_text_layout_set_cursor_visible(GTK_BLOCK_VIEW(view)->layout, FALSE); - gtk_text_layout_set_overwrite_mode(GTK_BLOCK_VIEW(view)->layout, FALSE); @@ -1085,6 +1079,8 @@ static void gtk_block_view_complete_building_content(GDelayedInsertion *insertio gdk_threads_enter(); + gtk_text_layout_set_buffer(view->layout, view->buffer); + gtk_text_buffer_get_end_iter(view->buffer, &pos); gtk_text_layout_move_iter_visually(view->layout, &pos, -1); gtk_text_layout_get_iter_location(view->layout, &pos, &rect); |