From patchwork Mon Oct 14 10:49:15 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: 176157 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4355317ill; Mon, 14 Oct 2019 04:06:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFDKuiV4+vrXRjeOpAYwNMmc2SKutQNdEOwO4XmNlfJw5QarZMGAYtJZtYnBrMAF81XF1W X-Received: by 2002:ac8:82e:: with SMTP id u43mr32057834qth.176.1571051167852; Mon, 14 Oct 2019 04:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571051167; cv=none; d=google.com; s=arc-20160816; b=Cn7e2Dr4IwWZI7Cwt+5vMT8Wy2BITJB/eL8CoQwp8y5n5r8vAhawQTRHk3BzR6q3R0 XkQ/YwDua3pXcJtKIhIEXdfSpMoxZzmhgoCE4moWI480Gr16GgBntDeNwknTXGQcW6cg goeYcu6OiPbjlptOuflK9JzZGo1O5U/tNrnO36PxwZyO+20F6oicqAk6tR6LgwFzIK2e PzWl8OxelA9a4qfNxxTgJi1RkM+xikLOAtkPsLqmWj2PpGw8HkYo0J9sQPe7XknDSZxL D9pQzXrldjyGD/jeZK1g/l7a2Zkp06R9mLknLUU78ZCkjL3NC4UfqBD3Ds7QHVIaHje9 z8Bw== 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=NFvdUASIVlNvwICdwig5tZpxX3b6uVT+wR01V6UxJU+2htQsEoOaZSvBlXJUJh4uXd i3wBS/r6FIRqBPbyYmGqefjzC0Dgxu+V1KG2AbAEgBUwyT8QHBOzCG/iqsqsq1ooy6RW VhcCn0uNyvfDUGaRYiR1mqf7mmMLtLH2MEQqqPvSxxpMenAYvuT/1xtL5hRAVkWUJ6Ht GTaITXr4IvVYahT5X+0dSgCd/FI6jMdJF1D63CgbKxmeADeQLCqlIvsWwa4GT7NUju6Y viB1JXQ7CWCim2bB6vJq/SjNJPLUhrE00MBaqN8Gzjrp5YLiu11REnjPm0Hpeg79T4L/ pwNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fJOwChp4; 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 f46si17773250qte.354.2019.10.14.04.06.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 04:06:07 -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=fJOwChp4; 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]:47284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJyAw-0005yT-Uh for patch@linaro.org; Mon, 14 Oct 2019 07:06:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44571) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJxvQ-0007PV-0n for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJxvO-0006AH-Pn for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:03 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJxvO-00068c-Jm for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:50:02 -0400 Received: by mail-wm1-x341.google.com with SMTP id 7so16758920wme.1 for ; Mon, 14 Oct 2019 03:50:02 -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=fJOwChp4bMBjNwazG0QV8ZPxEsC7CCi2q3piXYzbEJrTvSwWaiB7fHyc5GE+ArfL3+ M72vgVBDN5hOOHYAKy8mkb0+K/THDwJ07c06Ck1HaJHzoi/I1FMoQEmNpCKGgw7WcY4w wOiWix/UrIMynAA7VoYa7IUOVBg7kYjW8g2FXS3lie5ctN4TExw9snmte7e97/VqdmkQ boHIeYsvd8iB+7O6RjWBbImno76rzfynKMvjRJcXJuxCjNbHPg0DS/5L4mIRHr/CSH/U WkYMIM/hmpBr/m13CWg/lbvPYbloSVs+25Q2v/zG5GUON6XnMbIMyua47Ptyqsqczjyb aCGA== 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=Wf76U52rTyEt8fm+uR14UDeXo1PyXD6q47bnmBu3ETQ2XkLQd4vjaAqhr6FUrwNvjL Brim28xf3wadhmTD09fsjsB65r4unI/6AbDFRAsX5lIR9wj5Seg+5bmBD8ScEoMVT+td UeA7w3OurTh67XsFMsck+hEnBxYWsatkPYcGfPO69CJafXxA2WR0YYnKomiOAAWMX1DA olfhoMtP5pUNIwcz/Btbd6eh0ufPTiXytxFAbHHYJNVbqWU+9Gv8mmfUek67xOt0tvq8 x3phTLh1yMGFW83magR2Teo7gfhUfbwNXG4NhoPIvW+WzxyJ8LG4CyQ+9eSeoBlerG5P D9Yw== X-Gm-Message-State: APjAAAV+pK+C7bJH/L/t1xkY16/vstnOKyPXgCMDrlwGl45OmEAbI2UF KWu/ED5BqgAq6aJZ5h6pwVncPA== X-Received: by 2002:a05:600c:2054:: with SMTP id p20mr15336666wmg.76.1571050201549; Mon, 14 Oct 2019 03:50:01 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z189sm32321718wmc.25.2019.10.14.03.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 03:49:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6090E1FF92; Mon, 14 Oct 2019 11:49:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v5 22/55] plugin-gen: add plugin_insn_append Date: Mon, 14 Oct 2019 11:49:15 +0100 Message-Id: <20191014104948.4291-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014104948.4291-1-alex.bennee@linaro.org> References: <20191014104948.4291-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::341 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 */