Revision 6792a57b

b/cpu-exec.c
226 226
    }
227 227

  
228 228
#if defined(TARGET_I386)
229
    if (!kvm_enabled()) {
230
        /* put eflags in CPU temporary format */
231
        CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
232
        DF = 1 - (2 * ((env->eflags >> 10) & 1));
233
        CC_OP = CC_OP_EFLAGS;
234
        env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
235
    }
229
    /* put eflags in CPU temporary format */
230
    CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
231
    DF = 1 - (2 * ((env->eflags >> 10) & 1));
232
    CC_OP = CC_OP_EFLAGS;
233
    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
236 234
#elif defined(TARGET_SPARC)
237 235
#elif defined(TARGET_M68K)
238 236
    env->cc_op = CC_OP_FLAGS;
......
257 255
        if (setjmp(env->jmp_env) == 0) {
258 256
#if defined(__sparc__) && !defined(CONFIG_SOLARIS)
259 257
#undef env
260
                    env = cpu_single_env;
258
            env = cpu_single_env;
261 259
#define env cpu_single_env
262 260
#endif
263 261
            /* if an exception is pending, we execute it here */
......
316 314
                }
317 315
            }
318 316

  
319
            if (kvm_enabled()) {
320
                kvm_cpu_exec(env);
321
                longjmp(env->jmp_env, 1);
322
            }
323

  
324 317
            next_tb = 0; /* force lookup of first TB */
325 318
            for(;;) {
326 319
                interrupt_request = env->interrupt_request;
b/cpus.c
800 800
    qemu_wait_io_event_common(env);
801 801
}
802 802

  
803
static int qemu_cpu_exec(CPUState *env);
804

  
805 803
static void *qemu_kvm_cpu_thread_fn(void *arg)
806 804
{
807 805
    CPUState *env = arg;
......
829 827

  
830 828
    while (1) {
831 829
        if (cpu_can_run(env)) {
832
            r = qemu_cpu_exec(env);
830
            r = kvm_cpu_exec(env);
833 831
            if (r == EXCP_DEBUG) {
834 832
                cpu_handle_debug_exception(env);
835 833
            }
......
1040 1038

  
1041 1039
#endif
1042 1040

  
1043
static int qemu_cpu_exec(CPUState *env)
1041
static int tcg_cpu_exec(CPUState *env)
1044 1042
{
1045 1043
    int ret;
1046 1044
#ifdef CONFIG_PROFILER
......
1095 1093
            break;
1096 1094
        }
1097 1095
        if (cpu_can_run(env)) {
1098
            r = qemu_cpu_exec(env);
1099 1096
            if (kvm_enabled()) {
1097
                r = kvm_cpu_exec(env);
1100 1098
                qemu_kvm_eat_signals(env);
1099
            } else {
1100
                r = tcg_cpu_exec(env);
1101 1101
            }
1102 1102
            if (r == EXCP_DEBUG) {
1103 1103
                cpu_handle_debug_exception(env);
b/kvm-all.c
895 895

  
896 896
    if (kvm_arch_process_irqchip_events(env)) {
897 897
        env->exit_request = 0;
898
        env->exception_index = EXCP_HLT;
899
        return 0;
898
        return EXCP_HLT;
900 899
    }
901 900

  
901
    cpu_single_env = env;
902

  
902 903
    do {
903 904
        if (env->kvm_vcpu_dirty) {
904 905
            kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE);
......
927 928
        kvm_flush_coalesced_mmio_buffer();
928 929

  
929 930
        if (ret == -EINTR || ret == -EAGAIN) {
930
            cpu_exit(env);
931 931
            DPRINTF("io window exit\n");
932 932
            ret = 0;
933 933
            break;
......
978 978
            DPRINTF("kvm_exit_debug\n");
979 979
#ifdef KVM_CAP_SET_GUEST_DEBUG
980 980
            if (kvm_arch_debug(&run->debug.arch)) {
981
                env->exception_index = EXCP_DEBUG;
982
                return 0;
981
                ret = EXCP_DEBUG;
982
                goto out;
983 983
            }
984 984
            /* re-enter, this exception was guest-internal */
985 985
            ret = 1;
......
995 995
    if (ret < 0) {
996 996
        cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE);
997 997
        vm_stop(VMSTOP_PANIC);
998
        env->exit_request = 1;
999
    }
1000
    if (env->exit_request) {
1001
        env->exit_request = 0;
1002
        env->exception_index = EXCP_INTERRUPT;
1003 998
    }
999
    ret = EXCP_INTERRUPT;
1004 1000

  
1001
out:
1002
    env->exit_request = 0;
1003
    cpu_single_env = NULL;
1005 1004
    return ret;
1006 1005
}
1007 1006

  
b/target-i386/kvm.c
1502 1502

  
1503 1503
int kvm_arch_process_irqchip_events(CPUState *env)
1504 1504
{
1505
    if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)) {
1506
        env->halted = 0;
1507
    }
1505 1508
    if (env->interrupt_request & CPU_INTERRUPT_INIT) {
1506 1509
        kvm_cpu_synchronize_state(env);
1507 1510
        do_cpu_init(env);
1508
        env->exception_index = EXCP_HALTED;
1509 1511
    }
1510

  
1511 1512
    if (env->interrupt_request & CPU_INTERRUPT_SIPI) {
1512 1513
        kvm_cpu_synchronize_state(env);
1513 1514
        do_cpu_sipi(env);
......
1522 1523
          (env->eflags & IF_MASK)) &&
1523 1524
        !(env->interrupt_request & CPU_INTERRUPT_NMI)) {
1524 1525
        env->halted = 1;
1525
        env->exception_index = EXCP_HLT;
1526 1526
        return 0;
1527 1527
    }
1528 1528

  

Also available in: Unified diff