提交 d8355aca 编写于 作者: J Jeremy Fitzhardinge 提交者: Ingo Molnar

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: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: "Christopher S. Aker" <caker@theshore.net>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 27df66a4
...@@ -185,7 +185,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val) ...@@ -185,7 +185,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
if (val & _PAGE_PRESENT) { if (val & _PAGE_PRESENT) {
unsigned long mfn = (val & PTE_MASK) >> PAGE_SHIFT; unsigned long mfn = (val & PTE_MASK) >> PAGE_SHIFT;
pteval_t flags = val & ~PTE_MASK; 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; return val;
...@@ -196,7 +196,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) ...@@ -196,7 +196,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
if (val & _PAGE_PRESENT) { if (val & _PAGE_PRESENT) {
unsigned long pfn = (val & PTE_MASK) >> PAGE_SHIFT; unsigned long pfn = (val & PTE_MASK) >> PAGE_SHIFT;
pteval_t flags = val & ~PTE_MASK; 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; return val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册