qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: tcg_target_long to pointer conversion?
Date: Sun, 23 Apr 2023 11:40:36 +0100	[thread overview]
Message-ID: <d558a918-1dde-debb-0540-ba81f056c10a@linaro.org> (raw)
In-Reply-To: <8173c29d-eac4-2d5b-d75f-2b95eb129736@msgid.tls.msk.ru>

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	other threads:[~2023-04-23 10:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23  9:55 tcg_target_long to pointer conversion? Michael Tokarev
2023-04-23 10:40 ` Richard Henderson [this message]
2023-05-15 15:51   ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d558a918-1dde-debb-0540-ba81f056c10a@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).