qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH] target/ppc: BHRB avoid using host pointer in translated code


From: Peter Maydell
Subject: Re: [PATCH] target/ppc: BHRB avoid using host pointer in translated code
Date: Thu, 15 Feb 2024 17:50:19 +0000

On Thu, 15 Feb 2024 at 17:16, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Calculate the BHRB base from arithmetic on the tcg_env target ptr.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> Hi Glenn,
>
> I think I have to squash this into the BHRB series. 32-bit host
> compile shows up a size mismatch warning... I think it's not quite
> right to be using host pointer directly in target code. The change
> of offset and mask to 32-bit is needed due to to seemingly missing
> tl->ptr conversion helpers, but 32-bit is okay for those anyway.

There's nothing inherently wrong with it (depending on what the
pointer is pointing to!), but you need to use the right type.
target_ulong and the _tl suffix are for the type which
depends on the size of the target's 'long'. The TCG type which is
"size of a host pointer" is TCG_TYPE_PTR, and you want the _ptr
suffix functions and to pass it around with TCGv_ptr.

thanks
-- PMM



reply via email to

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