[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Rename some of the pagetable access macros:
ChangeSet 1.1624, 2005/06/01 10:06:47+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx Rename some of the pagetable access macros: l?e_create_* -> l?e_from_* *_phys -> *_paddr *_value -> *_intpte l?e_add_flags, l?e_remove_flags, l?e_has_changed now take ptes by value rather than by reference. The pagetable hypercalls are fixed to use l?e_from_intpte() rather than abusing l?e_from_paddr(), which munged the NX bit incorrectly on x86/64. Thanks to Scott Parish for spotting this one. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> arch/x86/audit.c | 4 arch/x86/dom0_ops.c | 2 arch/x86/domain.c | 16 +-- arch/x86/domain_build.c | 42 +++++----- arch/x86/mm.c | 89 +++++++++++---------- arch/x86/shadow.c | 142 +++++++++++++++++------------------ arch/x86/traps.c | 2 arch/x86/vmx.c | 10 +- arch/x86/vmx_io.c | 6 - arch/x86/vmx_vmcs.c | 4 arch/x86/x86_32/domain_page.c | 4 arch/x86/x86_32/mm.c | 14 +-- arch/x86/x86_32/traps.c | 6 - arch/x86/x86_64/mm.c | 37 ++++----- common/grant_table.c | 4 include/asm-x86/page.h | 101 +++++++++++++----------- include/asm-x86/shadow.h | 69 ++++++++--------- include/asm-x86/x86_32/page-2level.h | 4 include/asm-x86/x86_32/page-3level.h | 4 include/asm-x86/x86_64/page.h | 6 - 20 files changed, 287 insertions(+), 279 deletions(-) diff -Nru a/xen/arch/x86/audit.c b/xen/arch/x86/audit.c --- a/xen/arch/x86/audit.c 2005-06-01 06:03:03 -04:00 +++ b/xen/arch/x86/audit.c 2005-06-01 06:03:03 -04:00 @@ -408,9 +408,9 @@ for_each_exec_domain(d, ed) { - if ( pagetable_get_phys(ed->arch.guest_table) ) + if ( pagetable_get_paddr(ed->arch.guest_table) ) adjust(&frame_table[pagetable_get_pfn(ed->arch.guest_table)], 1); - if ( pagetable_get_phys(ed->arch.shadow_table) ) + if ( pagetable_get_paddr(ed->arch.shadow_table) ) adjust(&frame_table[pagetable_get_pfn(ed->arch.shadow_table)], 0); if ( ed->arch.monitor_shadow_ref ) adjust(&frame_table[ed->arch.monitor_shadow_ref], 0); diff -Nru a/xen/arch/x86/dom0_ops.c b/xen/arch/x86/dom0_ops.c --- a/xen/arch/x86/dom0_ops.c 2005-06-01 06:03:03 -04:00 +++ b/xen/arch/x86/dom0_ops.c 2005-06-01 06:03:03 -04:00 @@ -405,7 +405,7 @@ c->flags |= VGCF_VMX_GUEST; #endif - c->pt_base = pagetable_get_phys(ed->arch.guest_table); + c->pt_base = pagetable_get_paddr(ed->arch.guest_table); c->vm_assist = ed->domain->vm_assist; } diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c 2005-06-01 06:03:03 -04:00 +++ b/xen/arch/x86/domain.c 2005-06-01 06:03:03 -04:00 @@ -250,7 +250,7 @@ PAGE_SHIFT] = INVALID_M2P_ENTRY; ed->arch.perdomain_ptes = d->arch.mm_perdomain_pt; ed->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] = - l1e_create_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); + l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); ed->arch.guest_vtable = __linear_l2_table; ed->arch.shadow_vtable = __shadow_linear_l2_table; @@ -262,12 +262,12 @@ d->arch.mm_perdomain_l2 = (l2_pgentry_t *)alloc_xenheap_page(); memset(d->arch.mm_perdomain_l2, 0, PAGE_SIZE); d->arch.mm_perdomain_l2[l2_table_offset(PERDOMAIN_VIRT_START)] = - l2e_create_page(virt_to_page(d->arch.mm_perdomain_pt), + l2e_from_page(virt_to_page(d->arch.mm_perdomain_pt), __PAGE_HYPERVISOR); d->arch.mm_perdomain_l3 = (l3_pgentry_t *)alloc_xenheap_page(); memset(d->arch.mm_perdomain_l3, 0, PAGE_SIZE); d->arch.mm_perdomain_l3[l3_table_offset(PERDOMAIN_VIRT_START)] = - l3e_create_page(virt_to_page(d->arch.mm_perdomain_l2), + l3e_from_page(virt_to_page(d->arch.mm_perdomain_l2), __PAGE_HYPERVISOR); #endif @@ -288,7 +288,7 @@ ed->arch.perdomain_ptes = d->arch.mm_perdomain_pt + (ed->vcpu_id << PDPT_VCPU_SHIFT); ed->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] = - l1e_create_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); + l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); } #ifdef CONFIG_VMX @@ -460,7 +460,7 @@ // trust the VMX domain builder. Xen should validate this // page table, and/or build the table itself, or ??? // - if ( !pagetable_get_phys(d->arch.phys_table) ) + if ( !pagetable_get_paddr(d->arch.phys_table) ) d->arch.phys_table = ed->arch.guest_table; if ( (error = vmx_final_setup_guest(ed, c)) ) @@ -660,7 +660,7 @@ struct exec_domain *ed = current; if ( unlikely(copy_from_user(&stu, (void *)regs->rsp, sizeof(stu))) || - unlikely(pagetable_get_phys(ed->arch.guest_table_user) == 0) ) + unlikely(pagetable_get_paddr(ed->arch.guest_table_user) == 0) ) return -EFAULT; toggle_guest_mode(ed); @@ -978,7 +978,7 @@ /* Drop the in-use references to page-table bases. */ for_each_exec_domain ( d, ed ) { - if ( pagetable_get_phys(ed->arch.guest_table) != 0 ) + if ( pagetable_get_paddr(ed->arch.guest_table) != 0 ) { if ( shadow_mode_refcounts(d) ) put_page(&frame_table[pagetable_get_pfn(ed->arch.guest_table)]); @@ -988,7 +988,7 @@ ed->arch.guest_table = mk_pagetable(0); } - if ( pagetable_get_phys(ed->arch.guest_table_user) != 0 ) + if ( pagetable_get_paddr(ed->arch.guest_table_user) != 0 ) { if ( shadow_mode_refcounts(d) ) put_page(&frame_table[pagetable_get_pfn(ed->arch.guest_table_user)]); diff -Nru a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c 2005-06-01 06:03:03 -04:00 +++ b/xen/arch/x86/domain_build.c 2005-06-01 06:03:03 -04:00 @@ -263,15 +263,15 @@ l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += 4*PAGE_SIZE; memcpy(l2tab, idle_pg_table_l2, 4*PAGE_SIZE); for (i = 0; i < 4; i++) { - l3tab[i] = l3e_create_phys((u32)l2tab + i*PAGE_SIZE, L3_PROT); + l3tab[i] = l3e_from_paddr((u32)l2tab + i*PAGE_SIZE, L3_PROT); l2tab[(LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT)+i] = - l2e_create_phys((u32)l2tab + i*PAGE_SIZE, __PAGE_HYPERVISOR); + l2e_from_paddr((u32)l2tab + i*PAGE_SIZE, __PAGE_HYPERVISOR); } unsigned long v; for (v = PERDOMAIN_VIRT_START; v < PERDOMAIN_VIRT_END; v += (1 << L2_PAGETABLE_SHIFT)) { l2tab[v >> L2_PAGETABLE_SHIFT] = - l2e_create_phys(__pa(d->arch.mm_perdomain_pt) + (v-PERDOMAIN_VIRT_START), + l2e_from_paddr(__pa(d->arch.mm_perdomain_pt) + (v-PERDOMAIN_VIRT_START), __PAGE_HYPERVISOR); } ed->arch.guest_table = mk_pagetable((unsigned long)l3start); @@ -279,9 +279,9 @@ l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; memcpy(l2tab, &idle_pg_table[0], PAGE_SIZE); l2tab[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] = - l2e_create_phys((unsigned long)l2start, __PAGE_HYPERVISOR); + l2e_from_paddr((unsigned long)l2start, __PAGE_HYPERVISOR); l2tab[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT] = - l2e_create_phys(__pa(d->arch.mm_perdomain_pt), __PAGE_HYPERVISOR); + l2e_from_paddr(__pa(d->arch.mm_perdomain_pt), __PAGE_HYPERVISOR); ed->arch.guest_table = mk_pagetable((unsigned long)l2start); #endif @@ -293,13 +293,13 @@ { l1start = l1tab = (l1_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; - *l2tab = l2e_create_phys((unsigned long)l1start, L2_PROT); + *l2tab = l2e_from_paddr((unsigned long)l1start, L2_PROT); l2tab++; clear_page(l1tab); if ( count == 0 ) l1tab += l1_table_offset(dsi.v_start); } - *l1tab = l1e_create_pfn(mfn, L1_PROT); + *l1tab = l1e_from_pfn(mfn, L1_PROT); l1tab++; page = &frame_table[mfn]; @@ -311,13 +311,13 @@ /* Pages that are part of page tables must be read only. */ l2tab = l2start + l2_linear_offset(vpt_start); - l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_phys(*l2tab); + l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_paddr(*l2tab); l1tab += l1_table_offset(vpt_start); for ( count = 0; count < nr_pt_pages; count++ ) { page = &frame_table[l1e_get_pfn(*l1tab)]; if ( !opt_dom0_shadow ) - l1e_remove_flags(l1tab, _PAGE_RW); + l1e_remove_flags(*l1tab, _PAGE_RW); else if ( !get_page_type(page, PGT_writable_page) ) BUG(); @@ -384,7 +384,7 @@ } #endif if ( !((unsigned long)++l1tab & (PAGE_SIZE - 1)) ) - l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_phys(*++l2tab); + l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_paddr(*++l2tab); } #elif defined(__x86_64__) @@ -402,9 +402,9 @@ l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE; memcpy(l4tab, &idle_pg_table[0], PAGE_SIZE); l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] = - l4e_create_phys(__pa(l4start), __PAGE_HYPERVISOR); + l4e_from_paddr(__pa(l4start), __PAGE_HYPERVISOR); l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] = - l4e_create_phys(__pa(d->arch.mm_perdomain_l3), __PAGE_HYPERVISOR); + l4e_from_paddr(__pa(d->arch.mm_perdomain_l3), __PAGE_HYPERVISOR); ed->arch.guest_table = mk_pagetable(__pa(l4start)); l4tab += l4_table_offset(dsi.v_start); @@ -433,16 +433,16 @@ clear_page(l3tab); if ( count == 0 ) l3tab += l3_table_offset(dsi.v_start); - *l4tab = l4e_create_phys(__pa(l3start), L4_PROT); + *l4tab = l4e_from_paddr(__pa(l3start), L4_PROT); l4tab++; } - *l3tab = l3e_create_phys(__pa(l2start), L3_PROT); + *l3tab = l3e_from_paddr(__pa(l2start), L3_PROT); l3tab++; } - *l2tab = l2e_create_phys(__pa(l1start), L2_PROT); + *l2tab = l2e_from_paddr(__pa(l1start), L2_PROT); l2tab++; } - *l1tab = l1e_create_pfn(mfn, L1_PROT); + *l1tab = l1e_from_pfn(mfn, L1_PROT); l1tab++; page = &frame_table[mfn]; @@ -463,7 +463,7 @@ l1tab += l1_table_offset(vpt_start); for ( count = 0; count < nr_pt_pages; count++ ) { - l1e_remove_flags(l1tab, _PAGE_RW); + l1e_remove_flags(*l1tab, _PAGE_RW); page = &frame_table[l1e_get_pfn(*l1tab)]; /* Read-only mapping + PGC_allocated + page-table page. */ @@ -633,10 +633,10 @@ // map this domain's p2m table into current page table, // so that we can easily access it. // - ASSERT( root_get_value(idle_pg_table[1]) == 0 ); - ASSERT( pagetable_get_phys(d->arch.phys_table) ); - idle_pg_table[1] = root_create_phys( - pagetable_get_phys(d->arch.phys_table), __PAGE_HYPERVISOR); + ASSERT( root_get_intpte(idle_pg_table[1]) == 0 ); + ASSERT( pagetable_get_paddr(d->arch.phys_table) ); + idle_pg_table[1] = root_from_paddr( + pagetable_get_paddr(d->arch.phys_table), __PAGE_HYPERVISOR); translate_l2pgtable(d, (l1_pgentry_t *)(1u << L2_PAGETABLE_SHIFT), pagetable_get_pfn(ed->arch.guest_table)); idle_pg_table[1] = root_empty(); diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c 2005-06-01 06:03:03 -04:00 +++ b/xen/arch/x86/mm.c 2005-06-01 06:03:03 -04:00 @@ -234,7 +234,7 @@ void write_ptbase(struct exec_domain *ed) { - write_cr3(pagetable_get_phys(ed->arch.monitor_table)); + write_cr3(pagetable_get_paddr(ed->arch.monitor_table)); } void invalidate_shadow_ldt(struct exec_domain *d) @@ -333,7 +333,7 @@ if ( unlikely(!res) ) return 0; - nl1e = l1e_create_pfn(gmfn, l1e_get_flags(l1e) | _PAGE_RW); + nl1e = l1e_from_pfn(gmfn, l1e_get_flags(l1e) | _PAGE_RW); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |