On 05/10/2016 05:46 AM, Sergey Fedorov wrote:
From: Sergey Fedorov <serge.f...@gmail.com>

Simplify cpu_exec() by extracting interrupt handling code outside of
cpu_exec() into a new static inline function cpu_handle_interrupt().

Signed-off-by: Sergey Fedorov <serge.f...@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedo...@linaro.org>
---
 cpu-exec.c | 132 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 70 insertions(+), 62 deletions(-)

Reviewed-by: Richard Henderson  <r...@twiddle.net>


+        if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) {
+            /* Do nothing */
+        } else if (interrupt_request & CPU_INTERRUPT_HALT) {
+        }
+        else if (interrupt_request & CPU_INTERRUPT_RESET) {
+        }
+        else {
+            replay_interrupt();
+            if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
+                *last_tb = NULL;
+            }
+        }
+        /* Don't use the cached interrupt_request value,
+           do_interrupt may have updated the EXITTB flag. */
+        if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) {

Note for future cleanup: IMO this comment is cleaner if it's actually put where it's meaningful (and updated to reflect that do_interrupt no longer exists). E.g.

    else {
        if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
            *last_tb = NULL;
        }
        /* Reload the interrupt_request value as it may have
           been updated by the target hook.  */
        interrupt_request = cpu->interrupt_request;
    }
    if (interupt_request & CPU_INTERRUPT_EXITTB) {
        ...

But such a change of course belongs in a separate patch.


r~

Reply via email to