From patchwork Mon Sep 23 14:04:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 277196 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7D4682C0120 for ; Tue, 24 Sep 2013 00:05:55 +1000 (EST) Received: from localhost ([::1]:40865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO6lt-0006vs-B1 for incoming@patchwork.ozlabs.org; Mon, 23 Sep 2013 10:05:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO6l4-0006t8-BZ for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VO6ky-0006r3-9y for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:05:02 -0400 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:40447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO6ky-0006qn-2y for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:04:56 -0400 Received: by mail-pa0-f41.google.com with SMTP id bj1so3637282pad.14 for ; Mon, 23 Sep 2013 07:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=M+a1FbAd1AABO6lKYTjuU0yKr3JM0xU00ugPy78CUuM=; b=av7fCUh7iVBZVPmz9iC9YlEzH2a4uquOpb+Gnr0OdBc4v2YPOjN8WD69eAIDWa7TkW EF3cYcHDScuRIebxMfi5F4j2EInfCr6eSmUfOlL/4f7KoJ0R8B/O/1PX9UlqxSRCndNf hYzie5/vodm5UhRH3ODgpLCG/l7o6X7+U9q9RzZJYW/ol9s0Ztb8McxGjkg1jVCEZiuN vrwGHpGPuWq2veQbVW8M2msGAw1ib+wQ1mWhBIDyxRMgsobAgh1vz0gSxo0jHbHp3DFx H1m7aQEGWxRtkeOaGOFjL8h+6ToS3u8igZ2W/hmBDPUXoLXZESPP9A4GCB1/C4bCcp3q /fzQ== X-Received: by 10.66.119.172 with SMTP id kv12mr24778342pab.34.1379945094867; Mon, 23 Sep 2013 07:04:54 -0700 (PDT) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id ar1sm34415986pbc.34.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Sep 2013 07:04:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 23 Sep 2013 07:04:39 -0700 Message-Id: <1379945085-29086-5-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1379945085-29086-1-git-send-email-rth@twiddle.net> References: <1379945085-29086-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::229 Cc: agraf@suse.de Subject: [Qemu-devel] [PATCH 04/10] target-s390: Raise OPERATION exception for disabled insns X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Richard Henderson --- 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;