aboutsummaryrefslogtreecommitdiff
path: root/target-i386/translate.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:27:15 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:27:15 -0300
commit4d9367b76f71c6d938cf8201392abe4bfb1136cb (patch)
tree93a31afc3151c19e4906aed6748e842d8431fb02 /target-i386/translate.c
parent6b414d9fb86527118f3ddb81a1d1a684b3548a9d (diff)
parent8e65440d5f64435c003d32088757f702b86af9b4 (diff)
Merge branch 'upstream-merge'HEADnextmaster
* upstream-merge: (575 commits) ssi: Add slave autoconnect helper MAINTAINERS: Added maintainerships for SSI xilinx_zynq: Added SPI controllers + flashes xilinx_spips: Xilinx Zynq SPI cntrlr device model petalogix-ml605: added SPI controller with n25q128 xilinx_spi: Initial impl. of Xilinx SPI controller m25p80: Initial implementation of SPI flash device hw: Added generic FIFO API. stellaris: Removed SSI mux qdev: allow multiple qdev_init_gpio_in() calls ssi: Added create_slave_no_init() ssi: Implemented CS behaviour ssi: Support for multiple attached devices qemu-barrier: Fix compilation on i386 hosts target-sparc: Optimize conditionals using SUBCC target-sparc: Fall through from not-taken trap target-sparc: Cleanup "global" temporary allocation target-sparc: Use movcond for FMOV*R target-sparc: Use movcond in mulscc target-sparc: Move taddcctv and tsubcctv out of line ... Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/translate.c')
-rw-r--r--target-i386/translate.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/target-i386/translate.c b/target-i386/translate.c
index eb0cabcf1..0a7e4e348 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -107,6 +107,7 @@ typedef struct DisasContext {
int cpuid_ext_features;
int cpuid_ext2_features;
int cpuid_ext3_features;
+ int cpuid_7_0_ebx_features;
} DisasContext;
static void gen_eob(DisasContext *s);
@@ -4202,8 +4203,9 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
target_ulong next_eip, tval;
int rex_w, rex_r;
- if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)))
+ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
tcg_gen_debug_insn_start(pc_start);
+ }
s->pc = pc_start;
prefixes = 0;
aflag = s->code32;
@@ -6555,7 +6557,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
}
gen_pop_update(s);
s->cc_op = CC_OP_EFLAGS;
- /* abort translation because TF flag may change */
+ /* abort translation because TF/AC flag may change */
gen_jmp_im(s->pc - s->cs_base);
gen_eob(s);
}
@@ -7205,6 +7207,24 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
gen_helper_mwait(cpu_env, tcg_const_i32(s->pc - pc_start));
gen_eob(s);
break;
+ case 2: /* clac */
+ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_SMAP) ||
+ s->cpl != 0) {
+ goto illegal_op;
+ }
+ gen_helper_clac(cpu_env);
+ gen_jmp_im(s->pc - s->cs_base);
+ gen_eob(s);
+ break;
+ case 3: /* stac */
+ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_SMAP) ||
+ s->cpl != 0) {
+ goto illegal_op;
+ }
+ gen_helper_stac(cpu_env);
+ gen_jmp_im(s->pc - s->cs_base);
+ gen_eob(s);
+ break;
default:
goto illegal_op;
}
@@ -7900,15 +7920,13 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
/* select memory access functions */
dc->mem_index = 0;
if (flags & HF_SOFTMMU_MASK) {
- if (dc->cpl == 3)
- dc->mem_index = 2 * 4;
- else
- dc->mem_index = 1 * 4;
+ dc->mem_index = (cpu_mmu_index(env) + 1) << 2;
}
dc->cpuid_features = env->cpuid_features;
dc->cpuid_ext_features = env->cpuid_ext_features;
dc->cpuid_ext2_features = env->cpuid_ext2_features;
dc->cpuid_ext3_features = env->cpuid_ext3_features;
+ dc->cpuid_7_0_ebx_features = env->cpuid_7_0_ebx_features;
#ifdef TARGET_X86_64
dc->lma = (flags >> HF_LMA_SHIFT) & 1;
dc->code64 = (flags >> HF_CS64_SHIFT) & 1;