From patchwork Sat Jul 10 15:31:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 472367 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1374820jao; Sat, 10 Jul 2021 08:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ7G6eqOERO7nxcGNqcJK2tuJGOPEcOrRI4xy4YIHQ8AfyjtdmXlW0Uw8Psfwe4MdXEYph X-Received: by 2002:a67:6d01:: with SMTP id i1mr41988334vsc.15.1625932561432; Sat, 10 Jul 2021 08:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625932561; cv=none; d=google.com; s=arc-20160816; b=nn7mrLl3wnaYRTCVbMfV91rt7JmesHKv05goiE6hmGvnHVd7XKmHf8+vqAb9MIVExF d9UQE947afV3/LcDpj+J677wDLuboalEY+8ca4gwkd26no5ACHv5ALHNG4bJGqcD21Dn EGU/Od5Mn0yVrWN3k1WB/KdypJNS0go/vPss2rFGBSj9iyeqH5Y4lqoAmlhfjEBW7DnG oa0mppsjf90IlJ39WdjvIU4MijaDVz1Z4jHI8t872mE6geJcxOTLHmYBLLkdCXDSnEdB lgx6djabBDeQ3LEWshaSEx5otnQGrY3ZW6K/O/hxfH7DRxWQUBlrKToE2xR1sPxOEVnG CkjA== 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=ZRs8c+bYXTrMqFwEkSuK8yjMifIV/i4B8zW/9Y2Jl1o=; b=oE3yctJmtDwr0R0WX+6zVqoLlpUeqBBJn1NHK02o9AJBM3ay7PMZ7cOuZNLogcGZw+ m8/5MPxlgZHmh9AOLF5YHVn6ia/z8fsSuE4T9SftMjH7dDgqtcuzfxaPCwVOWY20B7pz 1zcKsnuGyxUE+u4DfLRm0zJ4WiXlZCPujykpuyzTjuwbQiaZuI9LePmchPxmrhP8izPf ytzGalQeIT0W5uLvlK8RJsUYnRS/gwOquLxAi+p7hu/Nj18cKjp+ORLwLCw0d6rObzQ4 2cvujsE+zPRTBuNEuew7t74Vk8HtsX6sx1f7KNf/ecwc4drLwt5WjRtOOlOU0m6wtfdm IcZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MYMWwg/Y"; 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=pass (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 i59si8935667uad.36.2021.07.10.08.56.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jul 2021 08:56:01 -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=pass header.i=@linaro.org header.s=google header.b="MYMWwg/Y"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2FKi-0004t4-Sm for patch@linaro.org; Sat, 10 Jul 2021 11:56:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2Exg-0006Cb-52 for qemu-devel@nongnu.org; Sat, 10 Jul 2021 11:32:12 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:40600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2Exe-0002TP-6S for qemu-devel@nongnu.org; Sat, 10 Jul 2021 11:32:11 -0400 Received: by mail-pj1-x102c.google.com with SMTP id b14-20020a17090a7aceb029017261c7d206so9961183pjl.5 for ; Sat, 10 Jul 2021 08:32:09 -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=ZRs8c+bYXTrMqFwEkSuK8yjMifIV/i4B8zW/9Y2Jl1o=; b=MYMWwg/Y+O2hTJus4l/OaD77isoxwMkkwxEQdMR7UWAO0QunAIIf2gQOx1seA19lyM fA8GrFMKgigYpt+JcKmfY4DGAHTmD5eDJq9pNmg2UBIWOGP1sn9aePzUcTZeUXB6Kpjr o3EhnBv+E3QegS0x0bDYV5AepRsh7iosjRaKFuuZL2GVfSUTLrYZHmfSCuI5ORTLBT4O 41c5BBbYWEkfxBxpDcsr77AmT7g4ZcEUIXqZzoJB+OHtJBChzc9fftA/7uLn3QltM+pt k+Ttgt0Lo6ACCbPUMQp6CKcSnWfod+mQ3G9MXlWe4VzQ5CH1OgntAN3+BplPVRvU51Mm Gz8w== 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=ZRs8c+bYXTrMqFwEkSuK8yjMifIV/i4B8zW/9Y2Jl1o=; b=YSNbNE4GkzitdmCUb1PlGQn+XEdGDfGRP/TRqPVIVDfqDpYpMLswCnJCNiesNfz/wm u9U/ZUZN595eT6jsnEQ2xxZnAk/37q+2gCz2QjgwGyVbkzFjHk2RmAEzWfbUlK9HcaEH gCbpMAKtwSCzYsN6mhEjR2VSGOkcpYj0ubd19rCa6FqIqvxxthwHALF3gq3IJYNP4YKe OvU6hoF2SZ2phFoRe0zeXazAm34BxEt2EKmnWTp2UWgfW4AwGqaCY5sPqA0meU47+EPN PQpvdxwFNl2YQ76M8JYqWQvS8aEPgbm9OwTVzCFnCF/beR/QGGniX7tJibuhygJGs0to Cgkw== X-Gm-Message-State: AOAM5314H1388R5rPJ1XrZsJqVo4flteKkqC1z1m1CMo1/McgvR+tl2O 8u94LjqN6AP6dHkyoZLFcYjokhwG8rpqRQ== X-Received: by 2002:a17:902:d88b:b029:128:cd59:ead2 with SMTP id b11-20020a170902d88bb0290128cd59ead2mr35851874plz.27.1625931128919; Sat, 10 Jul 2021 08:32:08 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id u23sm11975374pgk.38.2021.07.10.08.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 08:32:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 36/41] accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c Date: Sat, 10 Jul 2021 08:31:38 -0700 Message-Id: <20210710153143.1320521-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210710153143.1320521-1-richard.henderson@linaro.org> References: <20210710153143.1320521-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will allow additional code sharing. No functional change. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 30 ++++++++++++++++++++++++++++++ accel/tcg/tcg-runtime.c | 22 ---------------------- 2 files changed, 30 insertions(+), 22 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ad1279d2ed..fb6668606f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -38,6 +38,7 @@ #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" #include "sysemu/replay.h" +#include "exec/helper-proto.h" #include "tb-hash.h" #include "tb-lookup.h" #include "tb-context.h" @@ -145,6 +146,35 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ +/** + * helper_lookup_tb_ptr: quick check for next tb + * @env: current cpu state + * + * Look for an existing TB matching the current cpu state. + * If found, return the code pointer. If not found, return + * the tcg epilogue so that we return into cpu_tb_exec. + */ +const void *HELPER(lookup_tb_ptr)(CPUArchState *env) +{ + CPUState *cpu = env_cpu(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + + tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu)); + if (tb == NULL) { + return tcg_code_gen_epilogue; + } + qemu_log_mask_and_addr(CPU_LOG_EXEC, pc, + "Chain %d: %p [" + TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", + cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags, + lookup_symbol(pc)); + return tb->tc.ptr; +} + /* Execute a TB, and fix up the CPU state afterwards if necessary */ /* * Disable CFI checks. diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 66ac830e2f..e4e030043f 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -30,7 +30,6 @@ #include "disas/disas.h" #include "exec/log.h" #include "tcg/tcg.h" -#include "tb-lookup.h" /* 32-bit helpers */ @@ -145,27 +144,6 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) return ctpop64(arg); } -const void *HELPER(lookup_tb_ptr)(CPUArchState *env) -{ - CPUState *cpu = env_cpu(env); - TranslationBlock *tb; - target_ulong cs_base, pc; - uint32_t flags; - - cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - - tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu)); - if (tb == NULL) { - return tcg_code_gen_epilogue; - } - qemu_log_mask_and_addr(CPU_LOG_EXEC, pc, - "Chain %d: %p [" - TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n", - cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags, - lookup_symbol(pc)); - return tb->tc.ptr; -} - void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(env_cpu(env), GETPC());