From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZecSe-0001Wn-LO for qemu-devel@nongnu.org; Wed, 23 Sep 2015 01:19:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZecSb-00085z-IJ for qemu-devel@nongnu.org; Wed, 23 Sep 2015 01:19:20 -0400 Date: Wed, 23 Sep 2015 13:40:57 +1000 From: David Gibson Message-ID: <20150923034057.GA23607@voom.library.internet> References: <20150813223935.GA2598@voom.fritz.box> <1439523270-32718-1-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <1439523270-32718-1-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v3] target-ppc: Define get_monitor_def List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 14, 2015 at 01:34:30PM +1000, Alexey Kardashevskiy wrote: > At the moment get_monitor_def() prints only registers from monitor_defs. > However there is a lot of BOOK3S SPRs which are not in the list and > cannot be printed. >=20 > This makes use of the new get_monitor_def() callback and prints all > registered SPRs and fails on unregistered ones proving the user > information on what is actually supported in the running CPU. >=20 > Signed-off-by: Alexey Kardashevskiy Sorry it's taken me so long to review this. [snip] > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 84c5cea..2c6f772 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -11401,6 +11401,86 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*= f, > #endif > } > =20 > +static bool ppc_cpu_get_reg(target_ulong *regs, const char *numstr, int = maxnum, > + uint64_t *pval) > +{ > + char *endptr =3D NULL; > + int regnum; > + > + if (!*numstr) { > + return false; > + } > + > + regnum =3D strtoul(numstr, &endptr, 10); > + if (*endptr || (regnum >=3D maxnum)) { > + return false; > + } > + *pval =3D regs[regnum]; > + > + return true; > +} > + > +int ppc_cpu_get_monitor_def(CPUState *cs, const char *name, uint64_t *pv= al) > +{ > + int i; > + PowerPCCPU *cpu =3D POWERPC_CPU(cs); > + CPUPPCState *env =3D &cpu->env; > + > +#define MONREG(s, f) \ > + if ((strcasecmp((s), name) =3D=3D 0)) { \ > + *pval =3D (f); \ > + return 0; \ > + } > + MONREG("pc", env->nip) > + MONREG("nip", env->nip) > + MONREG("lr", env->lr) > + MONREG("ctr", env->ctr) > + MONREG("xer", env->xer) > + MONREG("decr", cpu_ppc_load_decr(env)) > + MONREG("msr", env->msr) > + MONREG("tbu", cpu_ppc_load_tbu(env)) > + MONREG("tbl", cpu_ppc_load_tbl(env)) > + > + if ((strcasecmp("ccr", name) =3D=3D 0) || (strcasecmp("cr", name) = =3D=3D 0)) { > + unsigned int u =3D 0; > + > + for (i =3D 0; i < 8; i++) > + u |=3D env->crf[i] << (32 - (4 * (i + 1))); > + > + return u; The other branches here set *pval and return 0, this one is returning the register contents directly. Is that a bug? Apart from that the patch looks good. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWAh9JAAoJEGw4ysog2bOSdsYQAJU09pwScjV6BRfxi/B6AriL DcGKI6ytzlQ/ZQySNp/YqQHUmNhLs0oTASMeW9nE6qlNjcpjfnfdFIFgwAoUO5ib ZdYwDhGHEX6pdahMKegZGUzQGKreM6NjrG+yRlWZ/uX+N4J9p1YWsgAFW9K3bQL0 P2/YyNScYi3Yd6LPUeJMhWhFbaTgEC0CEnpCXaZx+TITY+R8FRtYU7oxFkG88ULD dTLygl+q1t/kuyJFbMaAhn7osZZNgiLGyih/e33FuYYbGf+YIByjyY2u1JP8mwfa Ojk6C1UlBEAvvYCt9X3PeEsrWQRFHzff/mYnT/mde3enbVR8q/vYK31hnhftPksS i7HNXA8yHBS+3jlW/IKQsm5zq6ZyDmEl7hORL5HozhBeu/HQp6rtVVFWG7GF9cb7 +yA+uyakRACI5uD9SkM1QiwIWMcr7Hwfx61UPOH+gy0VcxSjSaX6ORLagbyNrkZq JoYvZI/B54sJYHbn2ZulLq5tnkoBHVmrhw6/CHUp4fLK6kZcEV8C42p6YjowWpcE R3S1VYX+N29lLb0o6hKuqtLJjAuEnsEsQUwjAtG9S1UmHIppQ3c+lDgjDS4CrJKm IVJjEaIC7YwugPQsi7mP9yPOPcUCqH25toLqWmGe8Cy7S/OpFALZyLOS9nxvZR4t hWNFJngdReIAmwlHv3Cj =f5i7 -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--