From patchwork Mon Sep 7 17:50:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249242 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3881993ilg; Mon, 7 Sep 2020 10:52:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaLLQpbVvN2MqbaqZrqWW9z8H8qvt+uALLxPTy5n3ZG7Wkuci5dmv8YiN9lZ2C6+Uqd77l X-Received: by 2002:a25:b292:: with SMTP id k18mr29431228ybj.163.1599501168373; Mon, 07 Sep 2020 10:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599501168; cv=none; d=google.com; s=arc-20160816; b=W9BOO9WLctWLrYZvTCym7zPnmdsrX2DkSy3lXt95AWun5IJX1ytOujf5AbVLw6HQb2 irW+RgSyUJoIyBJgVN/06fkIkn2zM2OG3UZj8KeK5StTXm57bofolH4kNj8nMphAiBbd 6jAAg4l4RW2CyXAcQ1/qogtbSAUTDpZQOqxV7n41zJBdCP+QWKW8s/HsuIpFb2TNf5EQ 64z7uNezb5PejMj9Y/oIuqOhimUvfQbdQqcMzdpLZdPY1pFNOFLEuSR1ZyRdjDFaovvT KZwmUp+sHFcwjQkhKnSYDFlsl8g1eRXcwV1Fuj+q3Pl/A8F+Gt/OnO74OaIoYYyLNIZ4 9+Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=C+qOEnrO4mdVdydo87qRuF3WglkeUY/A8QOfETainjE=; b=PCq7TY99yKweeHA6Ub3+SrP2xMoIl2vtjQC/6v4TG5+DErCGKJd+AG10PvaoF98exL E/5kE1XcL1Q0RfktJ8ldGPAozp+ITI+TeL5XU3Iw1K2tnc1ThpMsh0AY1kfy9JtAjNdJ wu8OoX21PX3dt3NYR2yaRMZ7GLE09cGhhi8mCvVRZabwc/JMSGkP34y8v2YhxF2BUVsX CzulVNqijRcp1xCyPYrLLW4mNdjE9LN9ol1sN3Gzh0nuOI1rZrfK+qQ0T/Cav/9WyKw3 14/dSaeAlej9swOyPOepbZTxpl+k4BlravpK8t8ZGsHpkTd/C7UKjKPWs/yFvS96lkv2 Y6Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tdLsvJqX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r17si17371766ybb.447.2020.09.07.10.52.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Sep 2020 10:52:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tdLsvJqX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFLJv-000812-SH for patch@linaro.org; Mon, 07 Sep 2020 13:52:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFLIU-0004zm-Ho for qemu-devel@nongnu.org; Mon, 07 Sep 2020 13:51:18 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:39501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFLIS-0000lc-SK for qemu-devel@nongnu.org; Mon, 07 Sep 2020 13:51:18 -0400 Received: by mail-pj1-x1034.google.com with SMTP id s2so6763594pjr.4 for ; Mon, 07 Sep 2020 10:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C+qOEnrO4mdVdydo87qRuF3WglkeUY/A8QOfETainjE=; b=tdLsvJqXp/Xu8rTmum/Uf/FR6Dftv88FR5qERNIjM1oc4Q61ZLcx+Ojn3gHS49XdeB gphKaI2S4E7UEixjn68ze33TaaX5A6ldrQIY2Zy1HIEOPx/GyZbxifBoludRPM5oX9Nv EM8B6lPYiuO6xozcZ0qToyQWGNc+yuF2sRNN2ivKyZrblgpOhF7+sm3XfNVHkOhwyIjQ vjmqOQ1wo2Tn2aUPgqcCXr2rf+/ClixULpUXhoBHXGwKxqqlUqKVT09LMI4F4IcXHCDh kZmD8H8aNPdNfQGlET11cdfo7lpaIKb0SXdtepNL6XqeaqgobGiE2N2E5EQssjASeLxC SO8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C+qOEnrO4mdVdydo87qRuF3WglkeUY/A8QOfETainjE=; b=eHHYMnqMpl3dzLOF2IphT6FYXvRzh9xH/ahAGft7ctTnWGLufEje3tOW1bDMHjGwXK OUF3SpWxByTlP9gXhAx88kdKJ6H11HHOe96ClA3S3r83U61QvZjhCNnyJmMO4QI/a9Ap s23/M6tXb61kIbeNnjTfc6pN4A1hoKslxXQPhNECjYXwKGZE79KvUY/G/L2+NwVBIxu9 XbbAam47Wkg6wHSSaJIhKyWyhRhknu24sFaTPVMBBeX4WcObpTThqiyTRPSPQR/8AL44 KYZc0SzrLrLK1SczVROUaNLOAb/JrggB9dgpkhjbPLu4+qMNDWYcwi+oHD/zk7A4lr75 GMlQ== X-Gm-Message-State: AOAM533TP0VGz9sBpdfg35ml5CTtY8p1H4z8hsEKG/NW2Xgun3Tvkp8c MhbAvSVZasR84/uErh5wt+RR62h+bI4F1g== X-Received: by 2002:a17:90a:aa90:: with SMTP id l16mr367270pjq.210.1599501075271; Mon, 07 Sep 2020 10:51:15 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id ga3sm1651496pjb.18.2020.09.07.10.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 10:51:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/19] target/microblaze: Handle DISAS_EXIT_NEXT in delay slot Date: Mon, 7 Sep 2020 10:50:51 -0700 Message-Id: <20200907175102.28027-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907175102.28027-1-richard.henderson@linaro.org> References: <20200907175102.28027-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" It is legal to put an mts instruction into a delay slot. We should continue to return to the main loop in that case so that we recognize any pending interrupts. Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 6bf299a826..608d413c83 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1696,6 +1696,10 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) dc->base.pc_next += 4; if (dc->jmp_cond != TCG_COND_NEVER && !(dc->tb_flags & D_FLAG)) { + /* + * Finish any return-from branch. + * TODO: Diagnose rtXd in delay slot of rtYd earlier. + */ if (dc->tb_flags & DRTI_FLAG) { do_rti(dc); } else if (dc->tb_flags & DRTB_FLAG) { @@ -1703,7 +1707,35 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) } else if (dc->tb_flags & DRTE_FLAG) { do_rte(dc); } - dc->base.is_jmp = DISAS_JUMP; + + /* Complete the branch, ending the TB. */ + switch (dc->base.is_jmp) { + case DISAS_NORETURN: + /* + * E.g. illegal insn in a delay slot. We've already exited + * and will handle D_FLAG in mb_cpu_do_interrupt. + */ + break; + case DISAS_EXIT: + /* + * TODO: diagnose brk/brki in delay slot earlier. + * This would then fold into the illegal insn case above. + */ + break; + case DISAS_NEXT: + /* Normal insn a delay slot. */ + dc->base.is_jmp = DISAS_JUMP; + break; + case DISAS_EXIT_NEXT: + /* + * E.g. mts insn in a delay slot. Continue with btarget, + * but still return to the main loop. + */ + dc->base.is_jmp = DISAS_EXIT_JUMP; + break; + default: + g_assert_not_reached(); + } } }