On 07/11/2010 06:42 PM, Avi Kivity wrote:
Paritition the function into three sections: - fetching indirect shadow pages (host_level> guest_level) - fetching direct shadow pages (page_level< host_level<= guest_level) - the final spte (page_level == host_level) Instead of the current spaghetti.
+ + for (; + shadow_walk_okay(&iterator)&& iterator.level> hlevel; + shadow_walk_next(&iterator)) { + gfn_t direct_gfn; + + level = iterator.level; + sptep = iterator.sptep; drop_spte_if_large(vcpu, sptep); if (is_shadow_present_pte(*sptep)) continue; - if (level<= gw->level) { - direct = 1; - access = direct_access; - - /* - * It is a large guest pages backed by small host pages, - * So we set @direct(@sp->role.direct)=1, and set - * @table_gfn(@sp->gfn)=the base page frame for linear - * translations. - */ - table_gfn = gw->gfn& ~(KVM_PAGES_PER_HPAGE(level) - 1); - } else { - direct = 0; - table_gfn = gw->table_gfn[level - 2]; - } - sp = kvm_mmu_get_page(vcpu, table_gfn, addr, level-1, - direct, access, sptep); - if (!direct) - if (!FNAME(validate_indirect_spte)(vcpu, sptep, sp, - gw, level)) { - kvm_release_pfn_clean(pfn); - sptep = NULL; - break; - } + validate_direct_spte(vcpu, sptep, direct_access); + + direct_gfn = gw->gfn& ~(KVM_PAGES_PER_HPAGE(level) - 1); + sp = kvm_mmu_get_page(vcpu, direct_gfn, addr, level-1, + true, direct_access, sptep); link_shadow_page(sptep, sp); }
validate_direct_spte() should be before the 'continue' above, probably. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html