Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217849
b: refs/heads/master
c: cfd8951
h: refs/heads/master
i:
  217847: d319bb8
v: v3
  • Loading branch information
Jeremy Fitzhardinge committed Oct 22, 2010
1 parent f158bd9 commit 4bb89de
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33a847502b0338351cebd8fc0c68ac796cfadbbd
refs/heads/master: cfd8951e082a589637f9de3c33efd3218fdb3c03
9 changes: 8 additions & 1 deletion trunk/arch/x86/include/asm/xen/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,17 @@ extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);

static inline unsigned long pfn_to_mfn(unsigned long pfn)
{
unsigned long mfn;

if (xen_feature(XENFEAT_auto_translated_physmap))
return pfn;

return get_phys_to_machine(pfn) & ~FOREIGN_FRAME_BIT;
mfn = get_phys_to_machine(pfn);

if (mfn != INVALID_P2M_ENTRY)
mfn &= ~FOREIGN_FRAME_BIT;

return mfn;
}

static inline int phys_to_machine_mapping_valid(unsigned long pfn)
Expand Down
15 changes: 14 additions & 1 deletion trunk/arch/x86/xen/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,20 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
if (val & _PAGE_PRESENT) {
unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
pteval_t flags = val & PTE_FLAGS_MASK;
val = ((pteval_t)pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
unsigned long mfn = pfn_to_mfn(pfn);

/*
* If there's no mfn for the pfn, then just create an
* empty non-present pte. Unfortunately this loses
* information about the original pfn, so
* pte_mfn_to_pfn is asymmetric.
*/
if (unlikely(mfn == INVALID_P2M_ENTRY)) {
mfn = 0;
flags = 0;
}

val = ((pteval_t)mfn << PAGE_SHIFT) | flags;
}

return val;
Expand Down

0 comments on commit 4bb89de

Please sign in to comment.