From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKV5Q-0003wH-Uj for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:42:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKV5P-0006TX-BP for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:42:52 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51931 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKUzP-00045M-JY for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:36:39 -0400 Message-ID: <5151B249.6050602@suse.de> Date: Tue, 26 Mar 2013 15:35:53 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1364300401-9340-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1364300401-9340-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] sh7750: Fix crash when accessing PVR/PRR/CVR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org Am 26.03.2013 13:20, schrieb Peter Maydell: > Commit b350ab75 causes segfaults on accesses to PVR/PRR/CVR because > it tries to call SUPERH_CPU_GET_CLASS() on a pointer that isn't a > QOM object. Fix this by getting the actual QOM CPU object first. >=20 > Signed-off-by: Peter Maydell > --- > Tested with the r2d image/instructions from > https://oss.renesas.com/modules/document/?Getting%20Started%20with%20SH= 4%20and%20QEMU Oops, reproduces with the test image from the QEMU Wiki as well. Seems to be a result of cherry-picking this commit before the full SH7750 QOM'ification. Is this blocking any work of yours? Otherwise I would try rebasing my SH7750 patches so that s->cpu becomes a SuperHCPU as expected here. (Not sure if simply reverting my offending patch still works?) Andreas >=20 > hw/sh4/sh7750.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c > index e4d37ad..3580c87 100644 > --- a/hw/sh4/sh7750.c > +++ b/hw/sh4/sh7750.c > @@ -289,13 +289,13 @@ static uint32_t sh7750_mem_readl(void *opaque, hw= addr addr) > case SH7750_CCR_A7: > return s->ccr; > case 0x1f000030: /* Processor version */ > - scc =3D SUPERH_CPU_GET_CLASS(s->cpu); > + scc =3D SUPERH_CPU_GET_CLASS(ENV_GET_CPU(s->cpu)); > return scc->pvr; > case 0x1f000040: /* Cache version */ > - scc =3D SUPERH_CPU_GET_CLASS(s->cpu); > + scc =3D SUPERH_CPU_GET_CLASS(ENV_GET_CPU(s->cpu)); > return scc->cvr; > case 0x1f000044: /* Processor revision */ > - scc =3D SUPERH_CPU_GET_CLASS(s->cpu); > + scc =3D SUPERH_CPU_GET_CLASS(ENV_GET_CPU(s->cpu)); > return scc->prr; > default: > error_access("long read", addr); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg