📄 tb.c
字号:
} str_head_len += op_movl_Tx_reg_array_maxlen[0]; //ldrh other_tmp1 = ldr_head_len; other_tmp1 += op_ldrh_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldrh insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //ldrsb other_tmp1 = ldr_head_len; other_tmp1 += op_ldrb_T0_T1.len; other_tmp1 += op_signextend_byte_T0.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldrsb insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //ldrsh other_tmp1 = ldr_head_len; other_tmp1 += op_ldrh_T0_T1.len; other_tmp1 += op_signextend_halfword_T0.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldrsh insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //ldrb other_tmp1 = ldr_head_len; other_tmp1 += op_ldrb_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldrb insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //ldr other_tmp1 = ldr_head_len; other_tmp1 += op_ldr_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldr insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //strh other_tmp1 = str_head_len; other_tmp1 += op_strh_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("strh insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//teawater add for xscale(arm v5) 2005.09.26------------------------------------ //ldrd other_tmp1 = ldr_head_len; other_tmp1 += op_ldrd_T0_T2_T1.len; if (state->abort_model > 1) { other_tmp1 += op_test_dataabort_ret.len; } other_tmp1 += op_movl_reg_Tx_array_maxlen[0]; other_tmp1 += op_movl_reg_Tx_array_maxlen[2]; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldrd insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //strd other_tmp1 = ldr_head_len; other_tmp1 += op_movl_reg_Tx_array_maxlen[0]; other_tmp1 += op_movl_reg_Tx_array_maxlen[2]; other_tmp1 += op_strd_T0_T2_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("strd insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//AJ2D-------------------------------------------------------------------------- //strb other_tmp1 = str_head_len; other_tmp1 += op_strb_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("strb insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //str other_tmp1 = str_head_len; other_tmp1 += op_str_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("str insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //mul other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_mul_T0_T1.len; other_tmp1 += op_logic_T0_sn.len; other_tmp1 += op_set_nf.len; other_tmp1 += op_logic_T0_sz.len; other_tmp1 += op_set_zf.len; other_tmp1 += op_movl_reg_Tx_array_maxlen[0]; TEA_OUT (printf ("mul insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //mla other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_addl_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mla insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //mull other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; if (op_smull_T0_T1.len > op_umull_T0_T1.len) { other_tmp1 += op_smull_T0_T1.len; } else { other_tmp1 += op_umull_T0_T1.len; } other_tmp1 += op_movl_Tx_reg_array_maxlen[2]; other_tmp1 += op_movl_eax_T2.len; other_tmp1 += op_movl_Tx_reg_array_maxlen[2]; other_tmp1 += op_addq_T0_T1_eax_T2.len; other_tmp1 += op_logic_T0_sn.len; other_tmp1 += op_set_nf.len; other_tmp1 += op_logic_T0_sz.len; other_tmp1 += op_set_zf.len; other_tmp1 += op_movl_reg_Tx_array_maxlen[0]; other_tmp1 += op_movl_reg_Tx_array_maxlen[1]; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mull insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //swp other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; if (op_ldrb_T2_T1.len + op_strb_T0_T1.len > op_ldr_T2_T1.len + op_str_T0_T1.len) { other_tmp1 += op_ldrb_T2_T1.len + op_strb_T0_T1.len; } else { other_tmp1 += op_ldr_T2_T1.len + op_str_T0_T1.len; } other_tmp1 += op_movl_reg_Tx_array_maxlen[2]; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("swp insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //insn_undef other_tmp1 = 0; other_tmp1 += op_movl_Tx_im[2].len + sizeof (ARMword) + op_movl_trap_T2.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("insn_undef insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //ldm stm other_tmp1 = 0; other_tmp1 += op_test_cpsr_ret_UNP.len; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_movl_Tx_im[2].len + sizeof (ARMword) + op_movl_trap_T2.len; other_tmp1 += op_addl_T1_im.len + sizeof (ARMword); other_tmp1 += op_movl_Tx_im[0].len + sizeof (ARMword); other_tmp2 = op_ldm_user_T1_T0.len; if (op_ldm_T1_T0.len > other_tmp2) { other_tmp2 = op_ldm_T1_T0.len; } if (op_stm_user_T1_T0.len > other_tmp2) { other_tmp2 = op_stm_user_T1_T0.len; } if (op_stm_T1_T0.len > other_tmp2) { other_tmp2 = op_stm_T1_T0.len; } other_tmp1 += other_tmp2; //if (!state->is_XScale) { if (state->abort_model > 1) { ldr_head_len += op_test_dataabort.len; } other_tmp1 += op_addl_T1_im.len + sizeof (ARMword); other_tmp1 += op_movl_reg_Tx_array_maxlen[1]; //if (!state->is_XScale) { if (state->abort_model > 1) { ldr_head_len += op_test_dataabort_ret.len; } if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldm stm insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //b other_tmp1 = 0; other_tmp1 += op_b_offset.len + sizeof (ARMword);//teawater change for local tb branch directly jump 2005.10.21------------------ other_tmp1 += op_local_b_offset.len;//AJ2D-------------------------------------------------------------------------- if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("b insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //bl other_tmp1 = 0; other_tmp1 += op_bl_offset.len + sizeof (ARMword);//teawater change for local tb branch directly jump 2005.10.21------------------ other_tmp1 += op_local_b_offset.len;//AJ2D-------------------------------------------------------------------------- if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("bl insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//teawater add for xscale(arm v5) 2005.09.14------------------------------------ //mar other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_mar_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mar insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //mra other_tmp1 += op_mra_T0_T1.len; other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mra insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//AJ2D-------------------------------------------------------------------------- //ldc stc other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_addl_T1_im.len + sizeof (ARMword); other_tmp1 += op_movl_Tx_im[0].len + sizeof (ARMword); if (op_ldc_T0_T1.len > op_stc_T0_T1.len) { other_tmp1 += op_ldc_T0_T1.len; } else { other_tmp1 += op_stc_T0_T1.len; } other_tmp1 += op_movl_reg_Tx_array_maxlen[1]; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("ldc stc insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//teawater add for xscale(arm v5) 2005.09.14------------------------------------ //mia other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_smull_T0_T1.len; other_tmp1 += op_mia_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mia insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //miaph other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_miaph_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("miaph insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //miabb other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_lo_T0.len; other_tmp1 += op_lo_T1.len; other_tmp1 += op_miaxy_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("miabb insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //miabt other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_lo_T0.len; other_tmp1 += op_hi_T1.len; other_tmp1 += op_miaxy_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("miabt insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //miatb other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_hi_T0.len; other_tmp1 += op_lo_T1.len; other_tmp1 += op_miaxy_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("miatb insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //miatt other_tmp1 = 0; other_tmp1 += op_movl_Tx_reg_array_maxlen[0]; other_tmp1 += op_movl_Tx_reg_array_maxlen[1]; other_tmp1 += op_hi_T0.len; other_tmp1 += op_hi_T1.len; other_tmp1 += op_miaxy_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("miatt insn's max len is %d\n", other_tmp1 + tb_insn_len_max));//AJ2D-------------------------------------------------------------------------- //mrc other_tmp1 = 0; other_tmp1 += op_movl_Tx_im[0].len + sizeof (ARMword); other_tmp1 += op_movl_Tx_im[1].len + sizeof (ARMword); other_tmp1 += op_mrc_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mrc insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //mcr other_tmp1 = 0; other_tmp1 += op_movl_Tx_im[0].len + sizeof (ARMword); other_tmp1 += op_movl_Tx_im[1].len + sizeof (ARMword); other_tmp1 += op_mcr_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("mcr insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //cdp other_tmp1 = 0; other_tmp1 += op_movl_Tx_im[0].len + sizeof (ARMword); other_tmp1 += op_movl_Tx_im[1].len + sizeof (ARMword); other_tmp1 += op_cdp_T0_T1.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("cdp insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); //swi other_tmp1 = 0; other_tmp1 += op_movl_Tx_im[2].len + sizeof (ARMword) + op_movl_trap_T2.len; if (other_tmp1 > other_len) { other_len = other_tmp1; } TEA_OUT (printf ("swi insn's max len is %d\n", other_tmp1 + tb_insn_len_max)); } if (dp_len > other_len) { tb_insn_len_max += dp_len; } else { tb_insn_len_max += other_len; } TEA_OUT (printf ("tb_insn_len_max is %d\n", tb_insn_len_max)); return (0);}//teawater add for new tb manage function 2005.07.10----------------------------inttb_memory_init (ARMul_State * state){ int i; uint64_t tmp_u64; mem_bank_t *mbp; //tbt if (TB_TBT_SIZE) { //get align tbt size TB_TBT_SIZE = ALIGN (TB_TBT_SIZE, sizeof (tb_cache_t)); if (TB_TBT_SIZE < sizeof (tb_cache_t)) { fprintf (stderr, "SKYEYE: tb_memory_init: TB_TBT_SIZE %u is too little.\n", (unsigned int) TB_TBT_SIZE); return (-1); } //get tbt max size tmp_u64 = 0; for (i = 0; i < state->mem_bank->current_num; i++) { tmp_u64 += state->mem_bank->mem_banks[i].len; } tmp_u64 = tmp_u64 / TB_LEN * sizeof (tb_cache_t); if (TB_TBT_SIZE >= tmp_u64) { //if set size >= max size, use the simple function TB_TBT_SIZE = 0; } else { //get mem by TB_TBT_SIZE tbt_table = (tb_t *) malloc (TB_TBT_SIZE); if (!tbt_table) { fprintf (stderr, "SKYEYE: tb_memory_init: Error allocating mem.\n"); return (-1); } memset (tbt_table, 0, TB_TBT_SIZE); tbt_table_size = TB_TBT_SIZE / sizeof (tb_cache_t); } } //tbp if (TB_TBP_SIZE) { //get align tbp size TB_TBP_SIZE = ALIGN (TB_TBP_SIZE, TB_TBP_MAX); if (TB_TBP_SIZE < TB_TBP_MAX) { fprintf (stderr, "SKYEYE: tb_memory_init: TB_TBP_SIZE %u is too little.\n", (unsigned int) TB_TBP_SIZE); return (-1); } } if (TB_TBT_SIZE) { //get tbp max size tmp_u64 = tbt_table_size * TB_LEN / sizeof (ARMword) * TB_INSN_LEN_MAX + tbt_table_size * op_return.len; if (TB_TBP_SIZE == 0 || TB_TBP_SIZE > tmp_u64) { TB_TBP_SIZE = tmp_u64; } else { tbp_dynamic = 1; } } else { if (TB_TBP_SIZE) { //get tbp max size tmp_u64 = 0; for (i = 0; i < state->mem_bank->current_num; i++) { tmp_u64 += state->mem_bank->mem_banks[i].len; } tmp_u64 = tmp_u64 / sizeof (ARMword) * TB_INSN_LEN_MAX + tmp_u64 / TB_LEN * op_return.len; if (TB_TBP_SIZE >= tmp_u64) { //if set size >= max size, use the simple function TB_TBP_SIZE = 0; } else { tbp_dynamic = 1; } } } if (TB_TBP_SIZE) { //get mem by TB_TBP_SIZE tbp_begin = mmap (NULL, TB_TBP_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (tbp_begin == MAP_FAILED) { fprintf (stderr, "SKYEYE: tb_memory_init: Error allocating mem.\n"); return (-1); } tbp_now_size = TB_TBP_SIZE; tbp_now = tbp_begin; } if (TB_TBT_SIZE) { printf ("dbct translate block entry use memory 0x%08x bytes.\n", TB_TBT_SIZE); } if (TB_TBP_SIZE) { printf ("dbct translate block use memory 0x%08x bytes.\n", TB_TBP_SIZE); } return (0);}//AJ2D--------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -