Commit 077fc2061e254422c44b2de16c526476398113ae

Authored by j_mayer
1 parent 74e91155

Improve PowerPC CPU state dump.

Dump NIP on SPR access faults.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3522 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 25 additions and 23 deletions
target-ppc/translate.c
... ... @@ -3556,20 +3556,22 @@ static always_inline void gen_op_mfspr (DisasContext *ctx)
3556 3556 */
3557 3557 if (sprn != SPR_PVR) {
3558 3558 if (loglevel != 0) {
3559   - fprintf(logfile, "Trying to read privileged spr %d %03x\n",
3560   - sprn, sprn);
  3559 + fprintf(logfile, "Trying to read privileged spr %d %03x at"
  3560 + ADDRX "\n", sprn, sprn, ctx->nip);
3561 3561 }
3562   - printf("Trying to read privileged spr %d %03x\n", sprn, sprn);
  3562 + printf("Trying to read privileged spr %d %03x at " ADDRX "\n",
  3563 + sprn, sprn, ctx->nip);
3563 3564 }
3564 3565 GEN_EXCP_PRIVREG(ctx);
3565 3566 }
3566 3567 } else {
3567 3568 /* Not defined */
3568 3569 if (loglevel != 0) {
3569   - fprintf(logfile, "Trying to read invalid spr %d %03x\n",
3570   - sprn, sprn);
  3570 + fprintf(logfile, "Trying to read invalid spr %d %03x at "
  3571 + ADDRX "\n", sprn, sprn, ctx->nip);
3571 3572 }
3572   - printf("Trying to read invalid spr %d %03x\n", sprn, sprn);
  3573 + printf("Trying to read invalid spr %d %03x at " ADDRX "\n",
  3574 + sprn, sprn, ctx->nip);
3573 3575 GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
3574 3576 POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
3575 3577 }
... ... @@ -3689,19 +3691,21 @@ GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
3689 3691 } else {
3690 3692 /* Privilege exception */
3691 3693 if (loglevel != 0) {
3692   - fprintf(logfile, "Trying to write privileged spr %d %03x\n",
3693   - sprn, sprn);
  3694 + fprintf(logfile, "Trying to write privileged spr %d %03x at "
  3695 + ADDRX "\n", sprn, sprn, ctx->nip);
3694 3696 }
3695   - printf("Trying to write privileged spr %d %03x\n", sprn, sprn);
  3697 + printf("Trying to write privileged spr %d %03x at " ADDRX "\n",
  3698 + sprn, sprn, ctx->nip);
3696 3699 GEN_EXCP_PRIVREG(ctx);
3697 3700 }
3698 3701 } else {
3699 3702 /* Not defined */
3700 3703 if (loglevel != 0) {
3701   - fprintf(logfile, "Trying to write invalid spr %d %03x\n",
3702   - sprn, sprn);
  3704 + fprintf(logfile, "Trying to write invalid spr %d %03x at "
  3705 + ADDRX "\n", sprn, sprn, ctx->nip);
3703 3706 }
3704   - printf("Trying to write invalid spr %d %03x\n", sprn, sprn);
  3707 + printf("Trying to write invalid spr %d %03x at " ADDRX "\n",
  3708 + sprn, sprn, ctx->nip);
3705 3709 GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
3706 3710 POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
3707 3711 }
... ... @@ -6685,24 +6689,23 @@ void cpu_dump_state (CPUState *env, FILE *f,
6685 6689  
6686 6690 int i;
6687 6691  
6688   - cpu_fprintf(f, "NIP " ADDRX " LR " ADDRX " CTR " ADDRX " idx %d\n",
6689   - env->nip, env->lr, env->ctr, env->mmu_idx);
6690   - cpu_fprintf(f, "MSR " REGX FILL " XER %08x "
  6692 + cpu_fprintf(f, "NIP " ADDRX " LR " ADDRX " CTR " ADDRX " XER %08x\n",
  6693 + env->nip, env->lr, env->ctr, hreg_load_xer(env));
  6694 + cpu_fprintf(f, "MSR " REGX FILL " HID0 " REGX FILL " HF " REGX FILL
  6695 + " idx %d\n",
  6696 + env->msr, env->hflags, env->spr[SPR_HID0], env->mmu_idx);
6691 6697 #if !defined(NO_TIMER_DUMP)
6692   - "TB %08x %08x "
  6698 + cpu_fprintf(f, "TB %08x %08x "
6693 6699 #if !defined(CONFIG_USER_ONLY)
6694 6700 "DECR %08x"
6695 6701 #endif
6696   -#endif
6697 6702 "\n",
6698   - env->msr, hreg_load_xer(env)
6699   -#if !defined(NO_TIMER_DUMP)
6700   - , cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
  6703 + cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
6701 6704 #if !defined(CONFIG_USER_ONLY)
6702 6705 , cpu_ppc_load_decr(env)
6703 6706 #endif
6704   -#endif
6705 6707 );
  6708 +#endif
6706 6709 for (i = 0; i < 32; i++) {
6707 6710 if ((i & (RGPL - 1)) == 0)
6708 6711 cpu_fprintf(f, "GPR%02d", i);
... ... @@ -6733,8 +6736,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
6733 6736 cpu_fprintf(f, "\n");
6734 6737 }
6735 6738 #if !defined(CONFIG_USER_ONLY)
6736   - cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL
6737   - "SDR1 " REGX "\n",
  6739 + cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " SDR1 " REGX "\n",
6738 6740 env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1);
6739 6741 #endif
6740 6742  
... ...