Date: Sat, 14 Oct 2006 15:01:35 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 107895 for review Message-ID: <200610141501.k9EF1ZeI028447@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107895 Change 107895 by gonzo@gonzo_hq on 2006/10/14 15:00:40 o Increase size of pteobject. We should take into account segtab itself, not only segment maps. o Create segment maps for userland VM on request. Affected files ... .. //depot/projects/mips2/src/sys/mips/include/pmap.h#6 edit .. //depot/projects/mips2/src/sys/mips/mips/pmap.c#13 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/include/pmap.h#6 (text+ko) ==== @@ -134,6 +134,9 @@ #define MIPS_PMAP_SEGTABSIZE 512 #define MIPS_PMAP_SEGSIZE 1024 +#define pmap_segmap(m, v) \ + ((m)->pm_private.pm_segtab->seg_tab[((v) >> SEGSHIFT)]) + struct segtab { pt_entry_t *seg_tab[MIPS_PMAP_SEGTABSIZE]; }; ==== //depot/projects/mips2/src/sys/mips/mips/pmap.c#13 (text+ko) ==== @@ -216,18 +216,11 @@ pt_entry_t *pte = NULL; if (va < MIPS_KSEG0_START) { - /* XXX Try to avoid TLB refills */ -#if 0 - unsigned long lev1; - lev1 = (unsigned long)pmap->pm_lev1; - lev1 = (unsigned long)tlb_pte_find(kptmap, lev1); - lev1 = (unsigned long)MIPS_PTE_TO_PA(*(pt_entry_t *)lev1); - pte = tlb_pte_find( - (pt_entry_t *)MIPS_PHYS_TO_KSEG0((pt_entry_t *)lev1), va); -#endif - panic("XXXMIPS: %s to implement", __func__); + pte = pmap_segmap(pmap, va); + pte += (va >> PAGE_SHIFT) & (NPTEPG - 1); } else pte = tlb_kern_pte_find(kptmap, va); + return pte; } @@ -731,7 +724,8 @@ */ if (pmap->pm_pteobj == NULL) pmap->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, - MIPS_PMAP_SEGTABSIZE * MIPS_PMAP_SEGSIZE + 1); + MIPS_PMAP_SEGTABSIZE * MIPS_PMAP_SEGSIZE + + + MIPS_PMAP_SEGTABSIZE * sizeof(pt_entry_t *) + 1); VM_OBJECT_LOCK(pmap->pm_pteobj); lev1pg = vm_page_grab(pmap->pm_pteobj, @@ -1143,7 +1137,7 @@ vm_offset_t pa; pt_entry_t *pte; vm_offset_t opa; - vm_page_t mpte; + vm_page_t mpte, mem; if (pmap == NULL) return; @@ -1161,6 +1155,24 @@ * resident, we are creating it here. */ if (va < VM_MAXUSER_ADDRESS) { + if(pmap_segmap(pmap, va) == NULL) + { + VM_OBJECT_LOCK(pmap->pm_pteobj); + + mem = vm_page_grab(pmap->pm_pteobj, + MIPS_PMAP_SEGSIZE, + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | \ + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + + vm_page_lock_queues(); + vm_page_flag_clear(mem, PG_BUSY); + mem->valid = VM_PAGE_BITS_ALL; + vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(pmap->pm_pteobj); + + pmap_segmap(pmap, va) = + (pt_entry_t *)MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem)); + } } pte = pmap_pte(pmap, va);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610141501.k9EF1ZeI028447>