[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] l?e_from_paddr() expects the physical address to already be page
ChangeSet 1.1642, 2005/06/02 18:36:41+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxx> arch/x86/x86_32/domain_page.c | 2 +- include/asm-x86/page.h | 34 ++++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 9 deletions(-) diff -Nru a/xen/arch/x86/x86_32/domain_page.c b/xen/arch/x86/x86_32/domain_page.c --- a/xen/arch/x86/x86_32/domain_page.c 2005-06-02 14:03:35 -04:00 +++ b/xen/arch/x86/x86_32/domain_page.c 2005-06-02 14:03:35 -04:00 @@ -72,7 +72,7 @@ } 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); diff -Nru a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h 2005-06-02 14:03:35 -04:00 +++ b/xen/include/asm-x86/page.h 2005-06-02 14:03:35 -04:00 @@ -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) }) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |