On Fri Feb 16, 2024 at 3:50 AM AEST, Peter Maydell wrote:
> On Thu, 15 Feb 2024 at 17:16, Nicholas Piggin <npig...@gmail.com> wrote:
> >
> > Calculate the BHRB base from arithmetic on the tcg_env target ptr.
> >
> > Signed-off-by: Nicholas Piggin <npig...@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.

Ah okay, thanks for the correction.

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

In that case, original approach may be better with small fixes
for 32-bit host.

Thanks,
Nick

Reply via email to