qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] cpu: use ROUND_UP() to define xxx_PAGE_ALIGN


From: Richard Henderson
Subject: Re: [PATCH 1/2] cpu: use ROUND_UP() to define xxx_PAGE_ALIGN
Date: Sun, 13 Oct 2019 19:38:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 10/13/19 6:01 PM, Wei Yang wrote:
>> No, please.
>>
>> (1) The compiler does not know that qemu_*host_page_size is a power of 2, and
>> will generate a real division at runtime.  The same is true for
>> TARGET_PAGE_SIZE when TARGET_PAGE_BITS_VARY.
>>
> 
> Confused
> 
> The definition of ROUND_UP is:
> 
> #define ROUND_UP(n, d) (((n) + (d) - 1) & -(0 ? (n) : (d)))

Ah, my bad, I did confuse this with QEMU_ALIGN_UP.

Hmm.

        lea     -1(n, size), t
        neg     size
        and     size, t

vs

        mov     mask, t
        not     t
        add     n, t
        and     mask, t

which is what I proposed here

>> https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg04526.html

I'm ok with your version.

Reviewed-by: Richard Henderson <address@hidden>


r~




reply via email to

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