summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2017-07-18 10:02:44 -1000
committerAurelien Jarno <aurelien@aurel32.net>2017-07-18 23:39:17 +0200
commit6b98213da9b025dad0f1bd307928a4f30e96a50d (patch)
tree92cb6ebf56c61ab94e80069b3da1edbd62f788b5
parentdec16c6ee8e665ec558f7564e68c09e01facf903 (diff)
downloadfocaccia-qemu-6b98213da9b025dad0f1bd307928a4f30e96a50d.tar.gz
focaccia-qemu-6b98213da9b025dad0f1bd307928a4f30e96a50d.zip
target/sh4: Unify code for CHECK_PRIVILEGED
We do not need to emit N copies of raising an exception.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170718200255.31647-20-rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r--target/sh4/translate.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index acd756e18a..2476b948b9 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -369,16 +369,9 @@ static inline void gen_store_fpr64(DisasContext *ctx, TCGv_i64 t, int reg)
         goto do_illegal_slot;               \
     }
 
-#define CHECK_PRIVILEGED                                             \
-    if (IS_USER(ctx)) {                                              \
-        gen_save_cpu_state(ctx, true);                               \
-        if (ctx->envflags & DELAY_SLOT_MASK) {                       \
-            gen_helper_raise_slot_illegal_instruction(cpu_env);      \
-        } else {                                                     \
-            gen_helper_raise_illegal_instruction(cpu_env);           \
-        }                                                            \
-        ctx->bstate = BS_EXCP;                                       \
-        return;                                                      \
+#define CHECK_PRIVILEGED \
+    if (IS_USER(ctx)) {                     \
+        goto do_illegal;                    \
     }
 
 #define CHECK_FPU_ENABLED                                            \
@@ -1793,6 +1786,7 @@ static void _decode_opc(DisasContext * ctx)
 	    ctx->opcode, ctx->pc);
     fflush(stderr);
 #endif
+ do_illegal:
     if (ctx->envflags & DELAY_SLOT_MASK) {
  do_illegal_slot:
         gen_save_cpu_state(ctx, true);