On 9/18/07, J. Mayer <[EMAIL PROTECTED]> wrote: > Going this way, I see no reason why the interruption code in the cpu_exec loop > could not finally become: > interrupt_request = env->interrupt_request; > if (__builtin_expect(interrupt_request, 0)) { > if (interrupt_request & CPU_INTERRUPT_DEBUG) { > env->interrupt_request &= ~CPU_INTERRUPT_DEBUG; > env->exception_index = EXCP_DEBUG; > cpu_loop_exit(); > } > if (interrupt_request & CPU_INTERRUPT_HALT) { > env->interrupt_request &= ~CPU_INTERRUPT_HALT; > env->halted = 1; > env->exception_index = EXCP_HLT; > cpu_loop_exit(); > } > if (interrupt_request & CPU_INTERRUPT_HARD) { > hw_interrupt(env); > if (env->pending_interrupts == 0) > env->interrupt_request &= ~CPU_INTERRUPT_HARD; > #if defined(__sparc__) && !defined(HOST_SOLARIS) > tmp_T0 = 0; > #else > T0 = 0; > #endif > } > /* Don't use the cached interupt_request value, > do_interrupt may have updated the EXITTB flag. */ > if (interrupt_request & CPU_INTERRUPT_EXITTB) { > env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; > /* ensure that no TB jump will be modified as > the program flow was changed */ > #if defined(__sparc__) && !defined(HOST_SOLARIS) > tmp_T0 = 0; > #else > T0 = 0; > #endif > } > if (interrupt_request & CPU_INTERRUPT_EXIT) { > env->interrupt_request &= ~CPU_INTERRUPT_EXIT; > env->exception_index = EXCP_INTERRUPT; > cpu_loop_exit(); > } > } > All the targets specific tricks could be done in the hw_interrupt routine. > And the generic code > would become much more readable. But this needs some works (not so much) and > intensive tests... > And I guess nobody feels like taking this risk right now ;-) > But I think this will have to be done someday...
I vote for this. There are some other places where we could use the same API: cpu_dump_state() cpu_list() cpu_register()