[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: introduce virt_to_xen_l1e()
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1358946205 -3600 # Node ID 140f1b5182f5d022badbf94af4dc3b51993be19c # Parent 621b1a889e9b120236698731e0b5ecc5b0cb1d82 x86: introduce virt_to_xen_l1e() Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- diff -r 621b1a889e9b -r 140f1b5182f5 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Wed Jan 23 11:47:24 2013 +0100 +++ b/xen/arch/x86/mm.c Wed Jan 23 14:03:25 2013 +0100 @@ -5204,12 +5204,9 @@ int map_pages_to_xen( /* Normal page mapping. */ if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ) { - pl1e = alloc_xen_pagetable(); + pl1e = virt_to_xen_l1e(virt); if ( pl1e == NULL ) return -ENOMEM; - clear_page(pl1e); - l2e_write(pl2e, l2e_from_pfn(virt_to_mfn(pl1e), - __PAGE_HYPERVISOR)); } else if ( l2e_get_flags(*pl2e) & _PAGE_PSE ) { diff -r 621b1a889e9b -r 140f1b5182f5 xen/arch/x86/x86_64/mm.c --- a/xen/arch/x86/x86_64/mm.c Wed Jan 23 11:47:24 2013 +0100 +++ b/xen/arch/x86/x86_64/mm.c Wed Jan 23 14:03:25 2013 +0100 @@ -121,6 +121,28 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned l return l3e_to_l2e(*pl3e) + l2_table_offset(v); } +l1_pgentry_t *virt_to_xen_l1e(unsigned long v) +{ + l2_pgentry_t *pl2e; + + pl2e = virt_to_xen_l2e(v); + if ( !pl2e ) + return NULL; + + if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ) + { + l1_pgentry_t *pl1e = alloc_xen_pagetable(); + + if ( !pl1e ) + return NULL; + clear_page(pl1e); + l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR)); + } + + BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE); + return l2e_to_l1e(*pl2e) + l1_table_offset(v); +} + void *do_page_walk(struct vcpu *v, unsigned long addr) { unsigned long mfn = pagetable_get_pfn(v->arch.guest_table); diff -r 621b1a889e9b -r 140f1b5182f5 xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Wed Jan 23 11:47:24 2013 +0100 +++ b/xen/include/asm-x86/page.h Wed Jan 23 14:03:25 2013 +0100 @@ -328,6 +328,7 @@ void setup_idle_pagetable(void); /* Allocator functions for Xen pagetables. */ void *alloc_xen_pagetable(void); void free_xen_pagetable(void *v); +l1_pgentry_t *virt_to_xen_l1e(unsigned long v); l2_pgentry_t *virt_to_xen_l2e(unsigned long v); l3_pgentry_t *virt_to_xen_l3e(unsigned long v); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |