From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSXkh-00037U-Ts for qemu-devel@nongnu.org; Wed, 06 Jan 2010 10:24:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSXkd-00032Z-4q for qemu-devel@nongnu.org; Wed, 06 Jan 2010 10:24:51 -0500 Received: from [199.232.76.173] (port=42993 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSXkd-00032I-0a for qemu-devel@nongnu.org; Wed, 06 Jan 2010 10:24:47 -0500 Received: from mail-pw0-f43.google.com ([209.85.160.43]:65089) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSXkc-0005vv-LE for qemu-devel@nongnu.org; Wed, 06 Jan 2010 10:24:46 -0500 Received: by pwj11 with SMTP id 11so12222217pwj.2 for ; Wed, 06 Jan 2010 07:24:45 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20100105231907.6526.37249.stgit@skyserv> References: <20100105231558.6526.44483.stgit@skyserv> <20100105231907.6526.37249.stgit@skyserv> From: Blue Swirl Date: Wed, 6 Jan 2010 15:24:25 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 1/9] sparc64: trace pstate and global register set changes Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Igor V. Kovalenko" Cc: qemu-devel@nongnu.org On Tue, Jan 5, 2010 at 11:19 PM, Igor V. Kovalenko wrote: > From: Igor V. Kovalenko > > Signed-off-by: Igor V. Kovalenko > --- > =C2=A0target-sparc/op_helper.c | =C2=A0 20 ++++++++++++++++++++ > =C2=A01 files changed, 20 insertions(+), 0 deletions(-) > > diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c > index dab2c25..26092e5 100644 > --- a/target-sparc/op_helper.c > +++ b/target-sparc/op_helper.c > @@ -11,6 +11,7 @@ > =C2=A0//#define DEBUG_UNASSIGNED > =C2=A0//#define DEBUG_ASI > =C2=A0//#define DEBUG_PCALL > +//#define DEBUG_PSTATE > > =C2=A0#ifdef DEBUG_MMU > =C2=A0#define DPRINTF_MMU(fmt, ...) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 \ > @@ -31,6 +32,13 @@ > =C2=A0 =C2=A0 do { printf("ASI: " fmt , ## __VA_ARGS__); } while (0) > =C2=A0#endif > > +#ifdef DEBUG_PSTATE > +#define DPRINTF_PSTATE(fmt, ...) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 \ > + =C2=A0 =C2=A0do { printf("PSTATE: " fmt , ## __VA_ARGS__); } while (0) > +#else > +#define DPRINTF_PSTATE(fmt, ...) do {} while (0) > +#endif > + > =C2=A0#ifdef TARGET_SPARC64 > =C2=A0#ifndef TARGET_ABI32 > =C2=A0#define AM_CHECK(env1) ((env1)->pstate & PS_AM) > @@ -3244,6 +3252,12 @@ static inline uint64_t *get_gregset(uint64_t pstat= e) > =C2=A0{ > =C2=A0 =C2=A0 switch (pstate) { > =C2=A0 =C2=A0 default: > + =C2=A0 =C2=A0 =C2=A0 =C2=A0DPRINTF_PSTATE("ERROR in get_gregset: active= pstate bits=3D%lX %s %s %s", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pstate, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(pstate&PS_IG)?"= IG":"", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(pstate&PS_MG)?"= MG":"", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(pstate&PS_AG)?"= AG":"" ); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0/* pass through to normal set of global regi= sters */ %lX format is not correct on 64 bit hosts and nobody uses upper case hex, please use just %x. The spacing is too tight. On UltraSPARC-IV and T1/2 the bits are interpreted differently (GL) so the printout would be wrong, but that can be disregarded for now. > =C2=A0 =C2=A0 case 0: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return env->bgregs; > =C2=A0 =C2=A0 case PS_AG: > @@ -3269,12 +3283,18 @@ static inline void change_pstate(uint64_t new_pst= ate) > =C2=A0 =C2=A0 new_pstate_regs =3D new_pstate & 0xc01; > > =C2=A0 =C2=A0 if (new_pstate_regs !=3D pstate_regs) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0DPRINTF_PSTATE("change_pstate: switching reg= s old=3D%lX new=3D%lX\n", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 pstate_regs, new_pstate_regs); Same format issue here. > =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Switch global register bank > =C2=A0 =C2=A0 =C2=A0 =C2=A0 src =3D get_gregset(new_pstate_regs); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 dst =3D get_gregset(pstate_regs); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 memcpy32(dst, env->gregs); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 memcpy32(env->gregs, src); > =C2=A0 =C2=A0 } > + =C2=A0 =C2=A0else { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0DPRINTF_PSTATE("change_pstate: regs new=3D%l= X (unchanged)\n", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 new_pstate_regs); > + =C2=A0 =C2=A0} And here.