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
This commit is contained in:
j_mayer 2007-11-04 01:57:29 +00:00
parent 74e9115560
commit 077fc2061e

View File

@ -3556,20 +3556,22 @@ static always_inline void gen_op_mfspr (DisasContext *ctx)
*/ */
if (sprn != SPR_PVR) { if (sprn != SPR_PVR) {
if (loglevel != 0) { if (loglevel != 0) {
fprintf(logfile, "Trying to read privileged spr %d %03x\n", fprintf(logfile, "Trying to read privileged spr %d %03x at"
sprn, sprn); ADDRX "\n", sprn, sprn, ctx->nip);
} }
printf("Trying to read privileged spr %d %03x\n", sprn, sprn); printf("Trying to read privileged spr %d %03x at " ADDRX "\n",
sprn, sprn, ctx->nip);
} }
GEN_EXCP_PRIVREG(ctx); GEN_EXCP_PRIVREG(ctx);
} }
} else { } else {
/* Not defined */ /* Not defined */
if (loglevel != 0) { if (loglevel != 0) {
fprintf(logfile, "Trying to read invalid spr %d %03x\n", fprintf(logfile, "Trying to read invalid spr %d %03x at "
sprn, sprn); ADDRX "\n", sprn, sprn, ctx->nip);
} }
printf("Trying to read invalid spr %d %03x\n", sprn, sprn); printf("Trying to read invalid spr %d %03x at " ADDRX "\n",
sprn, sprn, ctx->nip);
GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM, GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR); POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
} }
@ -3689,19 +3691,21 @@ GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
} else { } else {
/* Privilege exception */ /* Privilege exception */
if (loglevel != 0) { if (loglevel != 0) {
fprintf(logfile, "Trying to write privileged spr %d %03x\n", fprintf(logfile, "Trying to write privileged spr %d %03x at "
sprn, sprn); ADDRX "\n", sprn, sprn, ctx->nip);
} }
printf("Trying to write privileged spr %d %03x\n", sprn, sprn); printf("Trying to write privileged spr %d %03x at " ADDRX "\n",
sprn, sprn, ctx->nip);
GEN_EXCP_PRIVREG(ctx); GEN_EXCP_PRIVREG(ctx);
} }
} else { } else {
/* Not defined */ /* Not defined */
if (loglevel != 0) { if (loglevel != 0) {
fprintf(logfile, "Trying to write invalid spr %d %03x\n", fprintf(logfile, "Trying to write invalid spr %d %03x at "
sprn, sprn); ADDRX "\n", sprn, sprn, ctx->nip);
} }
printf("Trying to write invalid spr %d %03x\n", sprn, sprn); printf("Trying to write invalid spr %d %03x at " ADDRX "\n",
sprn, sprn, ctx->nip);
GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM, GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR); POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
} }
@ -6685,24 +6689,23 @@ void cpu_dump_state (CPUState *env, FILE *f,
int i; int i;
cpu_fprintf(f, "NIP " ADDRX " LR " ADDRX " CTR " ADDRX " idx %d\n", cpu_fprintf(f, "NIP " ADDRX " LR " ADDRX " CTR " ADDRX " XER %08x\n",
env->nip, env->lr, env->ctr, env->mmu_idx); env->nip, env->lr, env->ctr, hreg_load_xer(env));
cpu_fprintf(f, "MSR " REGX FILL " XER %08x " cpu_fprintf(f, "MSR " REGX FILL " HID0 " REGX FILL " HF " REGX FILL
" idx %d\n",
env->msr, env->hflags, env->spr[SPR_HID0], env->mmu_idx);
#if !defined(NO_TIMER_DUMP) #if !defined(NO_TIMER_DUMP)
"TB %08x %08x " cpu_fprintf(f, "TB %08x %08x "
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
"DECR %08x" "DECR %08x"
#endif
#endif #endif
"\n", "\n",
env->msr, hreg_load_xer(env) cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
#if !defined(NO_TIMER_DUMP)
, cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
, cpu_ppc_load_decr(env) , cpu_ppc_load_decr(env)
#endif
#endif #endif
); );
#endif
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if ((i & (RGPL - 1)) == 0) if ((i & (RGPL - 1)) == 0)
cpu_fprintf(f, "GPR%02d", i); cpu_fprintf(f, "GPR%02d", i);
@ -6733,8 +6736,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
cpu_fprintf(f, "\n"); cpu_fprintf(f, "\n");
} }
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " SDR1 " REGX "\n",
"SDR1 " REGX "\n",
env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1); env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1);
#endif #endif