x86: introduce virt_to_xen_l1e()
PATCH 1/11 x86: introduce virt_to_xen_l1e()
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/mm.c +1 -4
@@ -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 ) {
xen/arch/x86/x86_64/mm.c +22 -0
@@ -121,6 +121,28 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned lreturn 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);
xen/include/asm-x86/page.h +1 -0
@@ -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);
x86: introduce virt_to_xen_l1e()
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/mm.c +1 -4
@@ -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 ) {
xen/arch/x86/x86_64/mm.c +22 -0
@@ -121,6 +121,28 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned lreturn 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);
xen/include/asm-x86/page.h +1 -0
@@ -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-devel mailing list
[email protected]
http://lists.xen.org/xen-devel