From patchwork Sun Jun 4 17:34:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9765149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2C4A6032D for ; Sun, 4 Jun 2017 18:00:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B85A427FB3 for ; Sun, 4 Jun 2017 18:00:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC813280B0; Sun, 4 Jun 2017 18:00:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B45827FB3 for ; Sun, 4 Jun 2017 18:00:23 +0000 (UTC) Received: from localhost ([::1]:57930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZp8-0005PI-4S for patchwork-qemu-devel@patchwork.kernel.org; Sun, 04 Jun 2017 14:00:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZRe-0007qR-Ud for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZRb-0003Tn-3U for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:06 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:34659) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHZRa-0003SX-SN for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:03 -0400 Received: by mail-pf0-x241.google.com with SMTP id w69so18143588pfk.1 for ; Sun, 04 Jun 2017 10:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Kw4OrTnJoyEXimbYL5T5HOHvoy9StDHdLAgHBj7k14s=; b=Hezr6RKtDvnAS2/XvARSuPJDk9CvQ34z8Kv2UbM6fWVXOYnT3875mxT/TCbUPfyIc7 sgJ9URcto9WjAV5jRl4KESNCTO8Ge/eBOejDlmTBZCWaxQ/FO7nMBq+NCreu5vAZ3g8c 56Y7+NHq4u6oDfJNkTs5jwWCrp9RqbAx3s5ok9C5bhZHoJJq3tk/I4JL4alGdyeCs/QG BkybKPub+TuJqEHLMqljYwtQPZXeGFviux2VrR6jWB1VTNERgaGfKBJiS4AvDPY60sLW xoo5tL70MDlA/aX5xKXW/z1DGPe3vi9c1F3m+Fm2LQqI3S6ENROpqbTy2SW239lx5hyD gCKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Kw4OrTnJoyEXimbYL5T5HOHvoy9StDHdLAgHBj7k14s=; b=gZlO3+fTL3EejDtrasovO/15wQcaFONr/AqtLJoZHtR6bl9yclgbBPgBC5H+sJgZ4v ahg63ooSuvEHGlXpKMOc1nNa8aACFFOj8u7jMVhFeuWwcGBCZnaWnEBATUmZ8zt0SP8f Vk0fnoOzJb55NTiLaTiW82wYKec0KJXbEHe/TNiG/j9H/7Cy6CEoI6OwhwsYNR4pdi91 EK+rlWZtaTyCu47GMnc5qt9zjxU8WkRLLj1Yx3BSchM/dt2aCFoqXChBYbkrTA4mjKRo Y14SgTWaGftSPVdLy1UASOr6fO0+WWR+ba6rpkByGnyDvPrXwNLZx3FMMEUffIgIRpMj B6zw== X-Gm-Message-State: AODbwcA66NQy4zJ/RdSFfzpzZSpN799wb0Go+vfYJ7OWOurj/EeX9gT0 yZvMkBc/se0TSf3lfco= X-Received: by 10.99.1.88 with SMTP id 85mr17468775pgb.110.1496597761761; Sun, 04 Jun 2017 10:36:01 -0700 (PDT) Received: from bigtime.ASUS (cpe-98-155-27-246.hawaii.res.rr.com. [98.155.27.246]) by smtp.gmail.com with ESMTPSA id j191sm52854419pgc.53.2017.06.04.10.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 10:36:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 4 Jun 2017 10:34:36 -0700 Message-Id: <20170604173509.29684-37-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170604173509.29684-1-rth@twiddle.net> References: <20170604173509.29684-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 36/69] target/s390x: End the TB after EXECUTE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This split will be required for implementing EXECUTE properly. Do this now as a separate step to aid comparison of before and after TB listings. Reviewed-by: Aurelien Jarno Signed-off-by: Richard Henderson --- target/s390x/mem_helper.c | 54 ++++++++++++++++++++++++++++------------------- target/s390x/translate.c | 6 +++++- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4b96c27..d57d5b1 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1234,6 +1234,7 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, uint64_t r1, uint64_t addr) S390CPU *cpu = s390_env_get_cpu(env); uint64_t insn = cpu_lduw_code(env, addr); uint8_t opc = insn >> 8; + uint32_t cc; /* Or in the contents of R1[56:63]. */ insn |= r1 & 0xff; @@ -1263,42 +1264,46 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, uint64_t r1, uint64_t addr) b2 = extract64(insn, 28, 4); d1 = extract64(insn, 32, 12); d2 = extract64(insn, 16, 12); + + cc = env->cc_op; switch (opc & 0xf) { case 0x2: do_helper_mvc(env, l, get_address(env, 0, b1, d1), get_address(env, 0, b2, d2), 0); - return; + break; case 0x4: - env->cc_op = do_helper_nc(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); - return; + cc = do_helper_nc(env, l, get_address(env, 0, b1, d1), + get_address(env, 0, b2, d2), 0); + break; case 0x5: - env->cc_op = do_helper_clc(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); - return; + cc = do_helper_clc(env, l, get_address(env, 0, b1, d1), + get_address(env, 0, b2, d2), 0); + break; case 0x6: - env->cc_op = do_helper_oc(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); - return; + cc = do_helper_oc(env, l, get_address(env, 0, b1, d1), + get_address(env, 0, b2, d2), 0); + break; case 0x7: - env->cc_op = do_helper_xc(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); - return; + cc = do_helper_xc(env, l, get_address(env, 0, b1, d1), + get_address(env, 0, b2, d2), 0); + break; case 0xc: do_helper_tr(env, l, get_address(env, 0, b1, d1), get_address(env, 0, b2, d2), 0); - return; + break; case 0xd: - env->cc_op = do_helper_trt(env, l, get_address(env, 0, b1, d1), - get_address(env, 0, b2, d2), 0); - return; + cc = do_helper_trt(env, l, get_address(env, 0, b1, d1), + get_address(env, 0, b2, d2), 0); + break; + default: + goto abort; } } else if (opc == 0x0a) { /* supervisor call */ env->int_svc_code = extract64(insn, 48, 8); env->int_svc_ilen = ilen; helper_exception(env, EXCP_SVC); - return; + g_assert_not_reached(); } else if (opc == 0xbf) { uint32_t r1, r3, b2, d2; @@ -1306,10 +1311,15 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, uint64_t r1, uint64_t addr) r3 = extract64(insn, 48, 4); b2 = extract64(insn, 44, 4); d2 = extract64(insn, 32, 12); - env->cc_op = helper_icm(env, r1, get_address(env, 0, b2, d2), r3); - return; + cc = helper_icm(env, r1, get_address(env, 0, b2, d2), r3); + } else { + abort: + cpu_abort(CPU(cpu), + "EXECUTE on instruction prefix 0x%x not implemented\n", + opc); + g_assert_not_reached(); } - cpu_abort(CPU(cpu), "EXECUTE on instruction prefix 0x%x not implemented\n", - opc); + env->cc_op = cc; + env->psw.addr += ilen; } diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 5b8333f..70212c8 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1163,6 +1163,8 @@ typedef enum { the PC (for whatever reason), so there's no need to do it again on exiting the TB. */ EXIT_PC_UPDATED, + /* We have updated the PC and CC values. */ + EXIT_PC_CC_UPDATED, /* We are exiting the TB, but have neither emitted a goto_tb, nor updated the PC for the next instruction to be executed. */ EXIT_PC_STALE, @@ -2216,7 +2218,7 @@ static ExitStatus op_ex(DisasContext *s, DisasOps *o) tcg_temp_free_i64(v1); } - return NO_EXIT; + return EXIT_PC_CC_UPDATED; } static ExitStatus op_fieb(DisasContext *s, DisasOps *o) @@ -5489,6 +5491,8 @@ void gen_intermediate_code(CPUS390XState *env, struct TranslationBlock *tb) /* Next TB starts off with CC_OP_DYNAMIC, so make sure the cc op type is in env */ update_cc_op(&dc); + /* FALLTHRU */ + case EXIT_PC_CC_UPDATED: /* Exit the TB, either by raising a debug exception or by return. */ if (do_debug) { gen_exception(EXCP_DEBUG);