From patchwork Sun Mar 31 01:35:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dunrong Huang X-Patchwork-Id: 232586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F233F2C00EF for ; Sun, 31 Mar 2013 12:36:07 +1100 (EST) Received: from localhost ([::1]:52487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UM7Bl-0003D5-VS for incoming@patchwork.ozlabs.org; Sat, 30 Mar 2013 21:36:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UM7BR-0003Cm-6M for qemu-devel@nongnu.org; Sat, 30 Mar 2013 21:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UM7BN-0008U3-OI for qemu-devel@nongnu.org; Sat, 30 Mar 2013 21:35:45 -0400 Received: from mail-da0-x22e.google.com ([2607:f8b0:400e:c00::22e]:45680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UM7BN-0008Tx-IC for qemu-devel@nongnu.org; Sat, 30 Mar 2013 21:35:41 -0400 Received: by mail-da0-f46.google.com with SMTP id y19so637829dan.5 for ; Sat, 30 Mar 2013 18:35:40 -0700 (PDT) X-Received: by 10.68.12.103 with SMTP id x7mr11146076pbb.37.1364693740361; Sat, 30 Mar 2013 18:35:40 -0700 (PDT) Received: from localhost.localdomain ([117.79.232.180]) by mx.google.com with ESMTPS id qe3sm8281738pbb.0.2013.03.30.18.35.36 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Mar 2013 18:35:39 -0700 (PDT) From: Dunrong Huang To: qemu-devel Date: Sun, 31 Mar 2013 09:35:53 +0800 Message-Id: <1364693753-3311-1-git-send-email-huangdr@cloud-times.com> X-Mailer: git-send-email 1.8.1.5 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c00::22e Cc: Blue Swirl , Anthony Green , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH] target-moxie: set do_interrupt to a target-specific helper function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The value of "do_interrupt" member of CPUClass shoule be set to a target-specific function, or it will lead to a segfault like below: $ moxie-softmmu/qemu-system-moxie -M moxiesim Segmentation fault Cc: Anthony Green Cc: Blue Swirl Cc: Andreas Färber Signed-off-by: Dunrong Huang Reviewed-by: Andreas Färber --- target-moxie/cpu.c | 1 + target-moxie/cpu.h | 2 +- target-moxie/helper.c | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c index c17d3f0..c0855f0 100644 --- a/target-moxie/cpu.c +++ b/target-moxie/cpu.c @@ -98,6 +98,7 @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = moxie_cpu_class_by_name; dc->vmsd = &vmstate_moxie_cpu; + cc->do_interrupt = moxie_cpu_do_interrupt; } static void moxielite_initfn(Object *obj) diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h index b96236f..988729a 100644 --- a/target-moxie/cpu.h +++ b/target-moxie/cpu.h @@ -117,7 +117,7 @@ static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env) MoxieCPU *cpu_moxie_init(const char *cpu_model); int cpu_moxie_exec(CPUMoxieState *s); -void do_interrupt(CPUMoxieState *env); +void moxie_cpu_do_interrupt(CPUState *cs); void moxie_translate_init(void); int cpu_moxie_signal_handler(int host_signum, void *pinfo, void *puc); diff --git a/target-moxie/helper.c b/target-moxie/helper.c index 8604ce8..6e0ac2a 100644 --- a/target-moxie/helper.c +++ b/target-moxie/helper.c @@ -102,7 +102,7 @@ void helper_debug(CPUMoxieState *env) #if defined(CONFIG_USER_ONLY) -void do_interrupt(CPUState *env) +void moxie_cpu_do_interrupt(CPUState *env) { env->exception_index = -1; } @@ -147,8 +147,11 @@ int cpu_moxie_handle_mmu_fault(CPUMoxieState *env, target_ulong address, } -void do_interrupt(CPUMoxieState *env) +void moxie_cpu_do_interrupt(CPUState *cs) { + MoxieCPU *cpu = MOXIE_CPU(cs); + CPUMoxieState *env = &cpu->env; + switch (env->exception_index) { case MOXIE_EX_BREAK: break;