Skip to contentSkip to conversation

target/ppc: Add PIR to ppc_cpu_dump_state() for debug print out

PATCH In review BALATON Zoltan 2 participants 2 messages Mar 16, 2025 – Mar 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: Add PIR to ppc_cpu_dump_state() for debug print out

Some CPU variants have a Processor Identification Register which was not printed in register dump. Add it to ppc_cpu_dump_state() which is used by debug options to print CPU register values.

---
 target/ppc/cpu_init.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
target/ppc/cpu_init.c +8 -3
index 8b590e7f17..b1f32662ed 100644
@@ -7606,9 +7606,14 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     int i;
 
     qemu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
-                 TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
-                 env->nip, env->lr, env->ctr, cpu_read_xer(env),
-                 cs->cpu_index);
+                 TARGET_FMT_lx " XER " TARGET_FMT_lx,
+                 env->nip, env->lr, env->ctr, cpu_read_xer(env));
+    if (env->spr_cb[SPR_PIR].name) {
+        qemu_fprintf(f, " PIR " TARGET_FMT_lx, env->spr[SPR_PIR]);
+    } else if (env->spr_cb[SPR_BOOKE_PIR].name) {
+        qemu_fprintf(f, " PIR " TARGET_FMT_lx, env->spr[SPR_BOOKE_PIR]);
+    }
+    qemu_fprintf(f, " CPU#%d\n", cs->cpu_index);
     qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
                  "%08x iidx %d didx %d\n",
                  env->msr, env->spr[SPR_HID0], env->hflags,
Signature · 1 line
2.41.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · BALATON Zoltan

Some CPU variants have a Processor Identification Register which was not printed in register dump. Add it to ppc_cpu_dump_state() which is used by debug options to print CPU register values.

Looks okay. I suppose it's not worth a ppc_cpu_get_pir() type function to get it...

Thanks,
Nick

Quoted 26 lines
---
 target/ppc/cpu_init.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
target/ppc/cpu_init.c +8 -3
index 8b590e7f17..b1f32662ed 100644
@@ -7606,9 +7606,14 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     int i;
 
     qemu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
-                 TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
-                 env->nip, env->lr, env->ctr, cpu_read_xer(env),
-                 cs->cpu_index);
+                 TARGET_FMT_lx " XER " TARGET_FMT_lx,
+                 env->nip, env->lr, env->ctr, cpu_read_xer(env));
+    if (env->spr_cb[SPR_PIR].name) {
+        qemu_fprintf(f, " PIR " TARGET_FMT_lx, env->spr[SPR_PIR]);
+    } else if (env->spr_cb[SPR_BOOKE_PIR].name) {
+        qemu_fprintf(f, " PIR " TARGET_FMT_lx, env->spr[SPR_BOOKE_PIR]);
+    }
+    qemu_fprintf(f, " CPU#%d\n", cs->cpu_index);
     qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
                  "%08x iidx %d didx %d\n",
                  env->msr, env->spr[SPR_HID0], env->hflags,