From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTqUV-0008Kz-1w for qemu-devel@nongnu.org; Tue, 16 Sep 2014 07:00:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTq89-0005Yo-AP for qemu-devel@nongnu.org; Tue, 16 Sep 2014 06:37:59 -0400 Received: from mail-pd0-x231.google.com ([2607:f8b0:400e:c02::231]:34288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTq88-0005XV-TB for qemu-devel@nongnu.org; Tue, 16 Sep 2014 06:37:05 -0400 Received: by mail-pd0-f177.google.com with SMTP id y10so8377446pdj.22 for ; Tue, 16 Sep 2014 03:36:58 -0700 (PDT) Date: Tue, 16 Sep 2014 20:35:38 +1000 From: "Edgar E. Iglesias" Message-ID: <20140916103537.GB12586@zapo.iiNet> References: <1410626734-3804-1-git-send-email-rth@twiddle.net> <1410626734-3804-11-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410626734-3804-11-git-send-email-rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH 10/23] target-cris: Use cpu_exec_interrupt qom hook List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, aliguori@amazon.com, afaerber@suse.de On Sat, Sep 13, 2014 at 09:45:21AM -0700, Richard Henderson wrote: > Cc: Edgar E. Iglesias > Signed-off-by: Richard Henderson Both CRIS and MicroBlaze look good, thanks. Reviewed-by: Edgar E. Iglesias > --- > cpu-exec.c | 21 --------------------- > target-cris/cpu-qom.h | 1 + > target-cris/cpu.c | 1 + > target-cris/helper.c | 31 +++++++++++++++++++++++++++++++ > 4 files changed, 33 insertions(+), 21 deletions(-) > > diff --git a/cpu-exec.c b/cpu-exec.c > index 8ff85ba..7efcf27 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -629,27 +629,6 @@ int cpu_exec(CPUArchState *env) > next_tb = 0; > } > } > -#elif defined(TARGET_CRIS) > - if (interrupt_request & CPU_INTERRUPT_HARD > - && (env->pregs[PR_CCS] & I_FLAG) > - && !env->locked_irq) { > - cpu->exception_index = EXCP_IRQ; > - cc->do_interrupt(cpu); > - next_tb = 0; > - } > - if (interrupt_request & CPU_INTERRUPT_NMI) { > - unsigned int m_flag_archval; > - if (env->pregs[PR_VR] < 32) { > - m_flag_archval = M_FLAG_V10; > - } else { > - m_flag_archval = M_FLAG_V32; > - } > - if ((env->pregs[PR_CCS] & m_flag_archval)) { > - cpu->exception_index = EXCP_NMI; > - cc->do_interrupt(cpu); > - next_tb = 0; > - } > - } > #endif > /* The target hook has 3 exit conditions: > False when the interrupt isn't processed, > diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h > index 7559366..6fc30c2 100644 > --- a/target-cris/cpu-qom.h > +++ b/target-cris/cpu-qom.h > @@ -75,6 +75,7 @@ static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) > > void cris_cpu_do_interrupt(CPUState *cpu); > void crisv10_cpu_do_interrupt(CPUState *cpu); > +bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); > > void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, > int flags); > diff --git a/target-cris/cpu.c b/target-cris/cpu.c > index 20d8809..528e458 100644 > --- a/target-cris/cpu.c > +++ b/target-cris/cpu.c > @@ -279,6 +279,7 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) > cc->class_by_name = cris_cpu_class_by_name; > cc->has_work = cris_cpu_has_work; > cc->do_interrupt = cris_cpu_do_interrupt; > + cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; > cc->dump_state = cris_cpu_dump_state; > cc->set_pc = cris_cpu_set_pc; > cc->gdb_read_register = cris_cpu_gdb_read_register; > diff --git a/target-cris/helper.c b/target-cris/helper.c > index e8b8261..e901c3a 100644 > --- a/target-cris/helper.c > +++ b/target-cris/helper.c > @@ -283,3 +283,34 @@ hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) > return phy; > } > #endif > + > +bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request) > +{ > + CPUClass *cc = CPU_GET_CLASS(cs); > + CRISCPU *cpu = CRIS_CPU(cs); > + CPUCRISState *env = &cpu->env; > + bool ret = false; > + > + if (interrupt_request & CPU_INTERRUPT_HARD > + && (env->pregs[PR_CCS] & I_FLAG) > + && !env->locked_irq) { > + cs->exception_index = EXCP_IRQ; > + cc->do_interrupt(cs); > + ret = true; > + } > + if (interrupt_request & CPU_INTERRUPT_NMI) { > + unsigned int m_flag_archval; > + if (env->pregs[PR_VR] < 32) { > + m_flag_archval = M_FLAG_V10; > + } else { > + m_flag_archval = M_FLAG_V32; > + } > + if ((env->pregs[PR_CCS] & m_flag_archval)) { > + cs->exception_index = EXCP_NMI; > + cc->do_interrupt(cs); > + ret = true; > + } > + } > + > + return ret; > +} > -- > 1.9.3 >