Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: ARM and virtual/raw registers
Date: Sun, 12 May 2002 08:07:00 -0000	[thread overview]
Message-ID: <3CDE8526.5080302@cygnus.com> (raw)
In-Reply-To: <200205121410.PAA28889@cam-mail2.cambridge.arm.com>

> Even consider making everything a pseudo so that you know exactly what 
>> you have at any stage.
>> 
> 
> 
> Hmm, I think this is effectively what I have. See the code below (which is 
> very much a work-in-progress..., so don't even expect it to compile ;-)

Even more ruthless.  Try a register layout of:

--
raw normal r0..r15
raw someothers
raw floats
raw bank r0..r15
raw still more
--
pseudo r0..r15
	mapped onto either normal or banked
pseudo floats
	mapped onto floats
and so on, for instance, explict register names to identify normal and 
banked r0.
--

which completly separates the raw and pseudo registers.  The function 
register_name() becomes:

	if regnum < NUM_REGS
		return "";
	else
		return yourtable[regnum - NUM_REGS];

In an ideal world, I'd be changing register_{read,write} to take a 
``struct pseudoreg *'' and regcache_{read,write} to take a ``struct 
rawreg *''.  That way it would be clear what is going on.  I can but 
dream! I'm still trying to bury registers[] -)

>> > I can make my arm_register_read function correctly remap the register 
>> > numbers, but then I run into the problem that REGISTER_RAW_SIZE is used 
>> > both above and below the regcache.
> 
>> 
>> I don't understand why this is a problem.  I think a register (pseudo or 
>> raw) should have only one size (c.f. my register_size() patch).
> 
> 
>  However, in this situation, 
> pseudo_rengo("r0") != regcache_regno("r0"), yet we effectively have
> 
> REGSITER_RAW_SIZE (pseudo_regno ("r0")) 
> and
> REGISTER_RAW_SIZE (regcache_regno ("r0"))

Sorry, I still don't understand.  Given pseudo-registers, the name of 
the function ``register_raw_size'' is definitly overloaded.  However, 
per the patch very recently committed, the norm should now be:
register_raw_size() == register_virtual_size() == TYPE_LENGTH 
(register_virtual_type()) (which makes them all badly named :-)

> ! /* We have more registers than the disassembler as gdb can print the
> !    value of special registers as well.  It can also display the
> !    contents of banked registers if these are available from the
> !    inferior.
> ! 
> !    Depending on the architecture, ARM processors have up to 31 integer
> !    registers, but these are banked so that only 16 are visible at any
> !    one time.  The layout of the table is complicated by the fact that
> !    the ordering must match that used by the compiler to generate
> !    stabs/dwarf entries, so we put the banked registers first, even
> !    though we implement some of them as pseudos (mapping onto the
> !    correct bank entry for the current mode).  A debug record entry may
> !    contain:
> ! 
> !    0-15 for the integer registers r0-r15,
> !    16-23 for the FPA registers f0-f7,
> !    32-63 for the VFP registers s0-s31.

This restriction doesn't exist.

Your architecture has complete control over how debug register numbers 
are represented internally.  For instance, STABS_REG_TO_REGNUM() can be 
used to completly map the above numbers onto pseudo-registers.

Again, in an ideal world, I'd try to change these functions to return a 
``struct pseudoreg *''.  That would make it clear which side of the 
fence they sit on :-)

> !    Which leaves a gap of 8 registers in the numbering space: we put
> !    the cpsr, spsr (x5), fpsr and fpcr registers in this space, though
> !    not all of these will always be available.  None of these registers
> !    will have debug table entries. [XXX-rwe 20020511 At least, I don't
> !    think so].
> ! 
> !    The general register names are overwritten by whatever is being
> !    used by the disassembler at the moment.  We also adjust the case of
> !    cpsr and fps.  
> ! 
> !    Note, the ordering of registers in the regcache is entirely
> !    different, since we don't want the pseudo registers in that.  The
> !    mapping tables follow.  */

(I think I remember what you wanted me to document ....)

enjoy,
Andrew



  parent reply	other threads:[~2002-05-12 15:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09  7:31 Richard Earnshaw
2002-05-09  9:45 ` Andrew Cagney
2002-05-09 10:01   ` Richard Earnshaw
2002-05-09 11:52     ` Andrew Cagney
2002-05-10  3:45       ` Richard Earnshaw
2002-05-10  7:48         ` Andrew Cagney
2002-05-10 12:07           ` Andrew Cagney
2002-05-11  7:05             ` Richard Earnshaw
2002-05-11 14:52               ` Andrew Cagney
2002-05-12  7:20                 ` Richard Earnshaw
2002-05-12  8:25                   ` Andrew Cagney
2002-05-12  8:30                     ` Richard Earnshaw
2002-05-12  8:51                       ` Andrew Cagney
2002-05-10  9:29       ` Richard Earnshaw
2002-05-10 11:42         ` Andrew Cagney
2002-05-11  6:16           ` Richard Earnshaw
2002-05-11 11:41           ` Richard Earnshaw
2002-05-11 13:36             ` Andrew Cagney
2002-05-12  7:11               ` Richard Earnshaw
2002-05-12  7:40                 ` Richard Earnshaw
2002-05-12  9:03                   ` Andrew Cagney
2002-05-12 11:31                     ` Andrew Cagney
2002-05-12  8:07                 ` Andrew Cagney [this message]
2002-05-12  8:25                   ` Richard Earnshaw
2002-05-12  8:41                     ` Andrew Cagney
2002-05-13  5:35                   ` Richard Earnshaw
2002-05-13  6:13                     ` Andrew Cagney
2002-05-13  6:18                       ` Richard Earnshaw
2002-05-09 10:08 ` Andrew Cagney
2002-05-09 10:36   ` Richard Earnshaw

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=3CDE8526.5080302@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.redhat.com \
    /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