aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/ia64
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2008-10-02 17:27:57 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2008-10-02 17:27:57 +0900
commitae695f6725774cce9c1ea232dd4bbd34b7668377 (patch)
tree52c8f92b3506a54fe7512933c95ea4ee25009617 /tools/libxc/ia64
parent8abea5a1745efde8c05c02d15bc176bd4096c796 (diff)
downloadxen-ae695f6725774cce9c1ea232dd4bbd34b7668377.tar.gz
xen-ae695f6725774cce9c1ea232dd4bbd34b7668377.tar.bz2
xen-ae695f6725774cce9c1ea232dd4bbd34b7668377.zip
[IA64] libxc: improve foreign p2m exposure.
make foreign p2m exposure _PAGE_IO_BIT aware for robustness. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Diffstat (limited to 'tools/libxc/ia64')
-rw-r--r--tools/libxc/ia64/xc_ia64_stubs.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/libxc/ia64/xc_ia64_stubs.c b/tools/libxc/ia64/xc_ia64_stubs.c
index 41a4da75fc..0ea386820b 100644
--- a/tools/libxc/ia64/xc_ia64_stubs.c
+++ b/tools/libxc/ia64/xc_ia64_stubs.c
@@ -153,6 +153,8 @@ xc_ia64_p2m_unmap(struct xen_ia64_p2m_table *p2m_table)
#define _PAGE_P (1UL << _PAGE_P_BIT) /* page present bit */
#define _PAGE_PGC_ALLOCATED_BIT 59 /* _PGC_allocated */
#define _PAGE_PGC_ALLOCATED (1UL << _PAGE_PGC_ALLOCATED_BIT)
+#define _PAGE_IO_BIT 60
+#define _PAGE_IO (1UL << _PAGE_IO_BIT)
#define IA64_MAX_PHYS_BITS 50 /* max. number of physical address bits (architected) */
#define _PAGE_PPN_MASK (((1UL << IA64_MAX_PHYS_BITS) - 1) & ~0xfffUL)
@@ -160,8 +162,10 @@ xc_ia64_p2m_unmap(struct xen_ia64_p2m_table *p2m_table)
int
xc_ia64_p2m_present(struct xen_ia64_p2m_table *p2m_table, unsigned long gpfn)
{
- if (sizeof(p2m_table->p2m[0]) * gpfn < p2m_table->size)
- return !!(p2m_table->p2m[gpfn] & _PAGE_P);
+ if (sizeof(p2m_table->p2m[0]) * gpfn < p2m_table->size) {
+ unsigned long pte = p2m_table->p2m[gpfn];
+ return !!((pte & _PAGE_P) && !(pte & _PAGE_IO));
+ }
return 0;
}
@@ -170,7 +174,8 @@ xc_ia64_p2m_allocated(struct xen_ia64_p2m_table *p2m_table, unsigned long gpfn)
{
if (sizeof(p2m_table->p2m[0]) * gpfn < p2m_table->size) {
unsigned long pte = p2m_table->p2m[gpfn];
- return !!((pte & _PAGE_P) && (pte & _PAGE_PGC_ALLOCATED));
+ return !!((pte & _PAGE_P) && (pte & _PAGE_PGC_ALLOCATED) &&
+ !(pte & _PAGE_IO));
}
return 0;
}
@@ -183,6 +188,8 @@ xc_ia64_p2m_mfn(struct xen_ia64_p2m_table *p2m_table, unsigned long gpfn)
if (sizeof(p2m_table->p2m[0]) * gpfn >= p2m_table->size)
return INVALID_MFN;
pte = p2m_table->p2m[gpfn];
+ if (pte & _PAGE_IO)
+ return INVALID_MFN;
if (!(pte & _PAGE_P))
return INVALID_MFN;
return (pte & _PAGE_PPN_MASK) >> PAGE_SHIFT;