From: "Maciej W. Rozycki" <macro@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: Bhushan Attarde <bhushan.attarde@imgtec.com>,
<gdb-patches@sourceware.org>,
Matthew Fortune <Matthew.Fortune@imgtec.com>,
Andrew Bennett <Andrew.Bennett@imgtec.com>,
Jaydeep Patil <Jaydeep.Patil@imgtec.com>,
<linux-mips@linux-mips.org>
Subject: Re: [PATCH 02/24] Add MIPS32 FPU64 GDB target descriptions
Date: Wed, 12 Oct 2016 22:04:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.00.1610122217350.31859@tp.orcam.me.uk> (raw)
In-Reply-To: <20161012180531.GV19354@jhogan-linux.le.imgtec.org>
On Wed, 12 Oct 2016, James Hogan wrote:
> > Then I think it makes sense even more not to create this artificial API
> > and use the CP1C.FRE/CP1C.NFRE registers instead which do correspond to
> > what hardware presents to user software.
>
> well, barely. Linux at least doesn't enable Config5.UFE or Config5.UFR,
> since FP mode changes must be done for all threads in the process, so
> userland can't actually directly access those FCRs either.
Hmm, I didn't know that -- what was the reason for this design decision?
Offhand the limitation does not appear necessary to me, each thread has
its own distinct register set, so it does not appear to me that its mode
of operation has to be the same across them all. The current setting
would still of course be inherited from the parent by any new threads
created with clone(2).
Anyway in that case the presented CP1C registers will have to be
read-only.
> > I don't think there is any value in it for GDB, I think all 64-bit FP
> > registers ought to remain being presented as doubles and pairs of singles
> > regardless of the mode selected (and also possibly fixed-point longs and
> > pairs of fixed-point words). We don't know what's emulated and what's not
> > after all, and then the contents of FPRs are not interpreted by GDB itself
> > anyhow except in user-supplied expressions or assignment requests, which
> > for users' convenience I think should retain the maximum flexibility
> > possible.
>
> Well it technically depends on
> test_tsk_thread_flag(target, TIF_HYBRID_FPREGS)
Sure, but the hardware representation is CP0.Config5.FRE/CP1C.FRE.
> So it allows gdb to detect Linux's Hybrid FPU mode, and present the fp
> regs (e.g. f0 or f1) more like below to the user depending on the fp
> mode, which is surely much more intuitive from an assembly debugging
> point of view.
>
> Its also worth noting that "When software changes the value of this bit
> [Status.FR], the contents of the floating-point registers are
> UNPREDICTABLE". I.e. there is no architectural unifying register layout
> between FR=0 / FR=1, only convention. Linux will I presume intentionally
> save in old mode and restore in new mode on an fp mode change according
> to its own convention (such that the valid mode changes don't clobber
> register state).
Well the contents might be unpredictable, but there sure will be some and
GDB is supposed to present it.
> (disclaimer: I haven't looked at this gdb patchset in detail as to
> whether any of below has changed since I worked on it).
>
> (1) Even singles and doubles always overlap one another, as do odd
> singles and doubles when FR=1 (and FRE=0):
> /* (little endian) */
> union __gdb_builtin_mips_fp64 {
> float f32;
> double f64;
> int32 i32;
> int64 i64;
> };
>
> (2) Odd singles when FR=0 (there are no odd doubles):
> union __gdb_builtin_mips_fp32 {
> float f32;
> int32_t i32;
> };
>
> (3) Odd singles and doubles when FR=1, FRE=1 don't overlap at all:
> struct __gdb_builtin_mips_fp96 {
> union {
> double f64;
> int64 i64;
> };
> union {
> float f32;
> int32 i32;
> };
> };
>
> i.e.
>
> FR=0:
> (1) even
> double: FEDCBA9876543210
> single: 76543210
> (2) odd
> single: FEDCBA98
>
> FR=1, FRE=0:
> (1) even
> double: FEDCBA9876543210
> single: 76543210
> (1) odd
> double: 0123456789ABCDEF
> single: 89ABCDEF
>
> FR=1, FRE=1:
> (1) even
> double: FEDCBA9876543210
> single: 76543210 (Hybrid FPR emulation)
> (3) odd
> double: 0123456789ABCDEF
> single: FEDCBA98 (Hybrid FPR emulation)
> )
I haven't got to this part so far and either way will have to think about
it yet. For one as I noted we do want to present vector (paired-single)
data with FR=1, FRE=0 in addition to what you quoted above. This was all
implemented in an old MIPS UK patch originally written by Nigel Stephens
and included with SDE, which I've never got to upstreaming; have you by
any chance based your work on that?
As to FR=1, FRE=1 your quoted representation of singles is a software
convention only, so I'm not sure offhand how we might represent it in GDB
to keep it reasonable; the 96-bit cooked FP register structure does not
appeal to me at all TBH, but maybe it's the best we can do after all.
Maciej
next prev parent reply other threads:[~2016-10-12 22:04 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 14:50 [PATCH 01/24] MIPS: Handle run-time reconfigurable FPR size Bhushan Attarde
2016-06-27 14:50 ` [PATCH 06/24] mips-linux-nat: pick fp64 target description when appropriate Bhushan Attarde
2016-06-27 14:50 ` [PATCH 11/24] MIPS: Add support for hybrid fp32/fp64 mode Bhushan Attarde
2016-06-27 14:50 ` [PATCH 08/24] MIPS: Convert FP mode to enum and put fp registers into fp reggroup Bhushan Attarde
2016-06-27 14:50 ` [PATCH 10/24] MIPS: override fscr/fir types and print control registers specially Bhushan Attarde
2016-06-27 14:50 ` [PATCH 03/24] regcache: handle invalidated regcache Bhushan Attarde
2016-10-21 22:42 ` Maciej W. Rozycki
2016-06-27 14:51 ` [PATCH 12/24] o32 sigframe unwinding with FR1 Bhushan Attarde
2016-06-27 14:51 ` [PATCH 05/24] MIPS: Add config5 to MIPS GDB target descriptions Bhushan Attarde
2016-06-27 14:51 ` [PATCH 24/24] MIPS R6 forbidden slot support Bhushan Attarde
2016-06-27 14:51 ` [PATCH 22/24] Support all new ABIs when detecting if an FPU is present Bhushan Attarde
2016-06-27 14:51 ` [PATCH 19/24] Add MIPS MSA vector branch instruction support Bhushan Attarde
2016-06-27 14:51 ` [PATCH 09/24] MIPS: Enhance cooked FP format Bhushan Attarde
2016-06-27 14:51 ` [PATCH 14/24] Implement core MSA stuff Bhushan Attarde
2016-06-27 14:51 ` [PATCH 20/24] Drop FP and MSA control registers from default info registers Bhushan Attarde
2016-06-27 14:51 ` [PATCH 23/24] MIPS R6 opcode table shuffle for LDC2/SDC2 Bhushan Attarde
2016-06-27 14:51 ` [PATCH 07/24] MIPS: Make Linux restart register more dynamic Bhushan Attarde
2016-06-27 14:51 ` [PATCH 13/24] Add MIPS MSA GDB target descriptions Bhushan Attarde
2016-06-27 14:51 ` [PATCH 18/24] mips-linux-nat: get msa registers Bhushan Attarde
2016-06-27 14:51 ` [PATCH 04/24] Add MIPS Config5 register related support Bhushan Attarde
2016-06-27 14:51 ` [PATCH 02/24] Add MIPS32 FPU64 GDB target descriptions Bhushan Attarde
2016-10-12 12:42 ` Maciej W. Rozycki
2016-10-12 13:58 ` James Hogan
2016-10-12 16:30 ` Maciej W. Rozycki
2016-10-12 18:05 ` James Hogan
2016-10-12 22:04 ` Maciej W. Rozycki [this message]
2016-10-13 10:09 ` Matthew Fortune
2016-10-21 19:17 ` Maciej W. Rozycki
2016-10-21 19:24 ` Maciej W. Rozycki
2016-06-27 14:51 ` [PATCH 21/24] MIPSR6 support for GDB Bhushan Attarde
2016-07-29 21:10 ` Maciej W. Rozycki
2016-07-25 14:03 ` [PATCH 01/24] MIPS: Handle run-time reconfigurable FPR size Maciej W. Rozycki
2016-10-18 17:37 ` Maciej W. Rozycki
2016-11-08 19:46 ` Yao Qi
2016-11-10 12:43 ` Maciej W. Rozycki
2016-11-11 12:29 ` Yao Qi
2016-12-02 2:31 ` Maciej W. Rozycki
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=alpine.DEB.2.00.1610122217350.31859@tp.orcam.me.uk \
--to=macro@imgtec.com \
--cc=Andrew.Bennett@imgtec.com \
--cc=Jaydeep.Patil@imgtec.com \
--cc=Matthew.Fortune@imgtec.com \
--cc=bhushan.attarde@imgtec.com \
--cc=gdb-patches@sourceware.org \
--cc=james.hogan@imgtec.com \
--cc=linux-mips@linux-mips.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