On 05/07/19 14:37, Liran Alon wrote:
>> +    u64 rmask = 0x43ff01ffffffe70cULL;
> Why not rename this to “used_bits_mask” and calculate it properly by macros?
> It seems a lot nicer than having a pre-calculated magic.

Yes, I wanted to do the same but I didn't have time right now.  I am
planning to cleanup after the merge window, but if a patch comes soon I
can apply it instead of course. :)

Something like

#define APIC_VALID_REG_MASK(reg)        (1ull << ((reg) >> 4))
#define APIC_VALID_REGS_MASK(first, count) \
        (APIC_VALID_REG_MASK(first) * (1ull << ((count) - 1)))

followed by

        if (offset > 0x3f0 ||
            !(valid_regs_mask & APIC_VALID_REG_MASK(offset))

Paolo

> -Liran
> 

Reply via email to