diff options
-rw-r--r-- | target-i386/exec.h | 1 | ||||
-rw-r--r-- | target-i386/helper.h | 8 | ||||
-rw-r--r-- | target-i386/op_helper.c | 51 | ||||
-rw-r--r-- | target-i386/translate.c | 12 |
4 files changed, 47 insertions, 25 deletions
diff --git a/target-i386/exec.h b/target-i386/exec.h index 035881ec6c..8298b42937 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -61,7 +61,6 @@ extern int loglevel; void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0); void cpu_x86_update_cr3(CPUX86State *env, target_ulong new_cr3); void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4); -void cpu_x86_flush_tlb(CPUX86State *env, target_ulong addr); int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, int is_write, int mmu_idx, int is_softmmu); void tlb_fill(target_ulong addr, int is_write, int mmu_idx, diff --git a/target-i386/helper.h b/target-i386/helper.h index 3fd99d2673..c6b6268957 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -102,14 +102,14 @@ DEF_HELPER(void, helper_svm_check_intercept_param, (uint32_t type, uint64_t para DEF_HELPER(void, helper_vmexit, (uint32_t exit_code, uint64_t exit_info_1)) DEF_HELPER(void, helper_svm_check_io, (uint32_t port, uint32_t param, uint32_t next_eip_addend)) -DEF_HELPER(void, helper_vmrun, (void)) +DEF_HELPER(void, helper_vmrun, (int aflag)) DEF_HELPER(void, helper_vmmcall, (void)) -DEF_HELPER(void, helper_vmload, (void)) -DEF_HELPER(void, helper_vmsave, (void)) +DEF_HELPER(void, helper_vmload, (int aflag)) +DEF_HELPER(void, helper_vmsave, (int aflag)) DEF_HELPER(void, helper_stgi, (void)) DEF_HELPER(void, helper_clgi, (void)) DEF_HELPER(void, helper_skinit, (void)) -DEF_HELPER(void, helper_invlpga, (void)) +DEF_HELPER(void, helper_invlpga, (int aflag)) /* x86 FPU */ diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 56bef6e2e5..cd8521fdc8 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -2994,7 +2994,7 @@ void helper_movl_drN_T0(int reg, target_ulong t0) void helper_invlpg(target_ulong addr) { helper_svm_check_intercept_param(SVM_EXIT_INVLPG, 0); - cpu_x86_flush_tlb(env, addr); + tlb_flush_page(env, addr); } void helper_rdtsc(void) @@ -4721,16 +4721,16 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) #if defined(CONFIG_USER_ONLY) -void helper_vmrun(void) +void helper_vmrun(int aflag) { } void helper_vmmcall(void) { } -void helper_vmload(void) +void helper_vmload(int aflag) { } -void helper_vmsave(void) +void helper_vmsave(int aflag) { } void helper_stgi(void) @@ -4742,7 +4742,7 @@ void helper_clgi(void) void helper_skinit(void) { } -void helper_invlpga(void) +void helper_invlpga(int aflag) { } void helper_vmexit(uint32_t exit_code, uint64_t exit_info_1) @@ -4791,7 +4791,7 @@ static inline void svm_load_seg_cache(target_phys_addr_t addr, sc->base, sc->limit, sc->flags); } -void helper_vmrun(void) +void helper_vmrun(int aflag) { target_ulong addr; uint32_t event_inj; @@ -4799,7 +4799,11 @@ void helper_vmrun(void) helper_svm_check_intercept_param(SVM_EXIT_VMRUN, 0); - addr = EAX; + if (aflag == 2) + addr = EAX; + else + addr = (uint32_t)EAX; + if (loglevel & CPU_LOG_TB_IN_ASM) fprintf(logfile,"vmrun! " TARGET_FMT_lx "\n", addr); @@ -4970,13 +4974,16 @@ void helper_vmmcall(void) raise_exception(EXCP06_ILLOP); } -void helper_vmload(void) +void helper_vmload(int aflag) { target_ulong addr; helper_svm_check_intercept_param(SVM_EXIT_VMLOAD, 0); - /* XXX: invalid in 32 bit */ - addr = EAX; + if (aflag == 2) + addr = EAX; + else + addr = (uint32_t)EAX; + if (loglevel & CPU_LOG_TB_IN_ASM) fprintf(logfile,"vmload! " TARGET_FMT_lx "\nFS: %016" PRIx64 " | " TARGET_FMT_lx "\n", addr, ldq_phys(addr + offsetof(struct vmcb, save.fs.base)), @@ -5003,11 +5010,16 @@ void helper_vmload(void) env->sysenter_eip = ldq_phys(addr + offsetof(struct vmcb, save.sysenter_eip)); } -void helper_vmsave(void) +void helper_vmsave(int aflag) { target_ulong addr; helper_svm_check_intercept_param(SVM_EXIT_VMSAVE, 0); - addr = EAX; + + if (aflag == 2) + addr = EAX; + else + addr = (uint32_t)EAX; + if (loglevel & CPU_LOG_TB_IN_ASM) fprintf(logfile,"vmsave! " TARGET_FMT_lx "\nFS: %016" PRIx64 " | " TARGET_FMT_lx "\n", addr, ldq_phys(addr + offsetof(struct vmcb, save.fs.base)), @@ -5050,15 +5062,22 @@ void helper_skinit(void) { helper_svm_check_intercept_param(SVM_EXIT_SKINIT, 0); /* XXX: not implemented */ - if (loglevel & CPU_LOG_TB_IN_ASM) - fprintf(logfile,"skinit!\n"); raise_exception(EXCP06_ILLOP); } -void helper_invlpga(void) +void helper_invlpga(int aflag) { + target_ulong addr; helper_svm_check_intercept_param(SVM_EXIT_INVLPGA, 0); - tlb_flush(env, 0); + + if (aflag == 2) + addr = EAX; + else + addr = (uint32_t)EAX; + + /* XXX: could use the ASID to see if it is needed to do the + flush */ + tlb_flush_page(env, addr); } void helper_svm_check_intercept_param(uint32_t type, uint64_t param) diff --git a/target-i386/translate.c b/target-i386/translate.c index ba6284f760..40a85f8111 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -6569,7 +6569,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { - tcg_gen_helper_0_0(helper_vmrun); + tcg_gen_helper_0_1(helper_vmrun, + tcg_const_i32(s->aflag)); s->cc_op = CC_OP_EFLAGS; gen_eob(s); } @@ -6586,7 +6587,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { - tcg_gen_helper_0_0(helper_vmload); + tcg_gen_helper_0_1(helper_vmload, + tcg_const_i32(s->aflag)); } break; case 3: /* VMSAVE */ @@ -6596,7 +6598,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { - tcg_gen_helper_0_0(helper_vmsave); + tcg_gen_helper_0_1(helper_vmsave, + tcg_const_i32(s->aflag)); } break; case 4: /* STGI */ @@ -6635,7 +6638,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { - tcg_gen_helper_0_0(helper_invlpga); + tcg_gen_helper_0_1(helper_invlpga, + tcg_const_i32(s->aflag)); } break; default: |