qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] cputlb: cast size_t to target_ulong before usin


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH] cputlb: cast size_t to target_ulong before using for address masks
Date: Fri, 7 Jun 2019 01:08:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 6/6/19 5:43 PM, Alex Bennée wrote:
> While size_t is defined to happily access the biggest host object this
> isn't the case when generating masks for 64 bit guests on 32 bit
> hosts. Otherwise we end up truncating the address when we fall back to
> our unaligned helper.
> 
> Cc: Andrew Randrianasulu <address@hidden>

Fixes: https://bugs.launchpad.net/qemu/+bug/1831545

> Signed-off-by: Alex Bennée <address@hidden>
> ---
>  accel/tcg/cputlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index b796ab1cbe..8f814a1a2c 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1306,7 +1306,7 @@ load_helper(CPUArchState *env, target_ulong addr, 
> TCGMemOpIdx oi,
>          uint64_t r1, r2;
>          unsigned shift;
>      do_unaligned_access:
> -        addr1 = addr & ~(size - 1);
> +        addr1 = addr & ~((target_ulong)size - 1);

Tricky...
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


>          addr2 = addr1 + size;
>          r1 = full_load(env, addr1, oi, retaddr);
>          r2 = full_load(env, addr2, oi, retaddr);
> 



reply via email to

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