Re: gdb XML type for SME ZA storage

Luis via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 13/09/2025 20:02, Luis wrote:
> The documentation is probably off here, as the intention was to have a 
> 2-dimensional array of bytes.
> 
> Let me confirm that and then I can fix the documentation.
> 

So ZA is really a 2d array of bytes, so a vector of vector of bytes.

Here's the XML gdb outputs for sme and sme2:

   <feature name="org.gnu.gdb.aarch64.sme">
     <flags id="svcr_flags" size="8">
       <field name="SM" start="0" end="0" type="bool"/>
       <field name="ZA" start="1" end="1" type="bool"/>
     </flags>
     <vector id="sme_bv" type="uint8" count="32"/>
     <vector id="sme_bvv" type="sme_bv" count="32"/>
     <reg name="svg" bitsize="64" type="int" regnum="91"/>
     <reg name="svcr" bitsize="64" type="svcr_flags" regnum="92"/>
     <reg name="za" bitsize="8192" type="sme_bvv" regnum="93"/>
   </feature>
   <feature name="org.gnu.gdb.aarch64.sme2">
     <vector id="sme2_bv" type="uint8" count="64"/>
     <reg name="zt0" bitsize="512" type="sme2_bv" regnum="94"/>
   </feature>

> On Thu, Sep 11, 2025, 18:28 Peter Maydell <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     Hi; in implementing the QEMU gdbstub handling for SME registers,
>     we're not sure about the right type for the ZA storage. The docs say
> 
>     https://sourceware.org/gdb/current/onlinedocs/gdb.html/AArch64-
>     Features.html#AArch64-SME-registers-feature <https://sourceware.org/
>     gdb/current/onlinedocs/gdb.html/AArch64-Features.html#AArch64-SME-
>     registers-feature>
> 
>     "- ZA is a register represented by a vector of svlxsvl bytes."
> 
>     but the code does this:
> 
>        /* Byte type.  */
>        element_type = tdesc_named_type (feature, "uint8");
>        /* Vector of bytes.  */
>        element_type = tdesc_create_vector (feature, "sme_bv", element_type,
>                                            svl);
>        /* Vector of vector of bytes (Matrix).  */
>        element_type = tdesc_create_vector (feature, "sme_bvv", element_type,
>                                            svl);
> 
>        /* The following is the ZA register set.  */
>        tdesc_create_reg (feature, "za", regnum++, 1, nullptr,
>                          std::pow (svl, 2) * 8, "sme_bvv");
> 
>     which looks like it sets up the XML as a vector of a vector of bytes,
>     rather than a simple vector of bytes. (I did want to try to run
>     gdbserver to dump the actual XML it outputs, but wasn't able to
>     get a working setup for that.)
> 
>     Are the docs wrong, or the code, or are "vector of N*N bytes" and
>     "vector of N vectors of N bytes" the same type as far as GDB is
>     concerned, such that it doesn't matter which one the stub reports
>     in the XML ?
> 
>     thanks
>     -- PMM
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.