On Wed, Apr 22, 2015 at 22:30:23 +0200, Paolo Bonzini wrote: > On 22/04/2015 18:53, Emilio G. Cota wrote: > > @@ -1221,8 +1194,9 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t > > start, int len) > > return; > > } > > if (p->code_bitmap) { > > - offset = start & ~TARGET_PAGE_MASK; > > - b = p->code_bitmap[offset >> 3] >> (offset & 7); > > + int nr = start & ~TARGET_PAGE_MASK; > > This should be unsigned, otherwise the compiler might not make > BIT_WORD(nr) a simple right shift (maybe it can see that nr > 0 thanks > to the AND, but in principle x / 32 is not the same as x >> 5 if x is > signed).
OK. Note that all bit{map,ops} helpers take a long as the bit position, and then do BIT_WORD() on it--I was following that convention wrt sign. > > + int b = p->code_bitmap[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG - 1)); > > And this should be unsigned long. Used an int because we only care about the least significant bits (len <= 8): > > if (b & ((1 << len) - 1)) { > > goto do_invalidate; > > } But yes, an unsigned long here is more appropriate. Thanks, Emilio