diff mbox series

[01/10] plugins/api: use tcg_ctx to get TARGET_PAGE_MASK

Message ID 20250225110844.3296991-2-alex.bennee@linaro.org (mailing list archive)
State New
Headers show
Series plugins: reduce total number of build objects | expand

Commit Message

Alex Bennée Feb. 25, 2025, 11:08 a.m. UTC
Requiring TARGET_PAGE_MASK to be defined gets in the way of building
this unit once. As tcg_ctx has the value lets use it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 plugins/api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Feb. 25, 2025, 2:57 p.m. UTC | #1
On 25/2/25 12:08, Alex Bennée wrote:
> Requiring TARGET_PAGE_MASK to be defined gets in the way of building
> this unit once. As tcg_ctx has the value lets use it.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   plugins/api.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Richard Henderson Feb. 25, 2025, 4 p.m. UTC | #2
On 2/25/25 03:08, Alex Bennée wrote:
> Requiring TARGET_PAGE_MASK to be defined gets in the way of building
> this unit once. As tcg_ctx has the value lets use it.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   plugins/api.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/plugins/api.c b/plugins/api.c
> index cf8cdf076a..10b258b08d 100644
> --- a/plugins/api.c
> +++ b/plugins/api.c
> @@ -287,7 +287,7 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn)
>   void *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;
> +    vaddr page0_last = db->pc_first | ~tcg_ctx->page_mask;
>   
>       if (db->fake_insn) {
>           return NULL;

NACK.  While this currently happens to work, it's the wrong api. This value is only live 
during the compilation cycle, and this part of plugins is not that.

For this, qemu_target_page_mask() is your huckleberry.


r~
diff mbox series

Patch

diff --git a/plugins/api.c b/plugins/api.c
index cf8cdf076a..10b258b08d 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -287,7 +287,7 @@  uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn)
 void *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;
+    vaddr page0_last = db->pc_first | ~tcg_ctx->page_mask;
 
     if (db->fake_insn) {
         return NULL;