From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8391 invoked by alias); 15 Dec 2010 17:08:14 -0000 Received: (qmail 8368 invoked by uid 22791); 15 Dec 2010 17:08:11 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 17:08:05 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 09F341B41EE; Wed, 15 Dec 2010 17:08:03 +0000 (UTC) From: Mike Frysinger To: Pedro Alves Subject: Re: [PATCH v3] gdb: bfin: new port Date: Wed, 15 Dec 2010 17:08:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.37-rc5; KDE/4.5.2; x86_64; ; ) Cc: gdb-patches@sourceware.org, toolchain-devel@blackfin.uclinux.org References: <1291886957-12003-1-git-send-email-vapier@gentoo.org> <201012150802.03234.vapier@gentoo.org> <201012151649.32678.pedro@codesourcery.com> In-Reply-To: <201012151649.32678.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart6599744.2s4zGTVKzZ"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201012151207.12141.vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00308.txt.bz2 --nextPart6599744.2s4zGTVKzZ Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-length: 3480 On Wednesday, December 15, 2010 11:49:32 Pedro Alves wrote: > On Wednesday 15 December 2010 13:02:02, Mike Frysinger wrote: > > On Tuesday, December 14, 2010 17:00:13 Mike Frysinger wrote: > > > On Tuesday, December 14, 2010 16:31:22 Pedro Alves wrote: > > > > Can you explain why are the PC and CC registers pseudo > > > > registers, but supported as being raw registers anyway? Couldn't > > > > gdb compute them itself from the other registers, with > > > > gdb's pseudo register support (gdbarch_pseudo_register_read|write)? > > > > googling I found you mentioning that the "CC pseudo register can > > > > be deduced from the ASTAT register", though further googling doesn't > > > > find any mention of what ASTAT is. I'm sure there's a good reason, > > > > I'm probably just missing a comment somewhere. > > >=20 > > > CC is actually a single bit in the ASTAT (arithmetic status) register, > > > but often is treated as an actual register in much of the ISA. such > > > as assignments or logical tests. you can do " =3D CC" and "CC = =3D > > > ", but you cant do this with any other ASTAT bit (like AZ, AN, > > > etc...). > >=20 > > another data point: gcc itself treats CC as a register. > >=20 > > btw, the name is short for "Control Code" >=20 > Thanks for the explanations. This makes it so that the ASTAT.CC bit > can easily end up out of sync with the CC register in gdb's > regcache then, right? E.g., "p $cc =3D 1; p $asat" will still show the > $asat.cc as 0, IIUC. Does the kernel actually store CC on its > own slot in the register stack? I ask because I see it commented out > in bfin_regmap in gdbserver. If $cc was a pseudo-register _managed_ by > gdb (computed from ASAT), then this out-of-sync-ness would never happen. no, linux does not give CC dedicated space in the signal context. it does= =20 look like setting $cc on the command line results in out-of-sync values wit= h=20 $astat. i'll take a look at the pseudo helpers you referenced and see if i= =20 cant figure out how they work. > Similar comments apply to the PC. I see: > > +static int bfin_linux_sigcontext_reg_offset[BFIN_NUM_REGS] > ... > > + 21 * 4, /* %reti */ > > + 22 * 4, /* %retx */ > > + -1, /* %retn */ > > + -1, /* %rete */ > > + 21 * 4, /* %pc */ >=20 > So, it's really the same stack slot as reti. >=20 > and in gdbserver: > > +static int bfin_regmap[] =3D > > + -1 /* PT_USP */, PT_SEQSTAT, PT_SYSCFG, PT_PC, PT_RETX, PT_RETN, > > PT_RETE, + PT_PC, -1 /* PT_CC */, >=20 > (PT_PC used to get at reti). >=20 > It all looks like you should really make the PC and the CC registers > pseudo registers handled by gdb, and not pass them on the remote > protocol wire, getting rid of all the possibility of confusing > out-of-sync iret/pc, astat/cc. the trouble with PC is that it isnt always RETI. with a Linux userspace ap= p,=20 the PC is managed indirectly via RETI (by nature of the sequencer). but th= is=20 all depends on the level the remote stub is operating at. it could possibl= y=20 be indirectly handled by RETX or RETN or RETE as well. so i think the PC=20 logic needs to be left up to the remote stub to properly manage. i dont th= ink=20 we need to worry about people attempting to screw with any of the superviso= r=20 level registers (RET[IXNE]) because they arent allowed to in usermode and t= hey=20 make no sense unless you're in any of those contexts=20 (interrupt/exception/nmi/emulation). -mike --nextPart6599744.2s4zGTVKzZ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iQIcBAABAgAGBQJNCPXAAAoJEEFjO5/oN/WBmqYQAN/siNTW7oPZjT7ZeBEo4LAN naG9/rocUBhDDWKRcRBdTCeInfU5pHQEdwtnX19NxHAdAp36RYMWfG4UrmqE/fqC /C/QM2FY7TS4amTGrb/XdVx8sTYjLgILMZdnpLT0qvCAcwRLifjNFzziICuNobo/ uuaJUPxlYy4yrk9K1gZ/kkF5mcSb6mRxUbAUCD5W4ZV3eetlGXOXwo3meoI2MBoj CfVHIhwd+uVO+kof4faR2hro2f65lxhcppJAnJYiJWPpAToUOdaNe6Txjy5CkyFn hq1ueoWCqxReVg0QK6GuOetj6HT0pLI+ESS2yybpZy2Zd2XqCSAdy1CjeXArB9zG P2PK1tEgjrwiHJ03vfsN+oRoXH5TQF9b4dr/IhYWMyvQovkFcuhrNvS+z4v/8RWV NGA+ROlTlLvZc0vnKGhaOJD0Mcp+DhufMTadJeL+XkbFQyQDo6LbBzgUJQM59c+o GxTh9P/1tdEzdDCFiogUR0q90BhJnPuVGDYhLdZP0wgEnbAcar4TbdOO7MgJVlJn M9m/XuKoT/D0XT/sDswBuqxbipWKGithcu7EQ7GTPHdulSMcXfT+RnD8QN+spRYp Lneey6fTzRZ/w9uBXVTLMjeLV+LWaesq2eM1XAPtQtFDuKIVEskslTZB8CFxvfO/ RVfYQaNDdsQmvm+66r65 =Xr4X -----END PGP SIGNATURE----- --nextPart6599744.2s4zGTVKzZ--