qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tcg_target_long to pointer conversion?


From: Richard Henderson
Subject: Re: tcg_target_long to pointer conversion?
Date: Sun, 23 Apr 2023 11:40:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

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~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]