From nobody Tue Feb 10 13:17:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=1560536205; cv=none; d=zoho.com; s=zohoarc; b=nvY8i7sMHaaBEGETJnDVwC9edfHNchUb7iKSppeabc/VWdxAy/1eITRKRFiHbkU+ywgoecpcCvkAz1+VOdDZsIMo/hJa5f7+9tINzeMOl4prIjpq2uNXjhvuQ2I9rSrq8NkpzlrlXIdVd1JoHOb5rGeu7oCd+6U7hxzRSRglp4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560536205; 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:ARC-Authentication-Results; bh=1Ghk3o46eKDRyTTJB5656nYsZZ0fzl1fP3AqjgtBmAI=; b=h0c9wJVcVXrnyliWR07w37xgOummgUwJ5L3L61w5sDXeq4Zv7MTrWDEanQhwFvmaHnRKP7shJPSJovy4FjUj4kVZO/OxJUoNL3UqvGuvuHo5lbmraSr1H5XlRSC+6YrecyljEjHyXmsxXZEIGYRM15eI9dL+/xEUDhhgHzek1Iw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560536205327602.0515005005137; Fri, 14 Jun 2019 11:16:45 -0700 (PDT) Received: from localhost ([::1]:54028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbqka-0007IO-4b for importer@patchew.org; Fri, 14 Jun 2019 14:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34169) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbq0P-000799-S6 for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbq0N-00049I-CX for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:48 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:40095) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbq0L-0003t7-TX for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:46 -0400 Received: by mail-wr1-x444.google.com with SMTP id p11so3359786wre.7 for ; Fri, 14 Jun 2019 10:28:35 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j7sm4655451wru.54.2019.06.14.10.28.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 10:28:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BB9AC1FFBC; Fri, 14 Jun 2019 18:12:03 +0100 (BST) 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=1Ghk3o46eKDRyTTJB5656nYsZZ0fzl1fP3AqjgtBmAI=; b=VwqLkXGRUWthSaVtjmb+jBib3TYQEhx3Q5ObYEZ1DabiVFTKIrjtG//tVzbxb7y3QZ 2PVeAGWCFBZX2Er7RmvQ1wLpOOzB1oUkkeR5eaClhp6wllhEkBUrLn99hD6liUL406Iq hftSp4SmKu7ogJI+OEjsPvE7UzA2GANKkn1cGQt9XieD7V6JIgB/kK5NuzHKL0pU6zCy bzokDUlBi756iZHs4+Zw5Rrfnl72hqRkPK9Kw4AZDXLRWfG9COZwvzU0fALvEQLR1hRd AMHH100a9hMiFdOu2pcn3QM+C9upgoeWZrwbHWhbf8zvqm7UBxFbdN2N9bE9VH5cyeqn vrgg== 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=1Ghk3o46eKDRyTTJB5656nYsZZ0fzl1fP3AqjgtBmAI=; b=leOyu1Ekro3Q+XT6lpHW69Oz+2muGY5p6RVvkkWYNZMR5NHstYijAvxYuw28L8xBFQ wkSmWa66RiuW7s6F4YPTQMR49SGZu7J2FoVxQTcD3EFXEW6fI2idjbMXYDZj1deg/7d6 f25J8+CTnRV0JGgaH/OJ0DJeKNElONO/Hz93RG+gi2MbTM1mTx34aXKj9Yc5JbjqOnpM Ap0Hfc8yme4+LQ7D+AnfujIVGMoPzWOUIF0ehi2XLRLP2MY42dukarUkFH7BnfKjnqd9 3r48oOf6svHrQbCH+RgcyaEBts/2Q/Q7YA3+A6Zsrm96uY6vrXtLSu/fblg/cXIH+QqH 9RNg== X-Gm-Message-State: APjAAAVYDkDR7jWpxyyGM1B/C55D0FBD/Y6JJ5/AOKXrLejumdArvdsl 51p36Xjpl9Ka7409RSPq6RnRoA== X-Google-Smtp-Source: APXvYqzzQ7cXCS4nXhvB5Qq3IMEDWXfcw67SDCbLhV4Ypg0poPRwTgouammHwcQ1KCHecq62LJaQ1w== X-Received: by 2002:a5d:5283:: with SMTP id c3mr35035556wrv.268.1560533314954; Fri, 14 Jun 2019 10:28:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 14 Jun 2019 18:11:47 +0100 Message-Id: <20190614171200.21078-38-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614171200.21078-1-alex.bennee@linaro.org> References: <20190614171200.21078-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v3 37/50] translator: inject instrumentation from plugins 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: Paolo Bonzini , "Emilio G. Cota" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota --- accel/tcg/translator.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 9226a348a3..161b494a54 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -16,6 +16,7 @@ #include "exec/gen-icount.h" #include "exec/log.h" #include "exec/translator.h" +#include "exec/plugin-gen.h" =20 /* Pairs with tcg_clear_temp_count. To be called by #TranslatorOps.{translate_insn,tb_stop} if @@ -34,6 +35,7 @@ void translator_loop(const TranslatorOps *ops, DisasConte= xtBase *db, CPUState *cpu, TranslationBlock *tb, int max_insns) { int bp_insn =3D 0; + bool plugin_enabled; =20 /* Initialize DisasContext */ db->tb =3D tb; @@ -55,11 +57,17 @@ void translator_loop(const TranslatorOps *ops, DisasCon= textBase *db, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 + plugin_enabled =3D plugin_gen_tb_start(cpu, tb); + while (true) { db->num_insns++; ops->insn_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit = */ =20 + if (plugin_enabled) { + plugin_gen_insn_start(cpu, db); + } + /* Pass breakpoint hits to target for further processing */ if (!db->singlestep_enabled && unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { @@ -95,6 +103,10 @@ void translator_loop(const TranslatorOps *ops, DisasCon= textBase *db, ops->translate_insn(db, cpu); } =20 + if (plugin_enabled) { + plugin_gen_insn_end(); + } + /* Stop translation if translate_insn so indicated. */ if (db->is_jmp !=3D DISAS_NEXT) { break; @@ -112,6 +124,10 @@ void translator_loop(const TranslatorOps *ops, DisasCo= ntextBase *db, ops->tb_stop(db, cpu); gen_tb_end(db->tb, db->num_insns - bp_insn); =20 + if (plugin_enabled) { + plugin_gen_tb_end(cpu); + } + /* The disas_log hook may use these values rather than recompute. */ db->tb->size =3D db->pc_next - db->pc_first; db->tb->icount =3D db->num_insns; --=20 2.20.1