Skip to content

Commit

Permalink
ppc: Do not take exceptions on unknown SPRs in privileged mode
Browse files Browse the repository at this point in the history
The architecture specifies that mtspr/mfspr on an unknown SPR number
should act as a nop in privileged mode.

I haven't removed the warning however as it can be useful for
diagnosing.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
ozbenh authored and dgibson committed Jun 7, 2016
1 parent c76c22d commit 4d6a068
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions target-ppc/translate.c
Expand Up @@ -4351,7 +4351,10 @@ static inline void gen_op_mfspr(DisasContext *ctx)
qemu_log("Trying to read invalid spr %d (0x%03x) at "
TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4);
}
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR);
/* Only generate an exception in user space, otherwise this is a nop */
if (ctx->pr) {
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR);
}
}
}

Expand Down Expand Up @@ -4503,7 +4506,11 @@ static void gen_mtspr(DisasContext *ctx)
}
fprintf(stderr, "Trying to write invalid spr %d (0x%03x) at "
TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4);
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR);

/* Only generate an exception in user space, otherwise this is a nop */
if (ctx->pr) {
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR);
}
}
}

Expand Down

0 comments on commit 4d6a068

Please sign in to comment.