From patchwork Sun Dec 9 19:37:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10720259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84E40112E for ; Sun, 9 Dec 2018 19:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26B2C29C26 for ; Sun, 9 Dec 2018 19:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18B4729C2E; Sun, 9 Dec 2018 19:58:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF3F029C26 for ; Sun, 9 Dec 2018 19:58:42 +0000 (UTC) Received: from localhost ([::1]:56496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gW5Dt-00087f-Rl for patchwork-qemu-devel@patchwork.kernel.org; Sun, 09 Dec 2018 14:58:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gW4uF-0001Sw-L6 for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gW4uE-0005ty-0K for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:23 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:54877) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gW4uD-00054P-Mw for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:21 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 813B9C62; Sun, 9 Dec 2018 14:38:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 09 Dec 2018 14:38:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=/K6vmngCCUryOJus1SuwefP4SZ8PC8cW+6kzmBO9dco=; b=vOSYU LImMhzCA+o3jiwW6Z5tkpB155+1Ccj0oKviFFd7v9iAmayKJIzwQP5UXgahcYsPE E9QqxeKKczAyAhrlLCCw+TfJur3X+elBu6Ve/LZPjU63XoaDlgAQZ2xQbTnGfQG/ HGW4v2HJgbWNuUmERmkFcx/ww/OeHnbj+hAwgs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=/K6vmngCCUryOJus1SuwefP4SZ8PC 8cW+6kzmBO9dco=; b=N3wkvKZEPf7VFg0R95IiJySyMEMXosgKdVrfXG5HIcHZo Wm6oqbbk1+M1XhIWYslOOnuWabl5TpFwH7C5VMdpONhLKqwI9GGbWci77ChUkcio vGa8hpX+8B/pdWZo0tgfS3h/Pa3eoLBrDFd+BFAz9xT0aOzav6KW3Dbf+yc3wV5s rnjzUNavN7CjjKZutqxRFMolmG8pYl1eIXmAwi1MYpv1vlrwqab1b8gmP8HYdO4w +aIdaX++wDDSi8TYV6P+wzObC2s1J4dpo3euR+sIs+YekscpeKreF3HUGmHmiUAV /tu/CmQNYE6Zqw4OcehLbXTYcZndFKhbtrwkNDHCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegfedguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecu fedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkf fojghfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcu oegtohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeine curfgrrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhu shhtvghrufhiiigvpeej X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B93C5102EE; Sun, 9 Dec 2018 14:38:04 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Sun, 9 Dec 2018 14:37:33 -0500 Message-Id: <20181209193749.12277-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181209193749.12277-1-cota@braap.org> References: <20181209193749.12277-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [RFC v2 22/38] target/arm: call qemu_plugin_insn_append X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP I considered using translator_ld* from arm_ldl_code et al. However, note that there's a helper that also calls arm_ldl_code, so we'd have to change that caller. In thumb's case I'm also calling plugin_insn_append directly, since we can't assume that all instructions are 16 bits long. Signed-off-by: Emilio G. Cota --- target/arm/translate-a64.c | 2 ++ target/arm/translate.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 88195ab949..db95161c16 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -38,6 +38,7 @@ #include "trace-tcg.h" #include "translate-a64.h" #include "qemu/atomic128.h" +#include "qemu/plugin.h" static TCGv_i64 cpu_X[32]; static TCGv_i64 cpu_pc; @@ -13321,6 +13322,7 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) uint32_t insn; insn = arm_ldl_code(env, s->pc, s->sctlr_b); + plugin_insn_append(&insn, sizeof(insn)); s->insn = insn; s->pc += 4; diff --git a/target/arm/translate.c b/target/arm/translate.c index 7c4675ffd8..d5171f54f6 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -13234,6 +13234,7 @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } insn = arm_ldl_code(env, dc->pc, dc->sctlr_b); + plugin_insn_append(&insn, sizeof(insn)); dc->insn = insn; dc->pc += 4; disas_arm_insn(dc, insn); @@ -13304,11 +13305,16 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); is_16bit = thumb_insn_is_16bit(dc, insn); dc->pc += 2; - if (!is_16bit) { + if (is_16bit) { + uint16_t insn16 = insn; + + plugin_insn_append(&insn16, sizeof(insn16)); + } else { uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b); insn = insn << 16 | insn2; dc->pc += 2; + plugin_insn_append(&insn, sizeof(insn)); } dc->insn = insn;