* [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long
@ 2011-04-02 11:36 Stefan Weil
2011-04-09 22:50 ` Aurelien Jarno
2011-04-14 1:42 ` TeLeMan
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Weil @ 2011-04-02 11:36 UTC (permalink / raw)
To: Blue Swirl; +Cc: QEMU Developers
tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long (suggested by Blue Swirl).
These changes are needed for build environments where
sizeof(long) != sizeof(void *), especially for w64.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
gen-icount.h | 2 +-
target-alpha/translate.c | 6 +++---
target-arm/translate.c | 2 +-
target-cris/translate.c | 2 +-
target-i386/translate.c | 2 +-
target-lm32/translate.c | 2 +-
target-m68k/translate.c | 2 +-
target-microblaze/translate.c | 2 +-
target-mips/translate.c | 2 +-
target-ppc/translate.c | 2 +-
target-sh4/translate.c | 2 +-
target-sparc/translate.c | 2 +-
12 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gen-icount.h b/gen-icount.h
index 8879da6..5fb3829 100644
--- a/gen-icount.h
+++ b/gen-icount.h
@@ -29,7 +29,7 @@ static void gen_icount_end(TranslationBlock *tb, int num_insns)
if (use_icount) {
*icount_arg = num_insns;
gen_set_label(icount_label);
- tcg_gen_exit_tb((long)tb + 2);
+ tcg_gen_exit_tb((tcg_target_long)tb + 2);
}
}
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 3a1c625..96e922b 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -398,7 +398,7 @@ static ExitStatus gen_bdirect(DisasContext *ctx, int ra, int32_t disp)
} else if (use_goto_tb(ctx, dest)) {
tcg_gen_goto_tb(0);
tcg_gen_movi_i64(cpu_pc, dest);
- tcg_gen_exit_tb((long)ctx->tb);
+ tcg_gen_exit_tb((tcg_target_long)ctx->tb);
return EXIT_GOTO_TB;
} else {
tcg_gen_movi_i64(cpu_pc, dest);
@@ -417,12 +417,12 @@ static ExitStatus gen_bcond_internal(DisasContext *ctx, TCGCond cond,
tcg_gen_goto_tb(0);
tcg_gen_movi_i64(cpu_pc, ctx->pc);
- tcg_gen_exit_tb((long)ctx->tb);
+ tcg_gen_exit_tb((tcg_target_long)ctx->tb);
gen_set_label(lab_true);
tcg_gen_goto_tb(1);
tcg_gen_movi_i64(cpu_pc, dest);
- tcg_gen_exit_tb((long)ctx->tb + 1);
+ tcg_gen_exit_tb((tcg_target_long)ctx->tb + 1);
return EXIT_GOTO_TB;
} else {
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 39512bc..b3f82c7 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -3394,7 +3394,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint32_t dest)
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
tcg_gen_goto_tb(n);
gen_set_pc_im(dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
gen_set_pc_im(dest);
tcg_gen_exit_tb(0);
diff --git a/target-cris/translate.c b/target-cris/translate.c
index b4648a0..1c03fa5 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -596,7 +596,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
tcg_gen_goto_tb(n);
tcg_gen_movi_tl(env_pc, dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
tcg_gen_movi_tl(env_pc, dest);
tcg_gen_exit_tb(0);
diff --git a/target-i386/translate.c b/target-i386/translate.c
index c008450..7d1340e 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -2274,7 +2274,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
/* jump to same page: we can use a direct jump */
tcg_gen_goto_tb(tb_num);
gen_jmp_im(eip);
- tcg_gen_exit_tb((long)tb + tb_num);
+ tcg_gen_exit_tb((tcg_target_long)tb + tb_num);
} else {
/* jump to another page: currently not optimized */
gen_jmp_im(eip);
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index 666d5f4..efc9b5a 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -138,7 +138,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
likely(!dc->singlestep_enabled)) {
tcg_gen_goto_tb(n);
tcg_gen_movi_tl(cpu_pc, dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
tcg_gen_movi_tl(cpu_pc, dest);
if (dc->singlestep_enabled) {
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 6f72a2b..038c0af 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -861,7 +861,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
(s->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
tcg_gen_goto_tb(n);
tcg_gen_movi_i32(QREG_PC, dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
gen_jmp_im(s, dest);
tcg_gen_exit_tb(0);
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index fdb2b40..9c00149 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -146,7 +146,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
tcg_gen_goto_tb(n);
tcg_gen_movi_tl(cpu_SR[SR_PC], dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
tcg_gen_movi_tl(cpu_SR[SR_PC], dest);
tcg_gen_exit_tb(0);
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 0f93e2a..953c528 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -2686,7 +2686,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
likely(!ctx->singlestep_enabled)) {
tcg_gen_goto_tb(n);
gen_save_pc(dest);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
gen_save_pc(dest);
if (ctx->singlestep_enabled) {
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 090795b..3c3ee24 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3347,7 +3347,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
likely(!ctx->singlestep_enabled)) {
tcg_gen_goto_tb(n);
tcg_gen_movi_tl(cpu_nip, dest & ~3);
- tcg_gen_exit_tb((long)tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
tcg_gen_movi_tl(cpu_nip, dest & ~3);
if (unlikely(ctx->singlestep_enabled)) {
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 58e9b8f..88098d7 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -302,7 +302,7 @@ static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest)
/* Use a direct jump if in same page and singlestep not enabled */
tcg_gen_goto_tb(n);
tcg_gen_movi_i32(cpu_pc, dest);
- tcg_gen_exit_tb((long) tb + n);
+ tcg_gen_exit_tb((tcg_target_long)tb + n);
} else {
tcg_gen_movi_i32(cpu_pc, dest);
if (ctx->singlestep_enabled)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index e26462e..883ecd2 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -241,7 +241,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num,
tcg_gen_goto_tb(tb_num);
tcg_gen_movi_tl(cpu_pc, pc);
tcg_gen_movi_tl(cpu_npc, npc);
- tcg_gen_exit_tb((long)tb + tb_num);
+ tcg_gen_exit_tb((tcg_target_long)tb + tb_num);
} else {
/* jump to another page: currently not optimized */
tcg_gen_movi_tl(cpu_pc, pc);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long
2011-04-02 11:36 [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long Stefan Weil
@ 2011-04-09 22:50 ` Aurelien Jarno
2011-04-14 1:42 ` TeLeMan
1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-04-09 22:50 UTC (permalink / raw)
To: Stefan Weil; +Cc: Blue Swirl, QEMU Developers
On Sat, Apr 02, 2011 at 01:36:31PM +0200, Stefan Weil wrote:
> tcg_gen_exit_tb takes a parameter of type tcg_target_long,
> so the type casts of pointer to long should be replaced by
> type casts of pointer to tcg_target_long (suggested by Blue Swirl).
>
> These changes are needed for build environments where
> sizeof(long) != sizeof(void *), especially for w64.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
> gen-icount.h | 2 +-
> target-alpha/translate.c | 6 +++---
> target-arm/translate.c | 2 +-
> target-cris/translate.c | 2 +-
> target-i386/translate.c | 2 +-
> target-lm32/translate.c | 2 +-
> target-m68k/translate.c | 2 +-
> target-microblaze/translate.c | 2 +-
> target-mips/translate.c | 2 +-
> target-ppc/translate.c | 2 +-
> target-sh4/translate.c | 2 +-
> target-sparc/translate.c | 2 +-
> 12 files changed, 14 insertions(+), 14 deletions(-)
Thanks, applied.
> diff --git a/gen-icount.h b/gen-icount.h
> index 8879da6..5fb3829 100644
> --- a/gen-icount.h
> +++ b/gen-icount.h
> @@ -29,7 +29,7 @@ static void gen_icount_end(TranslationBlock *tb, int num_insns)
> if (use_icount) {
> *icount_arg = num_insns;
> gen_set_label(icount_label);
> - tcg_gen_exit_tb((long)tb + 2);
> + tcg_gen_exit_tb((tcg_target_long)tb + 2);
> }
> }
>
> diff --git a/target-alpha/translate.c b/target-alpha/translate.c
> index 3a1c625..96e922b 100644
> --- a/target-alpha/translate.c
> +++ b/target-alpha/translate.c
> @@ -398,7 +398,7 @@ static ExitStatus gen_bdirect(DisasContext *ctx, int ra, int32_t disp)
> } else if (use_goto_tb(ctx, dest)) {
> tcg_gen_goto_tb(0);
> tcg_gen_movi_i64(cpu_pc, dest);
> - tcg_gen_exit_tb((long)ctx->tb);
> + tcg_gen_exit_tb((tcg_target_long)ctx->tb);
> return EXIT_GOTO_TB;
> } else {
> tcg_gen_movi_i64(cpu_pc, dest);
> @@ -417,12 +417,12 @@ static ExitStatus gen_bcond_internal(DisasContext *ctx, TCGCond cond,
>
> tcg_gen_goto_tb(0);
> tcg_gen_movi_i64(cpu_pc, ctx->pc);
> - tcg_gen_exit_tb((long)ctx->tb);
> + tcg_gen_exit_tb((tcg_target_long)ctx->tb);
>
> gen_set_label(lab_true);
> tcg_gen_goto_tb(1);
> tcg_gen_movi_i64(cpu_pc, dest);
> - tcg_gen_exit_tb((long)ctx->tb + 1);
> + tcg_gen_exit_tb((tcg_target_long)ctx->tb + 1);
>
> return EXIT_GOTO_TB;
> } else {
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index 39512bc..b3f82c7 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -3394,7 +3394,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint32_t dest)
> if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
> tcg_gen_goto_tb(n);
> gen_set_pc_im(dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> gen_set_pc_im(dest);
> tcg_gen_exit_tb(0);
> diff --git a/target-cris/translate.c b/target-cris/translate.c
> index b4648a0..1c03fa5 100644
> --- a/target-cris/translate.c
> +++ b/target-cris/translate.c
> @@ -596,7 +596,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
> if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
> tcg_gen_goto_tb(n);
> tcg_gen_movi_tl(env_pc, dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> tcg_gen_movi_tl(env_pc, dest);
> tcg_gen_exit_tb(0);
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index c008450..7d1340e 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
> @@ -2274,7 +2274,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
> /* jump to same page: we can use a direct jump */
> tcg_gen_goto_tb(tb_num);
> gen_jmp_im(eip);
> - tcg_gen_exit_tb((long)tb + tb_num);
> + tcg_gen_exit_tb((tcg_target_long)tb + tb_num);
> } else {
> /* jump to another page: currently not optimized */
> gen_jmp_im(eip);
> diff --git a/target-lm32/translate.c b/target-lm32/translate.c
> index 666d5f4..efc9b5a 100644
> --- a/target-lm32/translate.c
> +++ b/target-lm32/translate.c
> @@ -138,7 +138,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
> likely(!dc->singlestep_enabled)) {
> tcg_gen_goto_tb(n);
> tcg_gen_movi_tl(cpu_pc, dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> tcg_gen_movi_tl(cpu_pc, dest);
> if (dc->singlestep_enabled) {
> diff --git a/target-m68k/translate.c b/target-m68k/translate.c
> index 6f72a2b..038c0af 100644
> --- a/target-m68k/translate.c
> +++ b/target-m68k/translate.c
> @@ -861,7 +861,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
> (s->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
> tcg_gen_goto_tb(n);
> tcg_gen_movi_i32(QREG_PC, dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> gen_jmp_im(s, dest);
> tcg_gen_exit_tb(0);
> diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
> index fdb2b40..9c00149 100644
> --- a/target-microblaze/translate.c
> +++ b/target-microblaze/translate.c
> @@ -146,7 +146,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
> if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
> tcg_gen_goto_tb(n);
> tcg_gen_movi_tl(cpu_SR[SR_PC], dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> tcg_gen_movi_tl(cpu_SR[SR_PC], dest);
> tcg_gen_exit_tb(0);
> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index 0f93e2a..953c528 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -2686,7 +2686,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
> likely(!ctx->singlestep_enabled)) {
> tcg_gen_goto_tb(n);
> gen_save_pc(dest);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> gen_save_pc(dest);
> if (ctx->singlestep_enabled) {
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index 090795b..3c3ee24 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -3347,7 +3347,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
> likely(!ctx->singlestep_enabled)) {
> tcg_gen_goto_tb(n);
> tcg_gen_movi_tl(cpu_nip, dest & ~3);
> - tcg_gen_exit_tb((long)tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> tcg_gen_movi_tl(cpu_nip, dest & ~3);
> if (unlikely(ctx->singlestep_enabled)) {
> diff --git a/target-sh4/translate.c b/target-sh4/translate.c
> index 58e9b8f..88098d7 100644
> --- a/target-sh4/translate.c
> +++ b/target-sh4/translate.c
> @@ -302,7 +302,7 @@ static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest)
> /* Use a direct jump if in same page and singlestep not enabled */
> tcg_gen_goto_tb(n);
> tcg_gen_movi_i32(cpu_pc, dest);
> - tcg_gen_exit_tb((long) tb + n);
> + tcg_gen_exit_tb((tcg_target_long)tb + n);
> } else {
> tcg_gen_movi_i32(cpu_pc, dest);
> if (ctx->singlestep_enabled)
> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
> index e26462e..883ecd2 100644
> --- a/target-sparc/translate.c
> +++ b/target-sparc/translate.c
> @@ -241,7 +241,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num,
> tcg_gen_goto_tb(tb_num);
> tcg_gen_movi_tl(cpu_pc, pc);
> tcg_gen_movi_tl(cpu_npc, npc);
> - tcg_gen_exit_tb((long)tb + tb_num);
> + tcg_gen_exit_tb((tcg_target_long)tb + tb_num);
> } else {
> /* jump to another page: currently not optimized */
> tcg_gen_movi_tl(cpu_pc, pc);
> --
> 1.7.2.5
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long
2011-04-02 11:36 [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long Stefan Weil
2011-04-09 22:50 ` Aurelien Jarno
@ 2011-04-14 1:42 ` TeLeMan
2011-04-14 5:09 ` Stefan Weil
1 sibling, 1 reply; 4+ messages in thread
From: TeLeMan @ 2011-04-14 1:42 UTC (permalink / raw)
To: Stefan Weil; +Cc: Blue Swirl, QEMU Developers
On Sat, Apr 2, 2011 at 19:36, Stefan Weil <weil@mail.berlios.de> wrote:
> tcg_gen_exit_tb takes a parameter of type tcg_target_long,
> so the type casts of pointer to long should be replaced by
> type casts of pointer to tcg_target_long (suggested by Blue Swirl).
>
> These changes are needed for build environments where
> sizeof(long) != sizeof(void *), especially for w64.
There are many "(long)tb" in exec.c and the types of tb_next in
TranslationBlock, tc_ptr in tb_find_pc(), searched_pc etc. are
"unsigned long". So more patches for w64 are needed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long
2011-04-14 1:42 ` TeLeMan
@ 2011-04-14 5:09 ` Stefan Weil
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2011-04-14 5:09 UTC (permalink / raw)
To: TeLeMan; +Cc: Blue Swirl, QEMU Developers
Am 14.04.2011 03:42, schrieb TeLeMan:
> On Sat, Apr 2, 2011 at 19:36, Stefan Weil <weil@mail.berlios.de> wrote:
>> tcg_gen_exit_tb takes a parameter of type tcg_target_long,
>> so the type casts of pointer to long should be replaced by
>> type casts of pointer to tcg_target_long (suggested by Blue Swirl).
>>
>> These changes are needed for build environments where
>> sizeof(long) != sizeof(void *), especially for w64.
> There are many "(long)tb" in exec.c and the types of tb_next in
> TranslationBlock, tc_ptr in tb_find_pc(), searched_pc etc. are
> "unsigned long". So more patches for w64 are needed.
Yes, I am very aware of this fact. This is the third effort to
get QEMU code which is w64 clean. The first two were large
patches which were difficult to review. Now I send small
patches which will finally achieve the same goal. Sometimes
these small patches seem to be unrelated to w64 (like
a recent patch which removes a parameter). I think that
increasing portability of software has positive effects for
all targets, not only the new one. That's why I do this
although I don't use w64.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-14 5:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02 11:36 [Qemu-devel] [PATCH] Fix conversions from pointer to tcg_target_long Stefan Weil
2011-04-09 22:50 ` Aurelien Jarno
2011-04-14 1:42 ` TeLeMan
2011-04-14 5:09 ` Stefan Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).