qemu-stable
[Top][All Lists]
Advanced

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

Re: [Qemu-stable] [PATCH v4] exec: Fix non-power-of-2 sized accesses


From: Paolo Bonzini
Subject: Re: [Qemu-stable] [PATCH v4] exec: Fix non-power-of-2 sized accesses
Date: Sat, 17 Aug 2013 19:58:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

Il 17/08/2013 10:23, Laszlo Ersek ha scritto:
> What Paolo posted seems almost identical.
> 
> clz32(l):                     leading zeros in "l"
> qemu_fls(l) == 32 - clz32(l): position of leftmost bit set, 1-based
> qemu_fls(l) - 1:              position of leftmost bit set, 0-based
> 
> Not sure if the (l & (l - 1)) check is needed in Paolo's patch. clz32()
> is not generally usable when l==0, so maybe that's (too) what the check
> is for. OTOH maybe l==0 is not even possible when entering
> memory_access_size().

The check was an attempt at placating complaints about possible
performance problems. :)

> Second, Paolo's patch might lack the "max(3, ...)" part. Since you
> didn't call my previous example with l==9 retarded, I guess clamping
> (qemu_fls(l) - 1) at 3 would be necessary.

That shouldn't happen, since an uint64_t is all you have for the datum.
 access_size_max should never exceed 8.

I don't really care which patch goes in, Alex's is fine as well.

Paolo



reply via email to

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