From 2e70f6efa8b960d3b5401373ad6fa98747bb9578 Mon Sep 17 00:00:00 2001 From: pbrook Date: Sun, 29 Jun 2008 01:03:05 +0000 Subject: Add instruction counter. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4799 c046a42c-6fe2-441c-8c8c-71466251a162 --- translate-all.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'translate-all.c') diff --git a/translate-all.c b/translate-all.c index 8b8b6a2813..263649578b 100644 --- a/translate-all.c +++ b/translate-all.c @@ -38,6 +38,7 @@ uint16_t gen_opc_buf[OPC_BUF_SIZE]; TCGArg gen_opparam_buf[OPPARAM_BUF_SIZE]; target_ulong gen_opc_pc[OPC_BUF_SIZE]; +uint16_t gen_opc_icount[OPC_BUF_SIZE]; uint8_t gen_opc_instr_start[OPC_BUF_SIZE]; #if defined(TARGET_I386) uint8_t gen_opc_cc_op[OPC_BUF_SIZE]; @@ -158,6 +159,13 @@ int cpu_restore_state(TranslationBlock *tb, if (gen_intermediate_code_pc(env, tb) < 0) return -1; + if (use_icount) { + /* Reset the cycle counter to the start of the block. */ + env->icount_decr.u16.low += tb->icount; + /* Clear the IO flag. */ + env->can_do_io = 0; + } + /* find opc index corresponding to search_pc */ tc_ptr = (unsigned long)tb->tc_ptr; if (searched_pc < tc_ptr) @@ -177,6 +185,7 @@ int cpu_restore_state(TranslationBlock *tb, /* now find start of instruction before */ while (gen_opc_instr_start[j] == 0) j--; + env->icount_decr.u16.low -= gen_opc_icount[j]; gen_pc_load(env, tb, searched_pc, j, puc); -- cgit v1.2.3-55-g7522