Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8355aca authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar
Browse files

xen: fix address truncation in pte mfn<->pfn conversion



When converting the page number in a pte/pmd/pud/pgd between
machine and pseudo-physical addresses, the converted result was
being truncated at 32-bits.  This caused failures on machines
with more than 4G of physical memory.

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: "Christopher S. Aker" <caker@theshore.net>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 27df66a4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
	if (val & _PAGE_PRESENT) {
		unsigned long mfn = (val & PTE_MASK) >> PAGE_SHIFT;
		pteval_t flags = val & ~PTE_MASK;
		val = (mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
		val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
	}

	return val;
@@ -196,7 +196,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
	if (val & _PAGE_PRESENT) {
		unsigned long pfn = (val & PTE_MASK) >> PAGE_SHIFT;
		pteval_t flags = val & ~PTE_MASK;
		val = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
		val = ((pteval_t)pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
	}

	return val;