~FIRST_MASK is nothing like correct for rounding down an MFN. It is the
inverse *and* an address not a framenumber so wrong in every dimension! We
cannot use FIRST_MASK since that would mask off any zeroeth level bits.
Instead calculate the correct value from FIRST_SIZE.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
end_mfn = base_mfn + nr_mfns;
/* Align to previous 1GB boundary */
- base_mfn &= ~FIRST_MASK;
+ base_mfn &= ~((FIRST_SIZE>>PAGE_SHIFT)-1);
offset = base_mfn - xenheap_mfn_start;
vaddr = DIRECTMAP_VIRT_START + offset*PAGE_SIZE;