From nobody Fri May 17 08:39:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612830426; cv=none; d=zohomail.com; s=zohoarc; b=M+g2cFPAujnHePTatNrEBJDpl8T+AGDacfe6XJVk+99NSJ9w5UezufqN3h9gwbHQm/9p7ux3rXnrLe7nmne6FJ3hqe+ywU5m+g3mPBIUAdlz26ZFo+6uyw7Ae4DezfVKSxtdxjggP9r9SK2b/4Rmo7e0Yrd0ID2jdzqdBJSaK7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612830426; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/4OvZ/z8zgs+Zk4nXR9BgeBunVL67Ul7jA+wIZOB714=; b=anwLxZLxNKNZbUofouvZxoqg7u8vSC8S7nHEda0ik7HydUscT3Zxmh8UjAJKuYz3rlWeeIb6EaFO9vybYv/YEN4hhIWqOmKUQWlbxwxsoXvudyq5b+O1pTnNbHGif/G+oQIRhkLKJIUQmVKp8YAPLe4VG/4ALPzFrpRMOx6Rlcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612830426905799.9935284277605; Mon, 8 Feb 2021 16:27:06 -0800 (PST) Received: from localhost ([::1]:35876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9Grx-0007CY-Sz for importer@patchew.org; Mon, 08 Feb 2021 19:27:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9G7c-0004zX-Kk for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:12 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:35155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9G7a-0000zN-SI for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:12 -0500 Received: by mail-pg1-x530.google.com with SMTP id t25so11297101pga.2 for ; Mon, 08 Feb 2021 15:39:10 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k15sm13483489pgt.35.2021.02.08.15.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 15:39:08 -0800 (PST) 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=/4OvZ/z8zgs+Zk4nXR9BgeBunVL67Ul7jA+wIZOB714=; b=VG7PcQvJ4VX8D6VAVxKrn7wbhNBalrA3j8geyB01s1RBhwZWbE78HjedcQr9gD11JP fbid8Zx/iWO7nagnQtdPrKKxePAWqzuMDbGvxeEBZz+MwoNsuTAgnwP1Db+mm6rzAFL+ WPy1K/yCByV8OM25Jvi7dCEnOEErPhHa2AsEybBMG7eJKWf0F76aJyMJM6Y6PGmNNmrp LEViBLo+RJnA9xxkFccbnMdWhq/uPDGqJ4+prhFQUBH/DXzhDdtikrcpToVZNdkFdPeC WzUU4++CihRqzNkFXOm++JuBYOcBr3uUIQd6IRLtbb+SmX56pGAD94oNOb9Ac9lt7/gU QfrA== 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=/4OvZ/z8zgs+Zk4nXR9BgeBunVL67Ul7jA+wIZOB714=; b=VxMODxdrrfhNPfhlB44eE9VuYbN4DwTFSqfPwuzLuZ2SlIICM9quOk6t4mdKNiu4xA 7zdDpDd667wShK6ixgWGkhxg5HhV1GNhJwzmO4LxjcJ9satNUNQF2li1I3dtAqfwdiZx n8REfkULaIg6aWkx/4dEd9iX9p2RzExwvsTpWB7GGOSTHINTgUBuq31PY6Jq3i+ujg82 1wqv+k0g43a5RdoPGWN5W7Ari6oguH3PW514TlTo7L1RtaIGlOoUpVMJfwFi8oavlv0n ZUvs+QbP0xIktcLPXO0MzutZYO+s0PdzPvUEa6cZIOOjOnnvrBOrfOe6Oq7O6glhvHU7 89rA== X-Gm-Message-State: AOAM533JdS/ztGw5ozxOKiS/GpyLEz6LTf154XTDtDg9wkxjVAbnbmFg R4723+ytrYtOiFK79j4wlFwZBeLGWUEUjA== X-Google-Smtp-Source: ABdhPJyTeWjbjqFteNmcmhWHc2ESCh4se9vJtkJWwHJo/zmwPuhCWS+/i7WfZhcztjVLdfCsief0JA== X-Received: by 2002:a63:574c:: with SMTP id h12mr19467486pgm.79.1612827549574; Mon, 08 Feb 2021 15:39:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/4] exec: Move TranslationBlock typedef to qemu/typedefs.h Date: Mon, 8 Feb 2021 15:39:03 -0800 Message-Id: <20210208233906.479571-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208233906.479571-1-richard.henderson@linaro.org> References: <20210208233906.479571-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com 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: alex.bennee@linaro.org, cfontana@suse.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This also means we don't need an extra declaration of the structure in hw/core/cpu.h. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- include/exec/tb-context.h | 1 - include/hw/core/cpu.h | 4 +--- include/hw/core/tcg-cpu-ops.h | 3 +-- include/qemu/typedefs.h | 1 + target/arm/internals.h | 3 +-- target/cris/translate.c | 2 +- target/lm32/translate.c | 2 +- target/moxie/translate.c | 2 +- target/unicore32/translate.c | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/exec/tb-context.h b/include/exec/tb-context.h index ec4c13b455..cc33979113 100644 --- a/include/exec/tb-context.h +++ b/include/exec/tb-context.h @@ -26,7 +26,6 @@ #define CODE_GEN_HTABLE_BITS 15 #define CODE_GEN_HTABLE_SIZE (1 << CODE_GEN_HTABLE_BITS) =20 -typedef struct TranslationBlock TranslationBlock; typedef struct TBContext TBContext; =20 struct TBContext { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 38d813c389..c005d3dc2d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -74,8 +74,6 @@ typedef enum MMUAccessType { =20 typedef struct CPUWatchpoint CPUWatchpoint; =20 -struct TranslationBlock; - /* see tcg-cpu-ops.h */ struct TCGCPUOps; =20 @@ -375,7 +373,7 @@ struct CPUState { IcountDecr *icount_decr_ptr; =20 /* Accessed in parallel; all accesses must be atomic */ - struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; + TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; =20 struct GDBRegisterState *gdb_regs; int gdb_num_regs; diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index ccc97d1894..ac3bb051f2 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -30,8 +30,7 @@ struct TCGCPUOps { * If more state needs to be restored, the target must implement a * function to restore all the state, and register it here. */ - void (*synchronize_from_tb)(CPUState *cpu, - const struct TranslationBlock *tb); + void (*synchronize_from_tb)(CPUState *cpu, const TranslationBlock *tb); /** @cpu_exec_enter: Callback for cpu_exec preparation */ void (*cpu_exec_enter)(CPUState *cpu); /** @cpu_exec_exit: Callback for cpu_exec cleanup */ diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index dc39b05c30..ee60eb3de4 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -120,6 +120,7 @@ typedef struct ReservedRegion ReservedRegion; typedef struct SavedIOTLB SavedIOTLB; typedef struct SHPCDevice SHPCDevice; typedef struct SSIBus SSIBus; +typedef struct TranslationBlock TranslationBlock; typedef struct VirtIODevice VirtIODevice; typedef struct Visitor Visitor; typedef struct VMChangeStateEntry VMChangeStateEntry; diff --git a/target/arm/internals.h b/target/arm/internals.h index 448982dd2f..7d26ce0c9d 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -172,8 +172,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu= ); void arm_translate_init(void); =20 #ifdef CONFIG_TCG -void arm_cpu_synchronize_from_tb(CPUState *cs, - const struct TranslationBlock *tb); +void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); #endif /* CONFIG_TCG */ =20 =20 diff --git a/target/cris/translate.c b/target/cris/translate.c index c893f877ab..65c168c0c7 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -132,7 +132,7 @@ typedef struct DisasContext { =20 int delayed_branch; =20 - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; } DisasContext; =20 diff --git a/target/lm32/translate.c b/target/lm32/translate.c index 030b232d66..20c70d03f1 100644 --- a/target/lm32/translate.c +++ b/target/lm32/translate.c @@ -93,7 +93,7 @@ typedef struct DisasContext { unsigned int tb_flags, synced_flags; /* tb dependent flags. */ int is_jmp; =20 - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; =20 uint32_t features; diff --git a/target/moxie/translate.c b/target/moxie/translate.c index d5fb27dfb8..24a742b25e 100644 --- a/target/moxie/translate.c +++ b/target/moxie/translate.c @@ -36,7 +36,7 @@ =20 /* This is the state at translation time. */ typedef struct DisasContext { - struct TranslationBlock *tb; + TranslationBlock *tb; target_ulong pc, saved_pc; uint32_t opcode; uint32_t fp_status; diff --git a/target/unicore32/translate.c b/target/unicore32/translate.c index 962f9877a0..370709c9ea 100644 --- a/target/unicore32/translate.c +++ b/target/unicore32/translate.c @@ -34,7 +34,7 @@ typedef struct DisasContext { int condjmp; /* The label that will be jumped to when the instruction is skipped. = */ TCGLabel *condlabel; - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; #ifndef CONFIG_USER_ONLY int user; --=20 2.25.1 From nobody Fri May 17 08:39:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612830570; cv=none; d=zohomail.com; s=zohoarc; b=OK8vOJa+LZ4ikM6Z5WrmNKuTZ79ZHS5K9KxrX1TueqGklNj07SwQ2msjuu/XqWkNmJtvOu2Kg2xTlya5gJIaxlp8sfNt9taIewMZS5kIEQ4EJS42AJoZgt16tVbo+XOWZF8Kj9eUGzAyfKHyfgWyZjnusN8+AdC7HH2Ufpd4VLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612830570; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DqDS++ASKRz2BpCakcktMBnc/QXED2AN0Q9nieRwrbQ=; b=DoEdvp9euD5ZHI5km/sN4KhPvp4Hk/nRMY27134TckMyIFGu1xOFm28KOHt8oKuiGZ2nmeqkXt18ahYrE4WFZ56aQm39EGBhIqBS6m9ebAY5+iaiVW/g0+gkyPF9G9VV7sBxjlgOFC+wjo9y9U6jLoSpE04hl0Kp9VrFwXY+CIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612830570825131.3793664576815; Mon, 8 Feb 2021 16:29:30 -0800 (PST) Received: from localhost ([::1]:42670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9GuF-0001Xt-RI for importer@patchew.org; Mon, 08 Feb 2021 19:29:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9G7i-00055q-UD for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:18 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:43242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9G7c-00010E-Dn for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:18 -0500 Received: by mail-pf1-x435.google.com with SMTP id q131so10719681pfq.10 for ; Mon, 08 Feb 2021 15:39:11 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k15sm13483489pgt.35.2021.02.08.15.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 15:39:10 -0800 (PST) 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=DqDS++ASKRz2BpCakcktMBnc/QXED2AN0Q9nieRwrbQ=; b=u3xF5UPOm10jLoMEaWGYABTmMgunkc7m3/+K++5qMoq96rTXD6k1fb4nX99eBixENC ZReNA5ERd4OEcuODIBuTYK8iE6KHG0sT6rtz2TPc63RPB0xmhsjNFHDFiUlZZAQFyYTT lC/9zIon4XDQtmJgq+3gh1ZsQf1U4ZpWlLnS4piKmZB02OviIIp5QPe3mduAN8Oa0qJg 1xRkkcu2Gdil1PQmPw0LAiVMTSWW2nRC8cDjZSS9QaY1Lg/TdPC5CDumEMcdatOJy3QT Olg2PHq86RZ9EktDaIsn9aBpDWdP5/s2GIsxpoJbBUsofYtexvaX9KOjXJDFvkJ07yhU ZSpg== 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=DqDS++ASKRz2BpCakcktMBnc/QXED2AN0Q9nieRwrbQ=; b=uXMl20JgH8ZmZkzA2bud4n9woWDlymi+wCz+OJspbEtJ6eudpI8NxVahVqIv111re3 sFdZCiED10J7u/hlQHYOluHjwRBWcqgGBhuQHN+2xzKG1Fx4BABRdMTS+1Jmu3U0b/6B WU8sI06kB0ATwzx8gLVnlq949/B6jQ73TJBF15ZQ6B4RL7EHsliUzOHTvvS/e6eN3VXJ liae9oBVYY7JoKj4OS+Ipqqw/mwmVUffPrPdI8VUgAAS3IRWUrBjmv6ROY7M3yHTxMh8 FSo6jOwPwYIe1FuXaD9e8u7prRFOlyyRSsosXDL0IUAZsN/L2UW+iRUXd92LQS0Mx/Gf 9x4w== X-Gm-Message-State: AOAM531tglxbwmDgJV8YkFuRStyFR1rydSesgLYpGJ0sIlC02aNpprV3 QUG3n8F0/fuw/PCCVObOEjeHy3UeA1VBKQ== X-Google-Smtp-Source: ABdhPJyU6FeshSrgguVtTQHQMFQqwPXwmu6qDIyVzIq7P6/sV9AvtqDP2Hkcr9vzARm4NFjWoBJ5Fw== X-Received: by 2002:a63:1a1d:: with SMTP id a29mr5955497pga.236.1612827551111; Mon, 08 Feb 2021 15:39:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/4] accel/tcg: Create io_recompile_replay_branch hook Date: Mon, 8 Feb 2021 15:39:04 -0800 Message-Id: <20210208233906.479571-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208233906.479571-1-richard.henderson@linaro.org> References: <20210208233906.479571-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com 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: alex.bennee@linaro.org, cfontana@suse.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Create a hook in which to split out the mips and sh4 ifdefs from cpu_io_recompile. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- include/hw/core/tcg-cpu-ops.h | 10 ++++++++++ accel/tcg/translate-all.c | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index ac3bb051f2..ddf334411f 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -88,6 +88,16 @@ struct TCGCPUOps { */ bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); =20 + /** + * @io_recompile_replay_branch: Callback for cpu_io_recompile. + * + * The cpu has been stoped, and cpu_restore_state_from_tb has been + * called. If the faulting instruction is in a delay slot, and the + * target architecture requires re-execution of the branch, then + * adjust the cpu state as required and return true. + */ + bool (*io_recompile_replay_branch)(CPUState *cpu, + const TranslationBlock *tb); #endif /* CONFIG_SOFTMMU */ #endif /* NEED_CPU_H */ =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 81d4c83f22..6eb37883bd 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -60,6 +60,7 @@ #include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "qapi/error.h" +#include "hw/core/tcg-cpu-ops.h" #include "internal.h" =20 /* #define DEBUG_TB_INVALIDATE */ @@ -2420,6 +2421,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retadd= r) CPUArchState *env =3D cpu->env_ptr; #endif TranslationBlock *tb; + CPUClass *cc; uint32_t n; =20 tb =3D tcg_tb_lookup(retaddr); @@ -2429,11 +2431,18 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t reta= ddr) } cpu_restore_state_from_tb(cpu, tb, retaddr, true); =20 - /* On MIPS and SH, delay slot instructions can only be restarted if - they were already the first instruction in the TB. If this is not - the first instruction in a TB then re-execute the preceding - branch. */ + /* + * Some guests must re-execute the branch when re-executing a delay + * slot instruction. When this is the case, adjust icount and N + * to account for the re-execution of the branch. + */ n =3D 1; + cc =3D CPU_GET_CLASS(cpu); + if (cc->tcg_ops->io_recompile_replay_branch && + cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) { + cpu_neg(cpu)->icount_decr.u16.low++; + n =3D 2; + } #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 && env->active_tc.PC !=3D tb->pc) { --=20 2.25.1 From nobody Fri May 17 08:39:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612830385; cv=none; d=zohomail.com; s=zohoarc; b=fdlNFJVUjlqL4mMByBdonU13K96n2Fw6ToCS7au5VDCx5qxwR+P0dsVm2mmRzgAm8lQHIB1XfKtHbKVtrbjsfnUYu1+mqPSPsVc9x3cMaYYE/yrVCwhoUy5rB8YlYEAaziFYoq3NqGAsmPaCIElgEoftuQ32lCHJoeIVY0c/tAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612830385; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bvXiadaSGeRqxaWd2p/qsJeoAY+3ssYrogfEW/VR4Cw=; b=Q/BNCpwVc+ZGl/E8aOSiAx4oaB8jQguuXZBDzlF56TiTCYEnPT7YJ9Py5+BKzMvEzjXpSGFIXYez80Qd4aHObB+A9Hfg8CV+CUmgq77xC6JdOq8Wnm3yGagsTztVQWmpbVb2Gj6xT6ruKKEyzboZ5QLVO9Js5cHfsJiLnmxabC0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612830385796614.638911482803; Mon, 8 Feb 2021 16:26:25 -0800 (PST) Received: from localhost ([::1]:33578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9GrI-00068v-IW for importer@patchew.org; Mon, 08 Feb 2021 19:26:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9G7s-000591-Mc for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:28 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:33120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9G7f-00010w-9B for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:26 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d13so8717587plg.0 for ; Mon, 08 Feb 2021 15:39:13 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k15sm13483489pgt.35.2021.02.08.15.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 15:39:11 -0800 (PST) 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=bvXiadaSGeRqxaWd2p/qsJeoAY+3ssYrogfEW/VR4Cw=; b=xshexf772AvOiOP2ZXOXWBH6IHeu2VIQlPPGeZgtZ9IUEi/jFIqYRrGmko81vgrJaz Mq2KqYn1OsqlefrYt0S8OTn36g0OB3VLRn7orjSPTl40sjo2tWKlt56pTTGy+FAYDiKi 0CGSl1zH3UxyNaWEbzhxgzF3VDMIwapK2bMRURQpjgzCi9/0Za37XpAZn+28Lv0bpXqH NFONim0xRSI0ucTobvxQUR/gvTxgDPNg6lQ0i5OtFQFonmqG/c3toVpNQ43NENg++Sla gEey5kOxPQ5G98kPJQyOqGva1CeM78kIALTI51EkgcxP+CdFWDPZexLWuTTuQatXqs+4 XanQ== 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=bvXiadaSGeRqxaWd2p/qsJeoAY+3ssYrogfEW/VR4Cw=; b=F+aD/YgcQ8Ap/YbVsWH83qFzcJDZpADtkCX2ov+A5LTVreuaCEgyKSiZXWUAU8RqEJ pOeHl4GhQ0h7Vl1br1URTCxzf5v0IgwI55tDIzNeQjmkHxfCfZ8zCEH7J60LmfEBLbyt IG0AnNb3KEZW5e2SOEa1DUXstV/nw3uewtMIdZxSkvJiF64yxpZn8Rw5wHk3dP92c/k2 EKul/eKANVXnug1p0ns+vdEf+BsYCwbkOvltOmPto1zWoeW1Q4/NlXvNc6RCs8jh5R9n plOCPw9+2vdWuijpFuonoMviRf92xeLZ+T7AYzTtsFSBrJv9f+ik0XrsaHEfZX33gBFt XHbA== X-Gm-Message-State: AOAM531wsonzf7iIkDCfjJsm7qT2O3RwulochVA7Jmj0qOiPz318+fOs OP/JIaqLSWDxVljB2aQsZdGhNUloTPp+AQ== X-Google-Smtp-Source: ABdhPJzJK1+g0OIDMiiqO0JD9pjTm1/v42SNI8NeayJmSQ89H/DCFJsxn99C6c5+OxkFa/bKhV2KQw== X-Received: by 2002:a17:902:6ac2:b029:de:3560:391e with SMTP id i2-20020a1709026ac2b02900de3560391emr18011505plt.60.1612827552268; Mon, 08 Feb 2021 15:39:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/4] target/mips: Create mips_io_recompile_replay_branch Date: Mon, 8 Feb 2021 15:39:05 -0800 Message-Id: <20210208233906.479571-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208233906.479571-1-richard.henderson@linaro.org> References: <20210208233906.479571-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com 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: alex.bennee@linaro.org, cfontana@suse.de, Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Move the code from accel/tcg/translate-all.c to target/mips/cpu.c. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- Cc: Philippe Mathieu-Daud=C3=A9 Cc: Aurelien Jarno Cc: Jiaxun Yang --- accel/tcg/translate-all.c | 12 ++---------- target/mips/cpu.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 6eb37883bd..470657b02a 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2417,7 +2417,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t ret= addr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_MIPS) || defined(TARGET_SH4) +#if defined(TARGET_SH4) CPUArchState *env =3D cpu->env_ptr; #endif TranslationBlock *tb; @@ -2443,15 +2443,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_neg(cpu)->icount_decr.u16.low++; n =3D 2; } -#if defined(TARGET_MIPS) - if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 - && env->active_tc.PC !=3D tb->pc) { - env->active_tc.PC -=3D (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); - cpu_neg(cpu)->icount_decr.u16.low++; - env->hflags &=3D ~MIPS_HFLAG_BMASK; - n =3D 2; - } -#elif defined(TARGET_SH4) +#if defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 && env->pc !=3D tb->pc) { env->pc -=3D 2; diff --git a/target/mips/cpu.c b/target/mips/cpu.c index ad163ead62..bf70c77295 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -268,6 +268,23 @@ static void mips_cpu_synchronize_from_tb(CPUState *cs, env->hflags &=3D ~MIPS_HFLAG_BMASK; env->hflags |=3D tb->flags & MIPS_HFLAG_BMASK; } + +# ifndef CONFIG_USER_ONLY +static bool mips_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + MIPSCPU *cpu =3D MIPS_CPU(cs); + CPUMIPSState *env =3D &cpu->env; + + if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 + && env->active_tc.PC !=3D tb->pc) { + env->active_tc.PC -=3D (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); + env->hflags &=3D ~MIPS_HFLAG_BMASK; + return true; + } + return false; +} +# endif /* !CONFIG_USER_ONLY */ #endif /* CONFIG_TCG */ =20 static bool mips_cpu_has_work(CPUState *cs) @@ -679,6 +696,7 @@ static struct TCGCPUOps mips_tcg_ops =3D { .do_interrupt =3D mips_cpu_do_interrupt, .do_transaction_failed =3D mips_cpu_do_transaction_failed, .do_unaligned_access =3D mips_cpu_do_unaligned_access, + .io_recompile_replay_branch =3D mips_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; #endif /* CONFIG_TCG */ --=20 2.25.1 From nobody Fri May 17 08:39:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612827682; cv=none; d=zohomail.com; s=zohoarc; b=huvlfJM136wUFQpW31z8QPX3VsPJ3b0mUvUX8pcjKumlqsIvgJQCK0TWzRRrWOcbv/TsNBqNjE3xmtje4tMpPxOKDI0BaAlzEPPelpaBH3p7kV4JIT62DrHzm3GfnSnAlVvdUld2QHuypLVJ9mbOj+PTCDfLlCzhqtRrJ9vdpE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612827682; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eL4WqFDBuNtlcGfpllQU5OAqdTK3sQa+xgiSdwASR9g=; b=oD5PpOMwCVCYzXDaPARfEpLyOsyxmNU0rzhiBHXnfJ5qfSvOzTbz1zDfn2uHbD0cb8DXAoII+UG/dzDNvH4rOpeKJilFYp3cbV1Cri5E1uwR2vhCQsWYMmHpHRhX4NhsFUU6BQk03dMAjgcslf7AHASq+69BUMHuvesG55wQwHA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612827682950215.2313560859618; Mon, 8 Feb 2021 15:41:22 -0800 (PST) Received: from localhost ([::1]:56602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9G9h-0006ja-Ts for importer@patchew.org; Mon, 08 Feb 2021 18:41:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9G7m-00056Z-P7 for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:22 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:45100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9G7f-00011I-9x for qemu-devel@nongnu.org; Mon, 08 Feb 2021 18:39:21 -0500 Received: by mail-pg1-x52c.google.com with SMTP id o21so9877012pgn.12 for ; Mon, 08 Feb 2021 15:39:14 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k15sm13483489pgt.35.2021.02.08.15.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 15:39:12 -0800 (PST) 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=eL4WqFDBuNtlcGfpllQU5OAqdTK3sQa+xgiSdwASR9g=; b=mKokqLWpckqZtMQ+8XiqgwyOgeBd5uyfFW1HD/NErNsLvZdkMYY2JD+qI/QGq7o7tv 7/vzBNIi9+Za6ZlU+HwnmclCbzhGPW8bfMYmc3MghQYAucvsjJ1pwato145aPTT21wyv iUat8hv48V2lWt7nwZRlLoqanRh1gPFwAzkaos/W4Y4FUqMxENx1XEHGefpeh1FzZOOk h/VwaTH0ncDW/O3nvUh2zcbYT76+LNWrzP7I9tUlF6VEmgJMXdUTNM6F09fxJUYBOsm1 MKWk7K2uKReGtvG/ETlxQ01pHf7lVC3LTZyNslQaaFKXMmwwt4Q0jk/hk+wE/70zdiR0 1nQQ== 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=eL4WqFDBuNtlcGfpllQU5OAqdTK3sQa+xgiSdwASR9g=; b=ZAyQCHATAeazobMlvKoHvRWTI6kOfsKhnDeeE97ocxco2F5kB2wg0aEKVicAEaXl7R 6jUi8btDpDrEwRiFE2HHBh7eQrxbHpYhOMJkGit5QPnxbuNI0fsqh1h89eQGOChF6sjf pNrmSr4VPGbMFFquxdCrz/Sm4MiSMUJUwinjWjU5UL75jrHFKeKbusXjv9KE7GkiJ+63 0ZZekImkxjXZms1KtdZAWkpTI+AHRJmOKWxXgQc+6+hb1gdbfJ5XlYYRCooFmfJemOwp e5yprTYP1sC9nmNcr+TF8tFzryBladb43uSZrq0kNaErlkHaStt/+glk686cHVdb1yJv 0oNA== X-Gm-Message-State: AOAM5308tprr03jLuHreP8j28Ucy9T3TKq7H9G+/ahZ8QDvfiQfNvXB7 MC6UcsCiusGZkm3AC3zldPFYXsBlEJCL0A== X-Google-Smtp-Source: ABdhPJy4/Z5nfjdnchwdDLJpNVv/qkLRiMp09zM2HO8hGFsfRECHCUO/RUW0KKc0cYd2Uvwz1ensUA== X-Received: by 2002:a05:6a00:22d6:b029:1cb:35ac:d8e0 with SMTP id f22-20020a056a0022d6b02901cb35acd8e0mr19392584pfj.17.1612827553355; Mon, 08 Feb 2021 15:39:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/4] target/sh4: Create superh_io_recompile_replay_branch Date: Mon, 8 Feb 2021 15:39:06 -0800 Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208233906.479571-1-richard.henderson@linaro.org> References: <20210208233906.479571-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com 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: alex.bennee@linaro.org, cfontana@suse.de, Yoshinori Sato Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Move the code from accel/tcg/translate-all.c to target/sh4/cpu.c. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- Cc: Yoshinori Sato --- accel/tcg/translate-all.c | 12 ------------ target/sh4/cpu.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 470657b02a..b8ad95aa1b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2417,9 +2417,6 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t ret= addr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_SH4) - CPUArchState *env =3D cpu->env_ptr; -#endif TranslationBlock *tb; CPUClass *cc; uint32_t n; @@ -2443,15 +2440,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_neg(cpu)->icount_decr.u16.low++; n =3D 2; } -#if defined(TARGET_SH4) - if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 - && env->pc !=3D tb->pc) { - env->pc -=3D 2; - cpu_neg(cpu)->icount_decr.u16.low++; - env->flags &=3D ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - n =3D 2; - } -#endif =20 /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | n; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index a78d283bc8..ac65c88f1f 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -43,6 +43,23 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, cpu->env.flags =3D tb->flags & TB_FLAG_ENVFLAGS_MASK; } =20 +#ifndef CONFIG_USER_ONLY +static bool superh_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + SuperHCPU *cpu =3D SUPERH_CPU(cs); + CPUSH4State *env =3D &cpu->env; + + if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 + && env->pc !=3D tb->pc) { + env->pc -=3D 2; + env->flags &=3D ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); + return true; + } + return false; +} +#endif + static bool superh_cpu_has_work(CPUState *cs) { return cs->interrupt_request & CPU_INTERRUPT_HARD; @@ -217,6 +234,7 @@ static struct TCGCPUOps superh_tcg_ops =3D { #ifndef CONFIG_USER_ONLY .do_interrupt =3D superh_cpu_do_interrupt, .do_unaligned_access =3D superh_cpu_do_unaligned_access, + .io_recompile_replay_branch =3D superh_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; =20 --=20 2.25.1