Message ID | 20200927081901.771-1-luoyonggang@gmail.com |
---|---|
Headers | show |
Series | Enable plugin support on msys2/mingw | expand |
On 9/27/20 10:18 AM, 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..de09bdde4e 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; > + uintptr_t n_insns = (uintptr_t)udata; Shouldn't this be: uint64_t n_insns = (uint64_t)(uintptr_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, >
On Sun, Sep 27, 2020 at 4:45 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > On 9/27/20 10:18 AM, 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..de09bdde4e 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; > > + uintptr_t n_insns = (uintptr_t)udata; > > Shouldn't this be: > > uint64_t n_insns = (uint64_t)(uintptr_t)udata; don't know, may i assmue uintptr_t <= uint64_t , then that's not a prolem > > ? > > > 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, > > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo <div dir="ltr"><br><br>On Sun, Sep 27, 2020 at 4:45 PM Philippe Mathieu-Daudé <<a href="mailto:f4bug@amsat.org">f4bug@amsat.org</a>> wrote:<br>><br>> On 9/27/20 10:18 AM, Yonggang Luo wrote:<br>> > Signed-off-by: Yonggang Luo <<a href="mailto:luoyonggang@gmail.com">luoyonggang@gmail.com</a>><br>> > Reviewed-by: Philippe Mathieu-Daudé <<a href="mailto:f4bug@amsat.org">f4bug@amsat.org</a>><br>> > ---<br>> > contrib/plugins/hotblocks.c | 2 +-<br>> > tests/plugin/bb.c | 4 ++--<br>> > 2 files changed, 3 insertions(+), 3 deletions(-)<br>> ><br>> > diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c<br>> > index 3942a2ca54..37435a3fc7 100644<br>> > --- a/contrib/plugins/hotblocks.c<br>> > +++ b/contrib/plugins/hotblocks.c<br>> > @@ -102,7 +102,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)<br>> > {<br>> > ExecCount *cnt;<br>> > uint64_t pc = qemu_plugin_tb_vaddr(tb);<br>> > - unsigned long insns = qemu_plugin_tb_n_insns(tb);<br>> > + size_t insns = qemu_plugin_tb_n_insns(tb);<br>> > uint64_t hash = pc ^ insns;<br>> > <br>> > g_mutex_lock(&lock);<br>> > diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c<br>> > index e4cc7fdd6e..de09bdde4e 100644<br>> > --- a/tests/plugin/bb.c<br>> > +++ b/tests/plugin/bb.c<br>> > @@ -72,7 +72,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)<br>> > CPUCount *count = max_cpus ?<br>> > g_ptr_array_index(counts, cpu_index) : &inline_count;<br>> > <br>> > - unsigned long n_insns = (unsigned long)udata;<br>> > + uintptr_t n_insns = (uintptr_t)udata;<br>><br>> Shouldn't this be:<br>><br>> uint64_t n_insns = (uint64_t)(uintptr_t)udata;<div>don't know, may i assmue uintptr_t <= uint64_t , then that's not a prolem<br>><br>> ?<br>><br>> > g_mutex_lock(&count->lock);<br>> > count->insn_count += n_insns;<br>> > count->bb_count++;<br>> > @@ -81,7 +81,7 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)<br>> > <br>> > static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)<br>> > {<br>> > - unsigned long n_insns = qemu_plugin_tb_n_insns(tb);<br>> > + size_t n_insns = qemu_plugin_tb_n_insns(tb);<br>> > <br>> > if (do_inline) {<br>> > qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_ADD_U64,<br>> ><br><br><br><br>--<br> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo</div></div>