* tcg_target_long to pointer conversion?
@ 2023-04-23 9:55 Michael Tokarev
2023-04-23 10:40 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2023-04-23 9:55 UTC (permalink / raw)
To: QEMU Developers, Richard Henderson
Hi!
This commit:
commit 705ed477d54c5bccf51d924c403a52049586c3d7
Author: Richard Henderson <richard.henderson@linaro.org>
Date: Wed Oct 28 23:42:12 2020 -0700
tcg/i386: Support split-wx code generation
contains the following change:
- diff = arg - ((uintptr_t)s->code_ptr + 7);
+ diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
where arg is of type tcg_target_long. It looks like this is
the only place in qemu where this type is used as the pointer.
Does it make sense?
This warning is produced when building qemu on x32:
In file included from tcg/tcg.c:432:
tcg/i386/tcg-target.c.inc: In function ‘tcg_out_movi_int’:
tcg/i386/tcg-target.c.inc:1041:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1041 | diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
yes, x32 itself isn't a supported target, but it has some
rather unique properties which might catch possible issues.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: tcg_target_long to pointer conversion?
2023-04-23 9:55 tcg_target_long to pointer conversion? Michael Tokarev
@ 2023-04-23 10:40 ` Richard Henderson
2023-05-15 15:51 ` Michael Tokarev
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2023-04-23 10:40 UTC (permalink / raw)
To: Michael Tokarev, QEMU Developers
On 4/23/23 10:55, Michael Tokarev wrote:
> Hi!
>
> This commit:
>
> commit 705ed477d54c5bccf51d924c403a52049586c3d7
> Author: Richard Henderson <richard.henderson@linaro.org>
> Date: Wed Oct 28 23:42:12 2020 -0700
>
> tcg/i386: Support split-wx code generation
>
> contains the following change:
>
> - diff = arg - ((uintptr_t)s->code_ptr + 7);
> + diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
>
> where arg is of type tcg_target_long. It looks like this is
> the only place in qemu where this type is used as the pointer.
>
> Does it make sense?
Hmm. No, I don't think it does. We can't truncate arg from uint64_t and have the test
work properly.
>
> This warning is produced when building qemu on x32:
>
> In file included from tcg/tcg.c:432:
> tcg/i386/tcg-target.c.inc: In function ‘tcg_out_movi_int’:
> tcg/i386/tcg-target.c.inc:1041:30: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
> 1041 | diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
>
> yes, x32 itself isn't a supported target, but it has some
> rather unique properties which might catch possible issues.
Maybe
diff = arg - ((uintptr_t)tcg_splitwx_to_rx(s->code_ptr) + 7);
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: tcg_target_long to pointer conversion?
2023-04-23 10:40 ` Richard Henderson
@ 2023-05-15 15:51 ` Michael Tokarev
0 siblings, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2023-05-15 15:51 UTC (permalink / raw)
To: Richard Henderson, QEMU Developers
Just found an old thread marked "ToDo"..
23.04.2023 13:40, Richard Henderson wrote:
> On 4/23/23 10:55, Michael Tokarev wrote:
>> Hi!
>>
>> This commit:
>>
>> commit 705ed477d54c5bccf51d924c403a52049586c3d7
>> Author: Richard Henderson <richard.henderson@linaro.org>
>> Date: Wed Oct 28 23:42:12 2020 -0700
>>
>> tcg/i386: Support split-wx code generation
>>
>> contains the following change:
>>
>> - diff = arg - ((uintptr_t)s->code_ptr + 7);
>> + diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
>>
>> where arg is of type tcg_target_long. It looks like this is
>> the only place in qemu where this type is used as the pointer.
>>
>> Does it make sense?
>
> Hmm. No, I don't think it does. We can't truncate arg from uint64_t and have the test work properly.
>
>>
>> This warning is produced when building qemu on x32:
>>
>> In file included from tcg/tcg.c:432:
>> tcg/i386/tcg-target.c.inc: In function ‘tcg_out_movi_int’:
>> tcg/i386/tcg-target.c.inc:1041:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>> 1041 | diff = tcg_pcrel_diff(s, (const void *)arg) - 7;
>>
>> yes, x32 itself isn't a supported target, but it has some
>> rather unique properties which might catch possible issues.
>
> Maybe
>
> diff = arg - ((uintptr_t)tcg_splitwx_to_rx(s->code_ptr) + 7);
I know almost nothing about tcg.. :)
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-15 15:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-23 9:55 tcg_target_long to pointer conversion? Michael Tokarev
2023-04-23 10:40 ` Richard Henderson
2023-05-15 15:51 ` Michael Tokarev
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).