Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org,  jimw@sifive.com,  palmer@sifive.com,
	 jhb@FreeBSD.org
Subject: Re: [PATCH] gdb/riscv: Add target description support
Date: Fri, 22 Feb 2019 17:42:00 -0000	[thread overview]
Message-ID: <87r2bz67ol.fsf@tromey.com> (raw)
In-Reply-To: <20181114145756.GM16539@embecosm.com> (Andrew Burgess's message	of "Wed, 14 Nov 2018 14:57:57 +0000")

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> This is a slightly revised version of the RISC-V target descriptions
Andrew> patch.

I'm seeing a difference that I think was introduced by this patch and I
am wondering whether it is intentional and whether something ought to be
done about it.  I'm really not sure, this is my first foray into RISC-V
and into target descriptions.

With an older gdb (8.2), with remote debugging enabled:

    (gdb) p $fflags
    Sending packet: $p42#d6...Ack
    Packet received: 0000000000000000
    $1 = 0

Here you can see that gdb thinks the register number for fflags is 0x42.
And, that is the value of RISCV_CSR_FFLAGS_REGNUM, even in today's gdb
master:

    (top-gdb) p/x RISCV_CSR_FFLAGS_REGNUM
    $1 = 0x42

However with a newer gdb, with an older qemu, I get a failure:

    Sending packet: $p41#d5...Ack
    Packet received: E14
    Could not fetch register "fflags"; remote failure reply 'E14'

Here you can see gdb is sending 0x41.

RISCV_CSR_FFLAGS_REGNUM is computed by:

    RISCV_LAST_FP_REGNUM = 64,	/* Last Floating Point Register */
    RISCV_FIRST_CSR_REGNUM = 65,  /* First CSR */
    [...]
    #define DECLARE_CSR(name, num) \
      RISCV_ ## num ## _REGNUM = RISCV_FIRST_CSR_REGNUM + num,

Then from riscv-opc.h:

    #define CSR_FFLAGS 0x1
    [...]
    DECLARE_CSR(fflags, CSR_FFLAGS)

So, in effect it is RISCV_LAST_FP_REGNUM + 2.


But then, e.g., in the 32-bit FPU description:

Andrew> +static int
Andrew> +create_feature_riscv_32bit_fpu (struct target_desc *result, long regnum)
Andrew> +{
[...]
Andrew> +  tdesc_create_reg (feature, "ft11", regnum++, 1, NULL, 32, "ieee_single");
Andrew> +  tdesc_create_reg (feature, "fflags", regnum++, 1, NULL, 32, "int");

I think this is where the discrepancy lies.


I'm not really sure what ought to be done here.  Do you have any ideas?

thanks,
Tom


  parent reply	other threads:[~2019-02-22 17:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 16:08 [RFC] " Andrew Burgess
2018-11-08 18:33 ` John Baldwin
2018-11-08 19:32   ` Palmer Dabbelt
2018-11-08 19:41     ` John Baldwin
2018-11-14 14:29   ` Andrew Burgess
2018-11-14 17:42     ` John Baldwin
2018-11-08 21:57 ` Jim Wilson
2018-11-13 15:05   ` Andrew Burgess
2018-11-13 20:08 ` Pedro Alves
2018-11-14 14:58 ` [PATCH] " Andrew Burgess
2018-11-19  3:51   ` Jim Wilson
2018-11-21 11:23     ` Andrew Burgess
2018-11-21 12:37       ` Eli Zaretskii
2018-11-21 13:19         ` Andrew Burgess
2019-02-22 17:42   ` Tom Tromey [this message]
2019-02-22 19:24     ` Jim Wilson
2019-02-23 20:51       ` Andrew Burgess
2019-02-24  6:21         ` Jim Wilson
2019-02-26  5:02           ` Joel Brobecker
2019-02-26 17:26             ` Jim Wilson
2019-02-26 18:22               ` Andrew Burgess
2019-02-26 18:40                 ` Jim Wilson
2019-02-26 19:27                   ` Jim Wilson
2019-02-26 20:30                     ` Andrew Burgess
2019-02-23 20:40     ` Andrew Burgess
2019-02-26 11:55       ` Joel Brobecker
2019-03-04 16:18       ` Tom Tromey

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=87r2bz67ol.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=jimw@sifive.com \
    --cc=palmer@sifive.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