From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMLdd-0001z5-C8 for qemu-devel@nongnu.org; Sun, 31 Mar 2013 13:01:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMLdb-0002DQ-12 for qemu-devel@nongnu.org; Sun, 31 Mar 2013 13:01:49 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40449 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMLda-00028B-Nr for qemu-devel@nongnu.org; Sun, 31 Mar 2013 13:01:46 -0400 Message-ID: <51586BD0.6000207@suse.de> Date: Sun, 31 Mar 2013 19:01:04 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1364693753-3311-1-git-send-email-huangdr@cloud-times.com> In-Reply-To: <1364693753-3311-1-git-send-email-huangdr@cloud-times.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-moxie: set do_interrupt to a target-specific helper function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dunrong Huang , Anthony Green Cc: Blue Swirl , qemu-devel Am 31.03.2013 03:35, schrieb Dunrong Huang: > 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: >=20 > $ moxie-softmmu/qemu-system-moxie -M moxiesim > Segmentation fault >=20 > Cc: Anthony Green > Cc: Blue Swirl > Cc: Andreas F=C3=A4rber > Signed-off-by: Dunrong Huang > --- > target-moxie/cpu.c | 1 + > target-moxie/cpu.h | 2 +- > target-moxie/helper.c | 7 +++++-- > 3 files changed, 7 insertions(+), 3 deletions(-) >=20 > 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, voi= d *data) > cc->class_by_name =3D moxie_cpu_class_by_name; > =20 > dc->vmsd =3D &vmstate_moxie_cpu; > + cc->do_interrupt =3D moxie_cpu_do_interrupt; > } > =20 > 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(CPUMoxieS= tate *env) > =20 > 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) > =20 > #if defined(CONFIG_USER_ONLY) > =20 > -void do_interrupt(CPUState *env) > +void moxie_cpu_do_interrupt(CPUState *env) > { > env->exception_index =3D -1; > } Anthony, CPUState should not be named "env" but rather "cs" (to reserve "cpu" for MoxieCPU). That's unrelated to this patch though. > @@ -147,8 +147,11 @@ int cpu_moxie_handle_mmu_fault(CPUMoxieState *env,= target_ulong address, > } > =20 > =20 > -void do_interrupt(CPUMoxieState *env) > +void moxie_cpu_do_interrupt(CPUState *cs) > { > + MoxieCPU *cpu =3D MOXIE_CPU(cs); > + CPUMoxieState *env =3D &cpu->env; > + > switch (env->exception_index) { > case MOXIE_EX_BREAK: > break; That exception_index is used once from CPUMoxieState and once from CPUState is telling me something is fishy here... Are any test images available? Hooking up cc->do_interrupt is the correct thing to do though, so that could be sorted out later, Reviewed-by: Andreas F=C3=A4rber Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg