Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- Makefile.target | 3 ++- cpu-all.h | 6 ++++++ exec.c | 2 +- qemu-common.h | 2 +- translate-all.c | 12 +++++++++--- 5 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Makefile.target b/Makefile.target index 0787758..70f52cc 100644 --- a/Makefile.target +++ b/Makefile.target @@ -67,10 +67,11 @@ all: $(PROGS) stap ######################################################### # cpu emulator library -libobj-y = exec.o translate-all.o cpu-exec.o translate.o +libobj-y = exec.o translate-all.o cpu-exec.o libobj-y += tcg/tcg.o tcg/optimize.o libobj-y += fpu/softfloat.o libobj-y += op_helper.o helper.o +libobj-$(CONFIG_TCG) += translate.o ifeq ($(TARGET_BASE_ARCH), i386) libobj-y += cpuid.o endif diff --git a/cpu-all.h b/cpu-all.h index f5c82cd..84a852c 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -22,6 +22,12 @@ #include "qemu-common.h" #include "cpu-common.h" +#if defined(CONFIG_TCG) +#define tcg_enabled() (tcg_in_use()) +#else +#define tcg_enabled() (0) +#endif + /* some important defines: * * WORDS_ALIGNED : if defined, the host cpu can only make word aligned diff --git a/exec.c b/exec.c index c1e045d..578da0e 100644 --- a/exec.c +++ b/exec.c @@ -585,7 +585,7 @@ void tcg_exec_init(unsigned long tb_size) #endif } -bool tcg_enabled(void) +bool tcg_in_use(void) { return code_gen_buffer != NULL; } diff --git a/qemu-common.h b/qemu-common.h index 404c421..02a3071 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -268,7 +268,7 @@ typedef struct QEMUSGList QEMUSGList; typedef uint64_t pcibus_t; void tcg_exec_init(unsigned long tb_size); -bool tcg_enabled(void); +bool tcg_in_use(void); void cpu_exec_init_all(void); diff --git a/translate-all.c b/translate-all.c index 041c108..ecb035a 100644 --- a/translate-all.c +++ b/translate-all.c @@ -67,7 +67,9 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) #endif tcg_func_start(s); - gen_intermediate_code(env, tb); + if (tcg_enabled()) { + gen_intermediate_code(env, tb); + } /* generate machine code */ gen_code_buf = tb->tc_ptr; @@ -123,7 +125,9 @@ int cpu_restore_state(TranslationBlock *tb, #endif tcg_func_start(s); - gen_intermediate_code_pc(env, tb); + if (tcg_enabled()) { + gen_intermediate_code_pc(env, tb); + } if (use_icount) { /* Reset the cycle counter to the start of the block. */ @@ -153,7 +157,9 @@ int cpu_restore_state(TranslationBlock *tb, j--; env->icount_decr.u16.low -= gen_opc_icount[j]; - restore_state_to_opc(env, tb, j); + if (tcg_enabled()) { + restore_state_to_opc(env, tb, j); + } #ifdef CONFIG_PROFILER s->restore_time += profile_getclock() - ti; -- 1.7.4.1