qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 04/10] target-s390: Raise OPERATION exception for di


From: Richard Henderson
Subject: [Qemu-devel] [PATCH 04/10] target-s390: Raise OPERATION exception for disabled insns
Date: Mon, 23 Sep 2013 07:04:39 -0700

Signed-off-by: Richard Henderson <address@hidden>
---
 target-s390x/translate.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 5aac7b0..c8bbedb 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -53,6 +53,7 @@ struct DisasContext {
     const DisasInsn *insn;
     DisasFields *fields;
     uint64_t pc, next_pc;
+    uint64_t fac0;
     enum cc_op cc_op;
     bool singlestep_enabled;
 };
@@ -4651,6 +4652,16 @@ static ExitStatus translate_one(CPUS390XState *env, 
DisasContext *s)
         return EXIT_NORETURN;
     }
 
+    /* Check for operation exceptions for insns that have been disabled.
+       Do this by shifting the facilities word0 up by the IBM big-endian
+       bit numbering, leaving the bit to be tested in the sign bit.
+       Note that TCG does not currently support any facilities in word1.  */
+    assert(insn->fac < 64);
+    if ((int64_t)(s->fac0 << insn->fac) >= 0) {
+        gen_program_exception(s, PGM_OPERATION);
+        return EXIT_NORETURN;
+    }
+
     /* Check for insn specification exceptions.  */
     if (insn->spec) {
         int spec = insn->spec, excp = 0, r;
@@ -4769,6 +4780,7 @@ static inline void gen_intermediate_code_internal(S390CPU 
*cpu,
     dc.tb = tb;
     dc.pc = pc_start;
     dc.cc_op = CC_OP_DYNAMIC;
+    dc.fac0 = env->facilities[0];
     do_debug = dc.singlestep_enabled = cs->singlestep_enabled;
 
     gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]