Revision 9fddaa0c target-ppc/helper.c

b/target-ppc/helper.c
27 27
//#define DEBUG_BATS
28 28
//#define DEBUG_EXCEPTIONS
29 29

  
30
extern FILE *logfile, *stdout, *stderr;
31
void exit (int);
30
extern FILE *stdout, *stderr;
32 31
void abort (void);
33 32

  
34
void cpu_loop_exit(void)
35
{
36
    longjmp(env->jmp_env, 1);
37
}
38

  
39
void do_process_exceptions (void)
40
{
41
    cpu_loop_exit();
42
}
43

  
44
int check_exception_state (CPUState *env)
45
{
46
    int i;
47

  
48
    /* Process PPC exceptions */
49
    for (i = 1; i  < EXCP_PPC_MAX; i++) {
50
        if (env->exceptions & (1 << i)) {
51
            switch (i) {
52
            case EXCP_EXTERNAL:
53
            case EXCP_DECR:
54
                if (msr_ee == 0)
55
                    return 0;
56
                break;
57
            case EXCP_PROGRAM:
58
                if (env->errors[EXCP_PROGRAM] == EXCP_FP &&
59
                    msr_fe0 == 0 && msr_fe1 == 0)
60
                    return 0;
61
                break;
62
            default:
63
                break;
64
            }
65
            env->exception_index = i;
66
            env->error_code = env->errors[i];
67
            return 1;
68
        }
69
    }
70

  
71
    return 0;
72
}
33
/*****************************************************************************/
73 34

  
74 35
/*****************************************************************************/
75 36
/* PPC MMU emulation */
......
500 461
                cpu_restore_state(tb, env, pc, NULL);
501 462
            }
502 463
        }
503
        do_queue_exception_err(env->exception_index, env->error_code);
504
        do_process_exceptions();
464
        do_raise_exception_err(env->exception_index, env->error_code);
505 465
    }
506 466
    {
507 467
        unsigned long tlb_addrr, tlb_addrw;
......
701 661
    uint32_t msr;
702 662
    int excp = env->exception_index;
703 663

  
704
    /* Dequeue PPC exceptions */
705
    if (excp < EXCP_PPC_MAX)
706
        env->exceptions &= ~(1 << excp);
707 664
    msr = _load_msr(env);
708 665
#if defined (DEBUG_EXCEPTIONS)
709 666
    if ((excp == EXCP_PROGRAM || excp == EXCP_DSI) && msr_pr == 1) 
......
812 769
    }
813 770
#endif
814 771
            /* Requeue it */
815
            do_queue_exception(EXCP_EXTERNAL);
772
            do_raise_exception(EXCP_EXTERNAL);
816 773
            return;
817 774
            }
818 775
        goto store_next;
......
864 821
    case EXCP_DECR:
865 822
        if (msr_ee == 0) {
866 823
            /* Requeue it */
867
            do_queue_exception(EXCP_DECR);
824
            do_raise_exception(EXCP_DECR);
868 825
            return;
869 826
        }
870 827
        goto store_next;
......
937 894
    T0 = 0;
938 895
#endif
939 896
#endif
897
    env->exception_index = -1;
940 898
}

Also available in: Unified diff