mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
bitkeeper revision 1.1642 (429f43a9Urbk2TjIlm7NZJ_Z8LDQQQ)
l?e_from_paddr() expects the physical address to already be page aligned. Fix map_domain_mem() to do this, and add an assertion to the macros to check for it in debug builds. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
31d46bd2a1
commit
bf6fe7ee2e
2 files changed
+27
-9
No files matched your search
@@ -72,7 +72,7 @@ void *map_domain_mem(unsigned long pa)
|
||||
}
|
||||
while ( l1e_get_flags(cache[idx]) & _PAGE_PRESENT );
|
||||
|
||||
cache[idx] = l1e_from_paddr(pa, __PAGE_HYPERVISOR);
|
||||
cache[idx] = l1e_from_paddr(pa & PAGE_MASK, __PAGE_HYPERVISOR);
|
||||
|
||||
spin_unlock(&map_lock);
|
||||
|
||||
|
||||
@@ -75,14 +75,32 @@
|
||||
((l4_pgentry_t) { ((intpte_t)(pfn) << PAGE_SHIFT) | put_pte_flags(flags) })
|
||||
|
||||
/* Construct a pte from a physical address and access flags. */
|
||||
#define l1e_from_paddr(pa, flags) \
|
||||
((l1_pgentry_t) { (pa) | put_pte_flags(flags) })
|
||||
#define l2e_from_paddr(pa, flags) \
|
||||
((l2_pgentry_t) { (pa) | put_pte_flags(flags) })
|
||||
#define l3e_from_paddr(pa, flags) \
|
||||
((l3_pgentry_t) { (pa) | put_pte_flags(flags) })
|
||||
#define l4e_from_paddr(pa, flags) \
|
||||
((l4_pgentry_t) { (pa) | put_pte_flags(flags) })
|
||||
#ifndef __ASSEMBLY__
|
||||
static inline l1_pgentry_t l1e_from_paddr(physaddr_t pa, unsigned int flags)
|
||||
{
|
||||
ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
|
||||
return (l1_pgentry_t) { pa | put_pte_flags(flags) };
|
||||
}
|
||||
static inline l2_pgentry_t l2e_from_paddr(physaddr_t pa, unsigned int flags)
|
||||
{
|
||||
ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
|
||||
return (l2_pgentry_t) { pa | put_pte_flags(flags) };
|
||||
}
|
||||
#if CONFIG_PAGING_LEVELS >= 3
|
||||
static inline l3_pgentry_t l3e_from_paddr(physaddr_t pa, unsigned int flags)
|
||||
{
|
||||
ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
|
||||
return (l3_pgentry_t) { pa | put_pte_flags(flags) };
|
||||
}
|
||||
#endif
|
||||
#if CONFIG_PAGING_LEVELS >= 4
|
||||
static inline l4_pgentry_t l4e_from_paddr(physaddr_t pa, unsigned int flags)
|
||||
{
|
||||
ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
|
||||
return (l4_pgentry_t) { pa | put_pte_flags(flags) };
|
||||
}
|
||||
#endif
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
/* Construct a pte from its direct integer representation. */
|
||||
#define l1e_from_intpte(intpte) ((l1_pgentry_t) { (intpte_t)(intpte) })
|
||||
|
||||