Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, toolchain-devel@blackfin.uclinux.org
Subject: Re: [PATCH v3] gdb: bfin: new port
Date: Wed, 15 Dec 2010 17:08:00 -0000	[thread overview]
Message-ID: <201012151207.12141.vapier@gentoo.org> (raw)
In-Reply-To: <201012151649.32678.pedro@codesourcery.com>

[-- Attachment #1: Type: Text/Plain, Size: 3483 bytes --]

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.
> > > 
> > > 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 "<reg> = CC" and "CC =
> > > <reg>", but you cant do this with any other ASTAT bit (like AZ, AN,
> > > etc...).
> > 
> > another data point: gcc itself treats CC as a register.
> > 
> > btw, the name is short for "Control Code"
> 
> 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 = 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 
look like setting $cc on the command line results in out-of-sync values with 
$astat.  i'll take a look at the pseudo helpers you referenced and see if i 
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 */
> 
> So, it's really the same stack slot as reti.
> 
> and in gdbserver:
> > +static int bfin_regmap[] =
> > +  -1 /* PT_USP */, PT_SEQSTAT, PT_SYSCFG, PT_PC, PT_RETX, PT_RETN,
> > PT_RETE, +  PT_PC, -1 /* PT_CC */,
> 
> (PT_PC used to get at reti).
> 
> 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 app, 
the PC is managed indirectly via RETI (by nature of the sequencer).  but this 
all depends on the level the remote stub is operating at.  it could possibly 
be indirectly handled by RETX or RETN or RETE as well.  so i think the PC 
logic needs to be left up to the remote stub to properly manage.  i dont think 
we need to worry about people attempting to screw with any of the supervisor 
level registers (RET[IXNE]) because they arent allowed to in usermode and they 
make no sense unless you're in any of those contexts 
(interrupt/exception/nmi/emulation).
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2010-12-15 17:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09  9:29 [PATCH v2] " Mike Frysinger
2010-12-09  9:31 ` [PATCH v2] gdbserver: " Mike Frysinger
2010-12-13 18:44   ` Pedro Alves
2010-12-13 19:24     ` Mike Frysinger
2010-12-14  9:37     ` Andrew Stubbs
2010-12-14 15:10       ` Mike Frysinger
2010-12-14 16:31         ` Pedro Alves
2010-12-14 16:58           ` Mike Frysinger
2010-12-14 17:16             ` Andrew Stubbs
2010-12-14 17:26               ` Mike Frysinger
2010-12-15 11:54                 ` Andrew Stubbs
2010-12-15 12:55                   ` [toolchain-devel] " Mike Frysinger
2010-12-15 13:17                     ` Andrew Stubbs
2010-12-14 17:40             ` Pedro Alves
2010-12-14 17:48               ` Mike Frysinger
2010-12-14 18:06                 ` Pedro Alves
2010-12-14 18:21                   ` Mike Frysinger
2010-12-15 16:54                     ` Mike Frysinger
2010-12-14  6:03 ` [PATCH v2] gdb: " Joel Brobecker
2010-12-14 16:14   ` Mike Frysinger
2010-12-14 20:43 ` [PATCH v3] " Mike Frysinger
2010-12-14 21:31   ` Pedro Alves
2010-12-14 22:01     ` Mike Frysinger
2010-12-15 13:02       ` Mike Frysinger
2010-12-15 16:53         ` Pedro Alves
2010-12-15 17:08           ` Mike Frysinger [this message]
2010-12-15 18:01             ` Pedro Alves
2010-12-15 18:38               ` Mike Frysinger
2010-12-15 18:42                 ` Pedro Alves
2010-12-15 18:16             ` Mike Frysinger
2010-12-15 18:25               ` Pedro Alves
2010-12-14 21:48   ` [PATCH v3] gdbserver: " Mike Frysinger
2010-12-14 23:03     ` Ralf Corsepius
2010-12-15  0:15       ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012151207.12141.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=toolchain-devel@blackfin.uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox