From patchwork Tue Dec 17 01:06:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 851404 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp110619wrq; Mon, 16 Dec 2024 17:09:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUzZ8Sltil5crdO2T9qQWvTKvZowTsvV0Ez3GiKljJDnxM55nezmxQ/FQtS+WhoJ6kPlmCbxA==@linaro.org X-Google-Smtp-Source: AGHT+IFC5lb+P2eOtrUqV/PL3cjYRT7ntLEjxdLLmeL4XaXwmgeWuxNk05un6GDXzbKnAgSp2XLK X-Received: by 2002:a05:6214:5086:b0:6d3:f1ff:f8d6 with SMTP id 6a1803df08f44-6dc96848901mr242151726d6.40.1734397793460; Mon, 16 Dec 2024 17:09:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734397793; cv=none; d=google.com; s=arc-20240605; b=cvpmcKMS+i1bdB/z3OJWj5EHG+OsGqLGqtP/OmN1kT04CNZ3jj9rrBESzXYr3bUqF6 RqX1c8KHpPffBk2lE5zKt5grYvp/g3cDrYvHr7JDWkZjDCdgkwetrhJRDDAs5XP7z7VV KnBehjS5U7xlPL8+6P+L48Oh/81hNQU5N6kUJQBCSl9b+K+pJdZhJ0VPJwJrLJjdieba ItG7yjVQJev5pkq/uwx4zwH9+Ggi9dfpZX4CZHkbdHJAobXbk0L+LD5+1bsB8aUE71+j St1coD9lHwAPbmCcKpQfBLgXztpGm9tLMOc2+6EhMriF3LSU3ylMKZVeIO8QnZQPoTed aw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=kHLhWvJzE9yDVjpN1hr16j3rbknmxcBsd3hvunSMfeU=; fh=CFa3ou2Ry4mS7fTsZUswJFlbz+fCeIacXufDVqA7iAo=; b=OP8JLuzVeP7dn/Vf+YNFHDmidVun+u6zBLEqqh77n+Flunya27+DfkIFT/rNHyMLfU mAnbNAfP4IQjUW/fRi6HfUV4VKkR2YD2gd3U2gYr8fzIg7HKvGTF0vQd4g+AwxFj/IyS w3ns0JGoeF8/2IiNnTHOILa32uC9ZVnV0Xv7jDIimC5m715bG4XVTY1vC4cayJjmdYk6 xBzd33QqbSdYj9gT43mjoYxiAoGRdSVoJIhEB9BCoA7QxeWSfWgKhHgdiFoyYIXEA7vV w6jzIuikD+0Ey3XKTAtS7DLPEZOfbulDxwA5D9dBVU3Zn+C5zRo+lufey3s5LVs4dw3S mwmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vSRHyDF7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dccd34d779si85762526d6.262.2024.12.16.17.09.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Dec 2024 17:09:53 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=vSRHyDF7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNM3X-0008Eg-K1; Mon, 16 Dec 2024 20:07:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNM3W-0008EK-CK for qemu-devel@nongnu.org; Mon, 16 Dec 2024 20:07:22 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNM3U-0004wk-NH for qemu-devel@nongnu.org; Mon, 16 Dec 2024 20:07:22 -0500 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ee8e8e29f6so3626402a91.0 for ; Mon, 16 Dec 2024 17:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734397639; x=1735002439; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kHLhWvJzE9yDVjpN1hr16j3rbknmxcBsd3hvunSMfeU=; b=vSRHyDF79BOA/Gm9L54V2toLii+Jzg9uJiX8PcrovvQswTU/fXaBWm+TTr95eiFYWb 8tSpCRB77pDjCEcU7UpG5PvUPI6ZwMgv7VgnTQZ7LhdRwK8jeeBHrz3sdTsUXfKRe/o6 d/ZnEYVNjM45+XwjnbMRF1yJ4Kur72gHgkCe5NiADVZmsDbff5qUMixJU6k6vKcTyEuz bLI4QuG1itQAyd4VMAoscsPbfksvOb4T8SfRBrtwf/wGR5l5EO2Wsg0/hKAsQkKSoCg8 0pwKmyDts0H3OEwfziBw5FP4zY3teBEIlk+dsOBrlAsQEbp6hMP4rvTWmu1HvCtGFYkW zF5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734397639; x=1735002439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kHLhWvJzE9yDVjpN1hr16j3rbknmxcBsd3hvunSMfeU=; b=wg5bVTnifFh7eQAePH+VoCX35l+x1S3AbbdOG7K62SwbhbGWS3g4ryjya2rgCqyhZp VheXB98Im07oj6qy1qJ3lqvBNzXltM2oB9t1GoM0p9OyWDeGmq2wVmkTYzpUilx58Abc Al0IL+k7uM3x7Vd0fi4AvBJ3FdCSNvtOwfAhSk/BuP19nCvrg8U5sYeAYjumnX3rSPPj EnCdndytbh6Y1XeCLd1qu0xUIQqcRbupENTDgdiseXmwYzoszyEeMF2uB80p0WsV+XP4 wpXOINEO0mhvNTzrYK0y5zIeoxVKYOCE84PrVWg34w3plduB8OmY27mfotHB9GyY/Lnu Ob6Q== X-Gm-Message-State: AOJu0YxlEtoKu7QHsK0U5HJuBsv6bBl8JWRCZp/DNPTUnMSSs5AVCHLA eO43xp091tCYiG0YlskpmPOg8aGPAT5K/0nJDSeG1Kre7Pbz0G1xl3CKOG8fm8GT3DIQuX1weHy W6tE= X-Gm-Gg: ASbGncs5RX+jY5VYKGm/+0Isxem3cp2obeLVunQC5krp7ADtQEstIjLPrwd1WdxKio3 Et6s1PkfZ8jgOEiACT0KrrEHlsqFO1vkxo+lQgFBHGiyQ+e+OYDhNwPGAetkQDC7FQwETAzCa8j ZLpIZj/5Zb2rF2mJCZ0tYjA2bzEk6iZe/UNUBKa5nT92QwXGDKWtcU0MQ0RW0t5FoxI4+Idze5L vFkfGmGzHUlMMi0wktooVoVWS5a8T77CF0+surpI9zm2zaNM5VgeIx2c4KZMWo6rE/agqjTAyi4 J+CoAUYeekLTPHU= X-Received: by 2002:a17:90b:2b45:b0:2ee:d7d3:3008 with SMTP id 98e67ed59e1d1-2f28fb63badmr26648042a91.12.1734397639024; Mon, 16 Dec 2024 17:07:19 -0800 (PST) Received: from pc.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e6d0e4sm48746595ad.261.2024.12.16.17.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 17:07:18 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, Pierrick Bouvier , Alexandre Iooss , Paolo Bonzini , Mahmoud Mandour , Thomas Huth , philmd@linaro.org Subject: [PATCH 01/13] plugins: change signature of qemu_plugin_insn_haddr Date: Mon, 16 Dec 2024 17:06:55 -0800 Message-Id: <20241217010707.2557258-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241217010707.2557258-1-pierrick.bouvier@linaro.org> References: <20241217010707.2557258-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org It makes more sense to return the same type than qemu_plugin_insn_vaddr. Signed-off-by: Pierrick Bouvier --- include/qemu/qemu-plugin.h | 2 +- plugins/api.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 0fba36ae028..1fbcff6e1d2 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -537,7 +537,7 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); * Returns: hardware (physical) target address of instruction */ QEMU_PLUGIN_API -void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); +uint64_t qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); /** * typedef qemu_plugin_meminfo_t - opaque memory transaction handle diff --git a/plugins/api.c b/plugins/api.c index 24ea64e2de5..17b3a65e773 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -283,13 +283,13 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn) return insn->vaddr; } -void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) +uint64_t qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) { const DisasContextBase *db = tcg_ctx->plugin_db; vaddr page0_last = db->pc_first | ~TARGET_PAGE_MASK; if (db->fake_insn) { - return NULL; + return 0; } /* @@ -300,14 +300,14 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) */ if (insn->vaddr <= page0_last) { if (db->host_addr[0] == NULL) { - return NULL; + return 0; } - return db->host_addr[0] + insn->vaddr - db->pc_first; + return (uintptr_t) (db->host_addr[0] + insn->vaddr - db->pc_first); } else { if (db->host_addr[1] == NULL) { - return NULL; + return 0; } - return db->host_addr[1] + insn->vaddr - (page0_last + 1); + return (uintptr_t) (db->host_addr[1] + insn->vaddr - (page0_last + 1)); } }