diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2016-06-07 12:50:28 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-06-07 13:10:45 +1000 |
commit | 4d6a0680fa425230748a2d91d81be9afe050eeb3 (patch) | |
tree | 5ffd5808261948ec27f3160aece62acc7c20ddcb /target-ppc | |
parent | c76c22d51d347fc65d8d1b1e6e007cd2886e6313 (diff) | |
download | qemu-4d6a0680fa425230748a2d91d81be9afe050eeb3.zip |
ppc: Do not take exceptions on unknown SPRs in privileged mode
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>
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/translate.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 2ad4f4abf7..b6894751e8 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -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); + } } } @@ -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); + } } } |