diff mbox series

[2/4] plugin: Fixes compiling errors on msys2/mingw

Message ID 20200926140415.1286-3-luoyonggang@gmail.com (mailing list archive)
State New, archived
Headers show
Series Enable plugin support on msys2/mingw | expand

Commit Message

Yonggang Luo Sept. 26, 2020, 2:04 p.m. UTC
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 contrib/plugins/hotblocks.c | 2 +-
 tests/plugin/bb.c           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé Sept. 26, 2020, 8:27 p.m. UTC | #1
On 9/26/20 4:04 PM, Yonggang Luo wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  contrib/plugins/hotblocks.c | 2 +-
>  tests/plugin/bb.c           | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
> index 3942a2ca54..37435a3fc7 100644
> --- a/contrib/plugins/hotblocks.c
> +++ b/contrib/plugins/hotblocks.c
> @@ -102,7 +102,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>  {
>      ExecCount *cnt;
>      uint64_t pc = qemu_plugin_tb_vaddr(tb);
> -    unsigned long insns = qemu_plugin_tb_n_insns(tb);
> +    size_t insns = qemu_plugin_tb_n_insns(tb);
>      uint64_t hash = pc ^ insns;
>  
>      g_mutex_lock(&lock);
> diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
> index e4cc7fdd6e..ef784be78f 100644
> --- a/tests/plugin/bb.c
> +++ b/tests/plugin/bb.c
> @@ -72,7 +72,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
>      CPUCount *count = max_cpus ?
>          g_ptr_array_index(counts, cpu_index) : &inline_count;
>  
> -    unsigned long n_insns = (unsigned long)udata;
> +    uint64_t n_insns = (uint64_t)udata;
>      g_mutex_lock(&count->lock);
>      count->insn_count += n_insns;
>      count->bb_count++;
> @@ -81,7 +81,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
>  
>  static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>  {
> -    unsigned long n_insns = qemu_plugin_tb_n_insns(tb);
> +    size_t n_insns = qemu_plugin_tb_n_insns(tb);
>  
>      if (do_inline) {
>          qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_ADD_U64,
>
Richard Henderson Sept. 27, 2020, 3:18 a.m. UTC | #2
On 9/26/20 7:04 AM, Yonggang Luo wrote:
> @@ -72,7 +72,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
>      CPUCount *count = max_cpus ?
>          g_ptr_array_index(counts, cpu_index) : &inline_count;
>  
> -    unsigned long n_insns = (unsigned long)udata;
> +    uint64_t n_insns = (uint64_t)udata;

This needs to be uintptr_t.

r~
Philippe Mathieu-Daudé Sept. 27, 2020, 8:42 a.m. UTC | #3
On 9/27/20 5:18 AM, Richard Henderson wrote:
> On 9/26/20 7:04 AM, Yonggang Luo wrote:
>> @@ -72,7 +72,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
>>      CPUCount *count = max_cpus ?
>>          g_ptr_array_index(counts, cpu_index) : &inline_count;
>>  
>> -    unsigned long n_insns = (unsigned long)udata;
>> +    uint64_t n_insns = (uint64_t)udata;
> 
> This needs to be uintptr_t.

Oops good catch.

> 
> r~
>
diff mbox series

Patch

diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 3942a2ca54..37435a3fc7 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -102,7 +102,7 @@  static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
 {
     ExecCount *cnt;
     uint64_t pc = qemu_plugin_tb_vaddr(tb);
-    unsigned long insns = qemu_plugin_tb_n_insns(tb);
+    size_t insns = qemu_plugin_tb_n_insns(tb);
     uint64_t hash = pc ^ insns;
 
     g_mutex_lock(&lock);
diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
index e4cc7fdd6e..ef784be78f 100644
--- a/tests/plugin/bb.c
+++ b/tests/plugin/bb.c
@@ -72,7 +72,7 @@  static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
     CPUCount *count = max_cpus ?
         g_ptr_array_index(counts, cpu_index) : &inline_count;
 
-    unsigned long n_insns = (unsigned long)udata;
+    uint64_t n_insns = (uint64_t)udata;
     g_mutex_lock(&count->lock);
     count->insn_count += n_insns;
     count->bb_count++;
@@ -81,7 +81,7 @@  static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
 
 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
 {
-    unsigned long n_insns = qemu_plugin_tb_n_insns(tb);
+    size_t n_insns = qemu_plugin_tb_n_insns(tb);
 
     if (do_inline) {
         qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_ADD_U64,