public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 4/6] [gdb/aarch64] sme2: Core file support for ZT register set
Date: Wed, 30 Aug 2023 13:56:02 +0100	[thread overview]
Message-ID: <bc143332-efb0-d4e4-9e0d-d65463fe5fbf@arm.com> (raw)
In-Reply-To: <87bketl1oo.fsf@linaro.org>

On 8/27/23 02:21, Thiago Jung Bauermann wrote:
> 
> Luis Machado <luis.machado@arm.com> writes:
> 
>> This patch adds support for ZT register dumps/reads for core files.  The
>> ZT register is available when the SME2 feature is advertised as available
>> by the Linux Kernel.
>>
>> Unlike the enablement for SME1 and the ZA register, support for SME2 is rather
>> simple given the fixed size of the ZT0 register.
>>
>> Validated on the Fast Models.
>> ---
>>  gdb/aarch64-linux-tdep.c | 81 ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 81 insertions(+)
>>
>> diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
>> index 8b0b4d32971..a4d1fb87cbf 100644
>> --- a/gdb/aarch64-linux-tdep.c
>> +++ b/gdb/aarch64-linux-tdep.c
>> @@ -1374,6 +1374,50 @@ aarch64_linux_collect_za_regset (const struct regset *regset,
>>  			    size - SVE_HEADER_SIZE);
>>  }
>>  
>> +/* Supply register REGNUM from BUF to REGCACHE, using the register map
>> +   in REGSET.  If REGNUM is -1, do this for all registers in REGSET.
>> +   If BUF is NULL, set the registers to "unavailable" status.  */
>> +
>> +static void
>> +aarch64_linux_supply_zt_regset (const struct regset *regset,
>> +				struct regcache *regcache,
>> +				int regnum, const void *buf, size_t size)
>> +{
>> +  /* Read the ZT register note from a core file into the register buffer.  */
>> +
>> +  /* Handle an empty buffer.  */
>> +  if (buf == nullptr)
>> +    return regcache->supply_regset (regset, regnum, nullptr, size);
>> +
>> +  aarch64_gdbarch_tdep *tdep
>> +    = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
> 
> Is it worth adding here a "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"?
> 

Yes. That makes sense.

>> +
>> +  /* Supply the ZT0 register contents.  */
>> +  regcache->raw_supply (tdep->sme2_zt0_regnum, buf);
>> +}
>> +
>> +/* Collect register REGNUM from REGCACHE to BUF, using the register
>> +   map in REGSET.  If REGNUM is -1, do this for all registers in
>> +   REGSET.  */
>> +
>> +static void
>> +aarch64_linux_collect_zt_regset (const struct regset *regset,
>> +				 const struct regcache *regcache,
>> +				 int regnum, void *buf, size_t size)
>> +{
>> +  /* Read the ZT register contents from the register buffer into the core
>> +     file section.  */
>> +
>> +  gdb_assert (buf != nullptr);
> 
> Also here, is it worth adding a
> "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"?
> 

Fixed as well.

>> +
>> +  aarch64_gdbarch_tdep *tdep
>> +    = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
>> +
>> +  /* Dump the register cache contents for the ZT register to the buffer.  */
>> +  regcache->collect_regset (regset, tdep->sme2_zt0_regnum, buf,
>> +			    AARCH64_SME2_ZT0_SIZE);
>> +}
>> +
> 
> Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
> 


  reply	other threads:[~2023-08-30 12:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 11:21 [PATCH v2 0/6] SME2 support for AArch64 gdb/gdbserver on Linux Luis Machado
2023-08-22 11:21 ` [PATCH v2 1/6] [gdb/aarch64] sme2: Enable SME2 for AArch64 gdb " Luis Machado
2023-08-27  1:16   ` Thiago Jung Bauermann
2023-08-30 12:53     ` Luis Machado
2023-08-22 11:21 ` [PATCH v2 2/6] [gdbserver/aarch64] sme2: Enable SME2 support in gdbserver Luis Machado
2023-08-27  1:18   ` Thiago Jung Bauermann
2023-08-30 12:54     ` Luis Machado
2023-08-22 11:21 ` [PATCH v2 3/6] [gdb/aarch64] sme2: signal frame support Luis Machado
2023-08-27  1:19   ` Thiago Jung Bauermann
2023-08-22 11:21 ` [PATCH v2 4/6] [gdb/aarch64] sme2: Core file support for ZT register set Luis Machado
2023-08-27  1:21   ` Thiago Jung Bauermann
2023-08-30 12:56     ` Luis Machado [this message]
2023-08-22 11:21 ` [PATCH v2 5/6] [gdb/testsuite] sme2: Extend SME tests to include SME2 Luis Machado
2023-08-27  1:23   ` Thiago Jung Bauermann
2023-08-30 12:56     ` Luis Machado
2023-08-22 11:21 ` [PATCH v2 6/6] [gdb/docs] sme2: Document SME2 registers and features Luis Machado
2023-08-22 11:34   ` Eli Zaretskii
2023-08-22 11:45     ` Luis Machado
2023-08-27  1:27   ` Thiago Jung Bauermann

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=bc143332-efb0-d4e4-9e0d-d65463fe5fbf@arm.com \
    --to=luis.machado@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).