From patchwork Thu Oct 17 13:15:42 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: 176610 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp929932ill; Thu, 17 Oct 2019 06:30:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIcd4rSRB+Els7nywEamoPc5OHwi1Mctwey4TGNtSUAOuq5Ss4sxBXHsxEU59yisrx6OoV X-Received: by 2002:a0c:ee49:: with SMTP id m9mr3880251qvs.118.1571319012001; Thu, 17 Oct 2019 06:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571319011; cv=none; d=google.com; s=arc-20160816; b=l77GqfzxOpK8/1OpaovfT8wZMVd/KxeqOQrpTrxGVsSCjQ1sJiibygru2FcguEvQ5V Ull+BuR6m9ml3WIxIlM/P5x93xIqQ4TE3hH69gLJYOxtw+EmUApRs44YjLSccF0A+YAh 4XzRGECf2E1BFAlHgy0qZzG9a89NUi6wrTjUYCFwpacCrT45JrQmfrWaKs0/ydnXYTKd EyfRLd8u+ANx87KA7LqioFv7StU941pzUEnDvhp1QURCZwkqHLzpsMTTEDo/k8j1Z8eh u+OpDQ9fDrvWaz1SClvjpLpaH0llnPtTzbgqlo4MqBX+tKwsjuXNeoc0uDlJRmBmfYe4 Ed3g== 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=t6U3oBlc6u1UdxE1uAu8xMOurpvpIFfvpufH8BjBIdw=; b=nIZpYRyrlqeUhKVYX4qlN82UJTTJWWcX27Pw7yB+eepR7HlLF68RAKi8NbDnxot/ox pWj9BKHm23iN6JSP15e6V3P42rbWGo/yN6Hq3xbBHcs4EwLdadl4QowFF/ivdD6hxJoW +497cxlmiTA/KnwZeY1zwLFlDUR9QlHctg+JjG+TWHhnfhhWAPol0t96f7qeExcIepO/ B3MQwa38ZYlPkcFfj3V/ghCQ5Sn1rrRZntf/l7UjEBnBnWOGJRRxY6Ac04pB+EvBJfMQ uhYshgneGG36mW6OdVSqeSwhlMhANhTiBsntgmIJpBnof4IfTbadCcSPIlUYfaRDFqNb 7opw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FNlWDAB+; 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 191si2219833qkm.338.2019.10.17.06.30.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 06:30:11 -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=FNlWDAB+; 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]:47704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5r0-00089o-T9 for patch@linaro.org; Thu, 17 Oct 2019 09:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34015) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5dm-00089n-R7 for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5dl-0005VP-O6 for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:30 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:55433) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5dl-0005Uo-Hv for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:29 -0400 Received: by mail-wm1-x342.google.com with SMTP id a6so2518117wma.5 for ; Thu, 17 Oct 2019 06:16:29 -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=t6U3oBlc6u1UdxE1uAu8xMOurpvpIFfvpufH8BjBIdw=; b=FNlWDAB+eSG4X+dD6IMQrw4QZ9OrnDkuhOJyxyFk4H1+DT2B6LZSbYBrq/k5E2IW4G mmp2PvfMCRhvL64CX4xqqAvvWYwqXlRToGPrr1skOD2XOURQpVZyK6LZsI6NfDzn0tlZ ruNRp3DWjs2DSmUjE2hZoHBn01YZeYCNK0HdfizIHNY8rJ/brhM+6BSGyUWaXn/lK+FG /qBHCUzkfBY6LzmeiaaMGjJCuODT0vu4u0Z8gXG09Ah0917f00cjsmcFL+9klhiTR0r5 tsfNNS/GGsWUTCdNTfRdLzuQDshFWKBvtkRXhdpdgb/LR+G3UcCpYxvEOoSPYzZibQzi yfzg== 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=t6U3oBlc6u1UdxE1uAu8xMOurpvpIFfvpufH8BjBIdw=; b=BB9QC5w8x+FMR9Pi9KPd/wspJeX1Omr/lsD6bDpKnFW8jVzWs3Lm78+vGcsyfaCRQb uDbJyF2yE/DhDnoYf7JzVTiPD3jnkPiU4T7jdeNP0hlMz2bJ3SFOC9SjCuioCXXEy8qU 7bSb13P+K5woH/Nad/TsHjfupTdox3GJgpOGC3XWO3BSKc1Pb/A0vpYcN1iUy2JlpYh1 J5qjVS2ugDfIZ5KPo1vjRtkmoKeJxJ47EWuw4kcvJkjZ3E1NHNFzW0w0yJ3t0BCJPB4s M7XP052LXLRwKAheN2NnVF88e6Akk3FA+aU67F44PQaJ6Hn9CQkbdgQ0CD3zM0NmKmZr I/HQ== X-Gm-Message-State: APjAAAVq6CvxpbU2e7IVb/XdBBYEqcN4cEbtMJpmOy/zgvQz+yiinrr/ Q1RpQ2SA8bQFZXpTLqEaqKBf0d7b6uM= X-Received: by 2002:a7b:cf28:: with SMTP id m8mr3075893wmg.161.1571318188466; Thu, 17 Oct 2019 06:16:28 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u1sm2020353wmc.38.2019.10.17.06.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:16:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E802B1FFA9; Thu, 17 Oct 2019 14:16:17 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v6 21/54] plugin-gen: add plugin_insn_append Date: Thu, 17 Oct 2019 14:15:42 +0100 Message-Id: <20191017131615.19660-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017131615.19660-1-alex.bennee@linaro.org> References: <20191017131615.19660-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::342 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: robert.foley@futurewei.com, Richard Henderson , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= 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 --- v3 - use g_byte_array --- include/exec/plugin-gen.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.20.1 diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index de519883b1..4834a9e2f4 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 */