On Fri, Aug 1, 2025 at 7:25 AM Richard Henderson <richard.hender...@linaro.org> wrote: > > On 8/1/25 05:13, Pierrick Bouvier wrote: > > On 7/27/25 1:02 AM, Richard Henderson wrote: > >> The ARM now defines 36 bits in SPSR_ELx in aarch64 mode, so > >> it's time to bite the bullet and extend PSTATE to match. > >> > >> Most changes are straightforward, adjusting printf formats, > >> changing local variable types. More complex is migration, > >> where to maintain backward compatibility a new pstate64 > >> record is introduced, and only when one of the extensions > >> that sets bits 32-35 are active. > >> > >> The fate of gdbstub is left undecided for the moment. > ... > >> diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c > >> index 64ee9b3b56..3cef47281a 100644 > >> --- a/target/arm/gdbstub64.c > >> +++ b/target/arm/gdbstub64.c > >> @@ -47,6 +47,7 @@ int aarch64_cpu_gdb_read_register(CPUState *cs, > >> GByteArray *mem_buf, > >> int n) > >> case 32: > >> return gdb_get_reg64(mem_buf, env->pc); > >> case 33: > >> + /* pstate is now a 64-bit value; can we simply adjust the xml? */ > >> return gdb_get_reg32(mem_buf, pstate_read(env)); > >> } > > > > If I'm correct, we currently don't expose PSTATE through gdbstub, but only > > CPSR. This was > > a bit confusing for me, considering that CPSR is not even supposed to exist > > in Aarch64. > > Correct. An old error, for sure. > > > > Maybe it's a good opportunity to expose PSTATE instead, which could have a > > 64 bits size. > > This way, we don't break any workflow. > > Hmm, perhaps adding a "org.gnu.gdb.aarch64.pstate" xml with just one 64-bit > value is the > best solution. Thiago?
A single line in gdb-xml/aarch64-core.xml should be enough: <reg name="PSTATE" bitsize="64" /> I'd keep cpsr even if it's now effectively duplicated. It comes from gdb's upstream aarch64 schema so it's deeply ingrained by now. Then you can do `info registers $PSTATE` in gdb after adding the reg getter in gdbstub. I think it could be possible to define a <flags id="pstate_flags" size="8"> ... </flags> type that re-uses the cpsr_flags type definition by setting a field <field start="0" end="31" type = "cpsr_flags" /> but I haven't tried it. > > > r~ >