qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 09/23] target-m68k: Use cpu_exec_interrupt qom h


From: Alex Bennée
Subject: Re: [Qemu-devel] [PATCH 09/23] target-m68k: Use cpu_exec_interrupt qom hook
Date: Tue, 16 Sep 2014 19:41:55 +0100
User-agent: mu4e 0.9.9.5; emacs 24.3.1

Richard Henderson writes:

> Since do_interrupt_m68k_hardirq is no longer used outside
> op_helper.c, make it static.
>
> Signed-off-by: Richard Henderson <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>

> ---
>  cpu-exec.c              | 13 -------------
>  target-m68k/cpu-qom.h   |  1 +
>  target-m68k/cpu.c       |  1 +
>  target-m68k/cpu.h       |  1 -
>  target-m68k/op_helper.c | 22 ++++++++++++++++++++--
>  5 files changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 08be521..8ff85ba 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -650,19 +650,6 @@ int cpu_exec(CPUArchState *env)
>                              next_tb = 0;
>                          }
>                      }
> -#elif defined(TARGET_M68K)
> -                    if (interrupt_request & CPU_INTERRUPT_HARD
> -                        && ((env->sr & SR_I) >> SR_I_SHIFT)
> -                            < env->pending_level) {
> -                        /* Real hardware gets the interrupt vector via an
> -                           IACK cycle at this point.  Current emulated
> -                           hardware doesn't rely on this, so we
> -                           provide/save the vector when the interrupt is
> -                           first signalled.  */
> -                        cpu->exception_index = env->pending_vector;
> -                        do_interrupt_m68k_hardirq(env);
> -                        next_tb = 0;
> -                    }
>  #endif
>                      /* The target hook has 3 exit conditions:
>                         False when the interrupt isn't processed,
> diff --git a/target-m68k/cpu-qom.h b/target-m68k/cpu-qom.h
> index 41b14ae..c28e55d 100644
> --- a/target-m68k/cpu-qom.h
> +++ b/target-m68k/cpu-qom.h
> @@ -71,6 +71,7 @@ static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
>  #define ENV_OFFSET offsetof(M68kCPU, env)
>  
>  void m68k_cpu_do_interrupt(CPUState *cpu);
> +bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
>  void m68k_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function 
> cpu_fprintf,
>                           int flags);
>  hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
> index 5a58d51..4cfb725 100644
> --- a/target-m68k/cpu.c
> +++ b/target-m68k/cpu.c
> @@ -196,6 +196,7 @@ static void m68k_cpu_class_init(ObjectClass *c, void 
> *data)
>      cc->class_by_name = m68k_cpu_class_by_name;
>      cc->has_work = m68k_cpu_has_work;
>      cc->do_interrupt = m68k_cpu_do_interrupt;
> +    cc->cpu_exec_interrupt = m68k_cpu_exec_interrupt;
>      cc->dump_state = m68k_cpu_dump_state;
>      cc->set_pc = m68k_cpu_set_pc;
>      cc->gdb_read_register = m68k_cpu_gdb_read_register;
> diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
> index 6e4001d..f67bbcc 100644
> --- a/target-m68k/cpu.h
> +++ b/target-m68k/cpu.h
> @@ -120,7 +120,6 @@ void m68k_tcg_init(void);
>  void m68k_cpu_init_gdb(M68kCPU *cpu);
>  M68kCPU *cpu_m68k_init(const char *cpu_model);
>  int cpu_m68k_exec(CPUM68KState *s);
> -void do_interrupt_m68k_hardirq(CPUM68KState *env1);
>  /* you can call this signal handler from your SIGBUS and SIGSEGV
>     signal handlers to inform the virtual CPU of exceptions. non zero
>     is returned if the signal was handled by the virtual CPU.  */
> diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
> index 9dd3e74..06661f5 100644
> --- a/target-m68k/op_helper.c
> +++ b/target-m68k/op_helper.c
> @@ -27,7 +27,7 @@ void m68k_cpu_do_interrupt(CPUState *cs)
>      cs->exception_index = -1;
>  }
>  
> -void do_interrupt_m68k_hardirq(CPUM68KState *env)
> +static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)
>  {
>  }
>  
> @@ -141,12 +141,30 @@ void m68k_cpu_do_interrupt(CPUState *cs)
>      do_interrupt_all(env, 0);
>  }
>  
> -void do_interrupt_m68k_hardirq(CPUM68KState *env)
> +static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)
>  {
>      do_interrupt_all(env, 1);
>  }
>  #endif
>  
> +bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
> +{
> +    M68kCPU *cpu = M68K_CPU(cs);
> +    CPUM68KState *env = &cpu->env;
> +
> +    if (interrupt_request & CPU_INTERRUPT_HARD
> +        && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) {
> +        /* Real hardware gets the interrupt vector via an IACK cycle
> +           at this point.  Current emulated hardware doesn't rely on
> +           this, so we provide/save the vector when the interrupt is
> +           first signalled.  */
> +        cs->exception_index = env->pending_vector;
> +        do_interrupt_m68k_hardirq(env);
> +        return true;
> +    }
> +    return false;
> +}
> +
>  static void raise_exception(CPUM68KState *env, int tt)
>  {
>      CPUState *cs = CPU(m68k_env_get_cpu(env));


-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]