target/i386: add the tcg_enabled() in target/i386/

Add the tcg_enabled() where the x86 target needs to disable
TCG-specific code.

Backports commit 79c664f62d75cfba89a5bbe998622c8d5fdf833b from qemu
This commit is contained in:
Yang Zhong 2018-03-03 21:55:40 -05:00 committed by Lioncash
parent 0c739344d3
commit a16bcbdac0
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 12 additions and 2 deletions

View file

@ -3489,8 +3489,10 @@ static void x86_cpu_common_class_init(struct uc_struct *uc, ObjectClass *oc, voi
cc->class_by_name = x86_cpu_class_by_name;
cc->parse_features = x86_cpu_parse_featurestr;
cc->has_work = x86_cpu_has_work;
#ifdef CONFIG_TCG
cc->do_interrupt = x86_cpu_do_interrupt;
cc->cpu_exec_interrupt = x86_cpu_exec_interrupt;
#endif
cc->dump_state = x86_cpu_dump_state;
cc->set_pc = x86_cpu_set_pc;
cc->synchronize_from_tb = x86_cpu_synchronize_from_tb;
@ -3503,7 +3505,7 @@ static void x86_cpu_common_class_init(struct uc_struct *uc, ObjectClass *oc, voi
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
cc->get_phys_page_debug = x86_cpu_get_phys_page_debug;
#endif
#ifndef CONFIG_USER_ONLY
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
cc->debug_excp_handler = breakpoint_handler;
#endif
cc->cpu_exec_enter = x86_cpu_exec_enter;

View file

@ -52,7 +52,9 @@
#include "exec/cpu-defs.h"
#ifdef CONFIG_TCG
#include "fpu/softfloat.h"
#endif
#define R_EAX 0
#define R_ECX 1
@ -1570,7 +1572,11 @@ uint32_t cpu_cc_compute_all(CPUX86State *env1, int op);
static inline uint32_t cpu_compute_eflags(CPUX86State *env)
{
return (env->eflags0 & ~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK)) | cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK);
uint32_t eflags = env->eflags;
if (tcg_enabled(env->uc)) {
eflags |= cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK);
}
return eflags;
}
/* NOTE: the translator must set DisasContext.cc_op to CC_OP_EFLAGS

View file

@ -1013,9 +1013,11 @@ void cpu_report_tpr_access(CPUX86State *env, TPRAccess access)
X86CPU *cpu = x86_env_get_cpu(env);
CPUState *cs = CPU(cpu);
if (tcg_enabled(env->uc)) {
cpu_restore_state(cs, cs->mem_io_pc);
apic_handle_tpr_access_report(cpu->apic_state, env->eip, access);
}
}
#endif /* !CONFIG_USER_ONLY */