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.hender...@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