Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@ges.redhat.com>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb@sources.redhat.com
Subject: Re: WIP: Register doco
Date: Sat, 20 Jul 2002 13:41:00 -0000	[thread overview]
Message-ID: <3D39CAD1.3060106@ges.redhat.com> (raw)
In-Reply-To: <np1y9ycmix.fsf@zwingli.cygnus.com>


> The example of the IA-32's MMX and FP registers is a great example for
> this.  The MMX registers, MM0--MM7, and the FP registers,
> ST(0)--ST(7), actually refer to the same set of eight eighty-bit
> registers, R0--R7.  A reference to the floating-point register ST(i)
> becomes a reference to R((TOP + i) % 8), where TOP is a three-bit
> field in the FPU status register.  But a reference to the MMX register
> MM(i) becomes a reference to the lower 64 bits of R(i) (which would be
> the mantissa of some ST(i)).

(In the current code, ST(I) and not R(I) is stored, so we end up with 
MM(I) == regcache(FP0 + (TOP + 1) % 8) :-(   I'm almost ready to dust 
off the patch that does this.)

Anyway, I think the above example highlights why I see it as important 
to use terms like ``hardware'' or even ``physical''.  Those terms drag 
the GDB developer's eye away from those glossy user level ISA specs, and 
instead focuses their attention on the underlying hardware model used to 
implement the userland ISA. While well above the level of flip-flops, it 
is still a clear step below the ISA that a typical native GDB user will 
be aware of.  (A PPC refers to the ``operating environment architecture'').

For the i387, the programmer spec is all about a register stack, yet the 
underlying hardware uses a block of 8 registers and an index.  It is the 
latter, the lower level hardware details, that the GDB developer should 
focus their attention on when deciding the contents of a register cache.

> processors, then there are all sorts of confusing questions that
> brings up --- e.g., "How in the world would GDB get hold of the state
> of the raw flip-flops on a native Linux system?")

Clearly that isn't low level enough!  GDB needs to be getting down to 
the level of quantum effects :-^

There is a bit of irony here mind.  The i386 Linux kernel correctly 
provides a low-level hardware view of the i387 registers (the 8 register 
block and the index).   Current GDB however, by failing to abstract the 
raw register cache at that same low level, has ended up suffering from a 
series of obscure FP vs THREAD related register corruption bugs.

enjoy,
Andrew



  reply	other threads:[~2002-07-20 20:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-19 17:31 Andrew Cagney
2002-07-19 20:11 ` Jim Blandy
2002-07-20 11:39   ` Andrew Cagney
2002-07-20 11:36     ` Jim Blandy
2002-07-20 13:41       ` Andrew Cagney [this message]
2002-07-20 15:26         ` Jim Blandy
2002-07-21  9:41           ` Andrew Cagney
2002-07-21 10:04             ` Daniel Jacobowitz
2002-07-22  9:38               ` Andrew Cagney
2002-07-22 10:30                 ` Daniel Jacobowitz
2002-07-23 16:25             ` Jim Blandy
2002-07-23 17:34               ` Andrew Cagney
2002-07-23 20:45                 ` Jim Blandy
2002-07-24  8:35                   ` Andrew Cagney
2002-07-24 22:08                     ` Jim Blandy
2002-07-25  8:13                       ` Andrew Cagney
2002-07-23 21:17                 ` Jim Blandy
2002-07-24  9:09                   ` Andrew Cagney
2002-07-24 22:03                     ` Jim Blandy
2002-07-25  8:11                       ` Andrew Cagney
2002-07-22 14:39         ` Mark Kettenis
2002-07-22 14:41         ` Mark Kettenis

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=3D39CAD1.3060106@ges.redhat.com \
    --to=ac131313@ges.redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=jimb@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