From patchwork Fri Oct 25 06:36:37 2019 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: 177685 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3291373ill; Fri, 25 Oct 2019 00:39:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbvZZVX6RHmAtArrE1TfRNwRFoAvWF/JUkYHh9ivJR4rwuFyN3ljwdUWbnjazw6HO4IXjF X-Received: by 2002:a37:816:: with SMTP id 22mr1682636qki.454.1571989170578; Fri, 25 Oct 2019 00:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571989170; cv=none; d=google.com; s=arc-20160816; b=sjk7gxU5sk5wRl6A+swfEghzqkK6wda94uYtK3y3ifFr4YPBcgtPMiSYeK58RhQliy QY+2cTdT9gNdmvz51khTgTfmfg3+WeS/lceMOiahFB1ApsrPa3sfqO1b3PVgGOm/81RJ a2LD80rfBke+EkKhgzm5Lzy8DNSXG9jaMQXhHPjCYRUHkI2xOVUE6GcJ78xVOCld1IS3 UjCcKGYJ7altcBUKMBdmJxxo1lgcGG/2hVO+BcR7p+mR29lTFyzN5R36qtVnqO8sUvoR 5jHo3KfrRzl8WQCy86dtoHaFK0VWPNMeTl+NejDdKJ6i/KQ6nmFmahNOo9ExOUhw+quV G09Q== 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=DFJwHA2AP1ezAjJK1JlPulxO+eNr4yTHxJXk/vo/FGk=; b=lqvPkoeIa2Efh8/tTGH2iA2CiC9ibAmveKMkYreqSultOWjCRcrC1G4HU1PX9jjKtq LBvuiQpQa/lX9cDVXxVnNFL9ILSHtiE8k6366N+hLAoN5OnPjxSQn7LqB57I0c87/BLg 0iZgdXeNstJSwFpWGizruAYgRVRRZ8AeKUvq7WwcyMlYNaAprIMTlVcwL8cxXthjpMcP /6VwcDS+eYCWIYxaG31Zuti8LHay9oQXruCsOz4K7CPEywR60J9Qfe9hjLQ/QgLPeRCz /bfEOCULe2vrmKu/1pS/iCsu1HbPAhyDPAudX8WiN+jDIUkuj2A+e1SuQbg34ogxdszY JB5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hyVfbRSF; 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 z64si777918qtc.169.2019.10.25.00.39.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 00:39:30 -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=hyVfbRSF; 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]:56974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNuC1-0005XM-OH for patch@linaro.org; Fri, 25 Oct 2019 03:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtWc-0003UK-9R for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtWa-0007jj-4r for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:42 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:41127) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtWZ-0007ig-V9 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:40 -0400 Received: by mail-wr1-x429.google.com with SMTP id p4so953216wrm.8 for ; Thu, 24 Oct 2019 23:56:39 -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=DFJwHA2AP1ezAjJK1JlPulxO+eNr4yTHxJXk/vo/FGk=; b=hyVfbRSFVyqFWE/FQax+KcYI51JMsQYvlHCrNR0WO5xsiJQ4Pkg8YWEAn/CATSJ8w9 7nGgWbkWdEW5fSh8IDF+nosMuZB2yF/SCSXQE8Te5YLyoaa8nVeiELGl8mcv2cgtIlCt +qLZbE987GwchvLsSmstRIGTsbv/nJ+csZLd/mi6dcb40DITJN/Qe6EH0PnhIm7KCXlL 9bzSEORD2D75PZUG4d1etQH4Wu9nVfAkgBHmgKGeybEUMIo9cwyAQPEweTtkCTygKSIw 97DAsdR/HaLS7t3hS8SIQ0wnXNc4sUAu+Yt8/vVImF4rqnq/+6Vccs2uufEW55RJA0a0 sWNw== 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=DFJwHA2AP1ezAjJK1JlPulxO+eNr4yTHxJXk/vo/FGk=; b=S2QXcr/VCqOGOb6KYpjSyy0OVtA8wlh31KPbevQsVyx/UK8+p/YF1Q1Dpb0/YdKnlm 15jcoX+YXumLJFa+EGa1zRu2E7+4XL9VvBx40nLZZE2KOjmlBIY/Yc/3M+c21dxGN3Wn rXpB3z5aUwuFNwfyd/iY8FjK29vVfCsmsspl2dOTUsdpfW4B0IieESIRD9CejwnI4aCk DSGhBLiIWjz86Z74+ZQK5otiIxZrzxO2F7wJxOkgynK/I2Y7yb66ci0UDodOQy7FLtQk y0J06MAm401uFD3s/R+kQT9cRElL8dEK0DorcduOuy/lTkuRLOCURHkpcKRGi6T9nHc6 WYLg== X-Gm-Message-State: APjAAAXQ5JQ1lh1PipPPN2hXjTrOujksjWQM2XU86by302yCoiNkEM3M zFhNtxTf/E9vLABiN2x4Z1LlIQ== X-Received: by 2002:a05:6000:4c:: with SMTP id k12mr1446329wrx.100.1571986598867; Thu, 24 Oct 2019 23:56:38 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o187sm5777083wmo.3.2019.10.24.23.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:56:36 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4B9F71FFBE; Fri, 25 Oct 2019 07:37:17 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 37/73] plugin-gen: add plugin_insn_append Date: Fri, 25 Oct 2019 07:36:37 +0100 Message-Id: <20191025063713.23374-38-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 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: Richard Henderson , "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" By adding it to plugin-gen's header file, we can export is as an inline, since tcg.h is included in the header (we need tcg_ctx). Signed-off-by: Emilio G. Cota [AJB: use g_byte_array] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index de519883b16..4834a9e2f40 100644 --- a/include/exec/plugin-gen.h +++ b/include/exec/plugin-gen.h @@ -27,6 +27,17 @@ void plugin_gen_insn_end(void); void plugin_gen_disable_mem_helpers(void); void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info); +static inline void plugin_insn_append(const void *from, size_t size) +{ + struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; + + if (insn == NULL) { + return; + } + + insn->data = g_byte_array_append(insn->data, from, size); +} + #else /* !CONFIG_PLUGIN */ static inline @@ -51,6 +62,9 @@ static inline void plugin_gen_disable_mem_helpers(void) static inline void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info) { } +static inline void plugin_insn_append(const void *from, size_t size) +{ } + #endif /* CONFIG_PLUGIN */ #endif /* QEMU_PLUGIN_GEN_H */