# HG changeset patch # User tristan.gingold@xxxxxxxx # Node ID ff7a0216cc695b885fcb84d655156b356d15322c # Parent c8317dfab40fda8b56f886cfb2ee2fbb1c3b1811 struct mm is now a field of struct domain (instead of a pointer). Signed-off-by: Tristan Gingold diff -r c8317dfab40f -r ff7a0216cc69 xen/arch/ia64/linux-xen/setup.c --- a/xen/arch/ia64/linux-xen/setup.c Fri May 12 08:25:13 2006 +++ b/xen/arch/ia64/linux-xen/setup.c Fri May 12 09:53:24 2006 @@ -800,8 +800,7 @@ cpu_data = per_cpu_init(); #ifdef XEN - printf ("cpu_init: current=%p, current->domain->arch.mm=%p\n", - current, current->domain->arch.mm); + printf ("cpu_init: current=%p\n", current); #endif /* @@ -871,12 +870,11 @@ atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; #endif -#ifdef XEN - if (current->domain->arch.mm) -#else +#ifndef XEN if (current->mm) -#endif BUG(); +#endif + #ifdef XEN ia64_fph_enable(); diff -r c8317dfab40f -r ff7a0216cc69 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Fri May 12 08:25:13 2006 +++ b/xen/arch/ia64/xen/domain.c Fri May 12 09:53:24 2006 @@ -77,15 +77,14 @@ static void init_switch_stack(struct vcpu *v); void build_physmap_table(struct domain *d); -/* this belongs in include/asm, but there doesn't seem to be a suitable place */ void arch_domain_destroy(struct domain *d) { struct page_info *page; struct list_head *ent, *prev; - if (d->arch.mm->pgd != NULL) + if (d->arch.mm.pgd != NULL) { - list_for_each ( ent, &d->arch.mm->pt_list ) + list_for_each ( ent, &d->arch.mm.pt_list ) { page = list_entry(ent, struct page_info, list); prev = ent->prev; @@ -93,10 +92,8 @@ free_xenheap_page(page_to_virt(page)); ent = prev; } - pgd_free(d->arch.mm->pgd); - } - if (d->arch.mm != NULL) - xfree(d->arch.mm); + pgd_free(d->arch.mm.pgd); + } if (d->shared_info != NULL) free_xenheap_page(d->shared_info); @@ -257,23 +254,19 @@ goto fail_nomem; d->arch.sys_pgnr = 0; - if ((d->arch.mm = xmalloc(struct mm_struct)) == NULL) - goto fail_nomem; - memset(d->arch.mm, 0, sizeof(*d->arch.mm)); - INIT_LIST_HEAD(&d->arch.mm->pt_list); + memset(&d->arch.mm, 0, sizeof(d->arch.mm)); + INIT_LIST_HEAD(&d->arch.mm.pt_list); d->arch.physmap_built = 0; - if ((d->arch.mm->pgd = pgd_alloc(d->arch.mm)) == NULL) + if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL) goto fail_nomem; printf ("arch_domain_create: domain=%p\n", d); return 0; fail_nomem: - if (d->arch.mm->pgd != NULL) - pgd_free(d->arch.mm->pgd); - if (d->arch.mm != NULL) - xfree(d->arch.mm); + if (d->arch.mm.pgd != NULL) + pgd_free(d->arch.mm.pgd); if (d->shared_info != NULL) free_xenheap_page(d->shared_info); return -ENOMEM; @@ -486,7 +479,7 @@ lookup_alloc_domain_pte(struct domain* d, unsigned long mpaddr) { struct page_info *pt; - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pgd_t *pgd; pud_t *pud; pmd_t *pmd; @@ -496,21 +489,21 @@ if (pgd_none(*pgd)) { pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr)); pt = maddr_to_page(pgd_val(*pgd)); - list_add_tail(&pt->list, &d->arch.mm->pt_list); + list_add_tail(&pt->list, &mm->pt_list); } pud = pud_offset(pgd, mpaddr); if (pud_none(*pud)) { pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr)); pt = maddr_to_page(pud_val(*pud)); - list_add_tail(&pt->list, &d->arch.mm->pt_list); + list_add_tail(&pt->list, &mm->pt_list); } pmd = pmd_offset(pud, mpaddr); if (pmd_none(*pmd)) { pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm, mpaddr)); pt = maddr_to_page(pmd_val(*pmd)); - list_add_tail(&pt->list, &d->arch.mm->pt_list); + list_add_tail(&pt->list, &mm->pt_list); } return pte_offset_map(pmd, mpaddr); @@ -520,7 +513,7 @@ static pte_t* lookup_noalloc_domain_pte(struct domain* d, unsigned long mpaddr) { - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pgd_t *pgd; pud_t *pud; pmd_t *pmd; @@ -548,7 +541,7 @@ static pte_t* lookup_noalloc_domain_pte_none(struct domain* d, unsigned long mpaddr) { - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pgd_t *pgd; pud_t *pud; pmd_t *pmd; @@ -738,7 +731,7 @@ static void zap_domain_page_one(struct domain *d, unsigned long mpaddr) { - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pte_t *pte; pte_t old_pte; unsigned long mfn; @@ -946,7 +939,7 @@ assign_domain_page_replace(struct domain *d, unsigned long mpaddr, unsigned long mfn, unsigned int flags) { - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pte_t* pte; pte_t old_pte; @@ -1064,7 +1057,7 @@ return GNTST_general_error;//XXX GNTST_bad_pseudo_phys_addr // update pte - old_pte = ptep_get_and_clear(d->arch.mm, gpaddr, pte); + old_pte = ptep_get_and_clear(&d->arch.mm, gpaddr, pte); if (pte_present(old_pte)) { old_mfn = pte_pfn(old_pte);//XXX } @@ -1180,7 +1173,7 @@ /* Flush cache of domain d. */ void domain_cache_flush (struct domain *d, int sync_only) { - struct mm_struct *mm = d->arch.mm; + struct mm_struct *mm = &d->arch.mm; pgd_t *pgd = mm->pgd; unsigned long maddr; int i,j,k, l; diff -r c8317dfab40f -r ff7a0216cc69 xen/include/asm-ia64/domain.h --- a/xen/include/asm-ia64/domain.h Fri May 12 08:25:13 2006 +++ b/xen/include/asm-ia64/domain.h Fri May 12 09:53:24 2006 @@ -22,8 +22,14 @@ extern void panic_domain(struct pt_regs *, const char *, ...) __attribute__ ((noreturn, format (printf, 2, 3))); +struct mm_struct { + pgd_t * pgd; + // atomic_t mm_users; /* How many users with user space? */ + struct list_head pt_list; /* List of pagetable */ +}; + struct arch_domain { - struct mm_struct *mm; + struct mm_struct mm; unsigned long metaphysical_rr0; unsigned long metaphysical_rr4; @@ -105,18 +111,6 @@ struct arch_vmx_struct arch_vmx; /* Virtual Machine Extensions */ }; -//#define thread arch._thread - -// FOLLOWING FROM linux-2.6.7/include/sched.h - -struct mm_struct { - pgd_t * pgd; - // atomic_t mm_users; /* How many users with user space? */ - struct list_head pt_list; /* List of pagetable */ -}; - -extern struct mm_struct init_mm; - struct page_info * assign_new_domain_page(struct domain *d, unsigned long mpaddr); void assign_new_domain0_page(struct domain *d, unsigned long mpaddr); void assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr);