Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: gdb-patches@sourceware.org
Cc: "Maciej W. Rozycki" <macro@imgtec.com>
Subject: Re: [PATCH] Look for FIR in the last FreeBSD/mips floating-point register.
Date: Mon, 12 Jun 2017 18:47:00 -0000	[thread overview]
Message-ID: <1648023.dfXdf8hDrr@ralph.baldwin.cx> (raw)
In-Reply-To: <alpine.DEB.2.00.1706080744320.21750@tp.orcam.me.uk>

On Thursday, June 08, 2017 08:15:39 AM Maciej W. Rozycki wrote:
> On Wed, 31 May 2017, John Baldwin wrote:
> 
> > FreeBSD/mips kernels were recently changed to include the floating
> > point implementation revision register in the floating point register
> > set exported in process cores and via ptrace() (r318067).  This change
> > will first ship in FreeBSD 12.0 when it is eventually released.  The
> > space used to hold FIR was previously reserved in 'struct fpreg' as a
> > zero-filled dummy for padding, so 'struct fpreg' has not changed in
> > size.  On the one hand this means that there is not an easy way to detect
> > if if the FIR register is the zero-filled dummy or the true FIR value.
> 
>  Well, CP1.FIR is generally expected to hold non zero; in particular in 
> legacy MIPS processors (before CP0.Config1.FP was defined) checking for a 
> non-zero value in CP1.FIR (bits 15:8 specifically) was the recommended way 
> to detect the presence of FPU hardware[1].  And from MIPSr1 on there have 
> to be floating-point formats supported reported in CP1.FIR, with D and S 
> being mandatory, so you'll see non-zero bits at least in their positions 
> (the W bit was only added with MIPSr2).

Ah, I had been going off of my (probably stale) copy of See Mips Run which
only talks about comparing FIR with 0.  FreeBSD requires MIPSr3, so it should
always see a non-zero FIR then.

> > However, it also means that there is no need to deal with multiple
> > layouts of 'struct fpreg'.  I've chosen to always treat the last register
> > in 'struct fpreg' as the FIR.  This means that process cores and
> > ptrace() on older kernels will report a FIR value of 0.  However, FreeBSD
> > doesn't currently ship a release image for FreeBSD/mips, and releases
> > prior to 12.0 assume soft-float, so I think this is a reasonable tradeoff
> > for simplicity.
> 
>  You could also exclude a zero CP1.FIR from the view at the GDB side, 
> pretty much how e.g. support for the optional DSP registers has been 
> implemented.  As noted above the setting of zero bears no value anyway.

It ends up being a one-line change to just exclude a zero FIR, so I can do that.

-- 
John Baldwin


  reply	other threads:[~2017-06-12 18:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 16:58 John Baldwin
2017-06-05 20:27 ` Simon Marchi
2017-06-06 17:49   ` John Baldwin
2017-06-08  7:15 ` Maciej W. Rozycki
2017-06-12 18:47   ` John Baldwin [this message]
2017-06-12 20:23     ` Maciej W. Rozycki
2017-06-13 16:43       ` John Baldwin

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=1648023.dfXdf8hDrr@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@imgtec.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