From patchwork Thu Feb 18 09:46:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 384379 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3541656jao; Thu, 18 Feb 2021 02:06:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKbkNw0tt7z6K4e3hZXXS23rOwuCAuCkZDe9v1MV+qbszDov2PVdkmOdIdcg2kgC/POIWc X-Received: by 2002:a25:cb13:: with SMTP id b19mr5280501ybg.119.1613642786547; Thu, 18 Feb 2021 02:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642786; cv=none; d=google.com; s=arc-20160816; b=eBthdny/tMVJHI3beXLXbiMTxYoGMuKst/4YNDJWzSo/zQxkgQt+I5Z0lEDFXYmnNp BlGUsg2Rky73EDSwK7LLUdkA5ra1srqAEfS3Qz3bs9pQrpjZvC8LCsWuzPVoScK1P2yS Cj5ls/gi5R8fEeoqXonSdVUFbBdbPSbCkApG//OUMRbVGOjcXZLJt8l+d0TGY9q6zfJ1 x56mWp0x8D3n3usGUVxlgV8iXxgWdWv25v83hDvBqy7LYQL+7kp7Dn2eAXd/xzhKZFcy YCe2PP4AyvAjkR3F2//z1NMk0D7n1r6f4QRvqoQlPL4mf7ybGh5LuSetTHFSKkt513GU CTuA== 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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=iqHU9UjPHHvqgv4wbedpytEsjLiMkWcXcD20vjxyMAMbrWJB88HEd9Onwi8kvQwekw Kt2Xqm7XdX6rmvYh7MhjdjeZVaRzd7b3vgwe7kl1T4y8fXUIl4KCE7c13610meEedhld jDk6bqEJ30JpAXCDqji/NLpeEPc+8xmv9/finJ2jCjyPpgGOTajSiiyNh5iWdgCj+v4i 1WzEB/wM9BIt/NG9AYaFQwXE+wqVTRYJaP7NnWBkbjpNhySV3zv9YaEH7kNppla1aFtM lkxNliFxgFIEPAuZp5IwzYz/2v7ox8LA4R6HU08SGXIzl9nMWR9Q3b5ZCvd+oIKESgo8 lUkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YXsB03va; 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 y145si6252617yby.396.2021.02.18.02.06.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:06:26 -0800 (PST) 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=YXsB03va; 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]:51478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgCW-0002ho-9Q for patch@linaro.org; Thu, 18 Feb 2021 05:06:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzO-0004Rq-Bq for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:50 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:33987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzM-0000yd-FF for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:49 -0500 Received: by mail-wm1-x331.google.com with SMTP id o10so2466909wmc.1 for ; Thu, 18 Feb 2021 01:52:47 -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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=YXsB03vaUE3SBea0f2cktWvK++/AlwnJeKe3jGNVb1npz5Zgvl2IN42JczNO31qzf5 ItcIcrfwuEQwVxffptZM8FiATCKExWZgL782s4rwELwHGFkSemktiHH4DOeRne6xzQAN h9RY30VL/wz5kDDRq657VhKXA6wJnIVDs/RzvIzKebkJ7BorPcUtV7i7zeylgS7V0Uk/ aAKHtwTXblLDRk9GGRBkBUxMSvu2r5r77+uVtw9uQ6BhRaIw/3W3s/AnBpW/yQ8zyJmg fbrJh5hf7zfihr1VbbLdKlowF1Jt0fu9l9QST8awPEElGzhRdtr/F9+osYgYK0j8umPR cd0Q== 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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=llbdBtD08XxgaDmuN0OVi+gFeRNhCkvja1x/9CSfhQUAzCEPzo8uVafI7vXvgV/Ynr t3LKJvkOfaycex1K/Vfeo2Zw9SmTj1H/GoFQNVe6XAV03k3tqRrdXhsf6iDujrAsmN/K kQIuKkKvyZT+gX2VuY8GxyiBRRUH1KJUe3xU+/c6G01jH+2CHHeg/8n2wyjC5RZhOeb8 jEiEEeuB2LMW+VfCeIftfASZgpQJtdbJKSAzsfcKTqVUBIBwzHEElAs9/s3DoAKKydgW 5MjJCTem5KxLhfw6mWythKl+gPspKAVRi7R6mwq5SIHzwG0BAGitFVX1vuNBOKrWMlw2 eFqg== X-Gm-Message-State: AOAM533ilKu83S+oXea1k6Kg3wH2CP9Wd2EM4mmLzgjleRjGhZIxI8Oj NpAt5LCMx9/B1uwc56by05K5ZQ== X-Received: by 2002:a7b:c5c7:: with SMTP id n7mr2779724wmk.63.1613641966989; Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g15sm8080303wrx.1.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 395661FF9C; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 13/23] target/sh4: Create superh_io_recompile_replay_branch Date: Thu, 18 Feb 2021 09:46:56 +0000 Message-Id: <20210218094706.23038-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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: Yoshinori Sato , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Move the code from accel/tcg/translate-all.c to target/sh4/cpu.c. Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> Message-Id: <20210213130325.14781-14-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9fea5c0e59..c0b98e76b9 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2418,9 +2418,6 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_SH4) - CPUArchState *env = cpu->env_ptr; -#endif TranslationBlock *tb; CPUClass *cc; uint32_t n; @@ -2444,15 +2441,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_neg(cpu)->icount_decr.u16.low++; n = 2; } -#if defined(TARGET_SH4) - if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 - && env->pc != tb->pc) { - env->pc -= 2; - cpu_neg(cpu)->icount_decr.u16.low++; - env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - n = 2; - } -#endif /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb = 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 = tb->flags & TB_FLAG_ENVFLAGS_MASK; } +#ifndef CONFIG_USER_ONLY +static bool superh_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + SuperHCPU *cpu = SUPERH_CPU(cs); + CPUSH4State *env = &cpu->env; + + if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 + && env->pc != tb->pc) { + env->pc -= 2; + env->flags &= ~(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 = { #ifndef CONFIG_USER_ONLY .do_interrupt = superh_cpu_do_interrupt, .do_unaligned_access = superh_cpu_do_unaligned_access, + .io_recompile_replay_branch = superh_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ };