Date: Sun, 2 Nov 2003 16:01:58 -0800 (PST) From: Juli Mallett <jmallett@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 41145 for review Message-ID: <200311030001.hA301w0a046544@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=41145 Change 41145 by jmallett@jmallett_dalek on 2003/11/02 16:01:46 Remove useless constants. Remove undefined stuff from pmap, since some of it relies on constants I'm not comfy with right now. Use consistent PAGE_SIZE/PAGE_SHIFT constants (or try to), so as to not be bitten by pages being 4K, but being treated like they're 8K or something stupid like that. The VPN2 *is* divided by two, so don't trim an extra bit for no good reason. Basically, if we're doing 4K pages (we are), then the VPN2 starts at bit13, whereas a VPN starts at bit12, so we have a full 0xf...f, not 0xf...e. Gets to cpu probe stuff again, only to blow up in more confusing ways down the line (callouts being bzero'd). Affected files ... .. //depot/projects/mips/sys/mips/include/param.h#12 edit .. //depot/projects/mips/sys/mips/include/pmap.h#12 edit .. //depot/projects/mips/sys/mips/include/pte.h#13 edit .. //depot/projects/mips/sys/mips/mips/exception.S#7 edit .. //depot/projects/mips/sys/mips/mips/pmap.c#21 edit .. //depot/projects/mips/sys/mips/mips/tlb.c#10 edit Differences ... ==== //depot/projects/mips/sys/mips/include/param.h#12 (text+ko) ==== @@ -29,9 +29,6 @@ * to be the number of per-process-wired kernel-stack pages/PTES. */ -#define SSIZE 1 /* initial stack size/NBPG */ -#define SINCR 1 /* increment of stack/NBPG */ - #define UPAGES 2 /* pages of u-area */ #define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ @@ -69,47 +66,21 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) -#define NBPG 8192 /* bytes/page */ -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define PGSHIFT 13 /* LOG2(NBPG) */ -#define NPTEPG (NBPG/4) - -#define NBSEG 0x400000 /* bytes/segment */ -#define SEGOFSET (NBSEG-1) /* byte offset into segment */ -#define SEGSHIFT 22 /* LOG2(NBSEG) */ +#define NBPG (PAGE_SIZE) -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) - #define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) -/* pages ("clicks") (4096 bytes) to disk blocks */ -#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) -#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) - /* pages to bytes */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) +#define ctob(x) ((x) << PAGE_SHIFT) +#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT) /* bytes to disk blocks */ #define btodb(x) ((x) >> DEV_BSHIFT) #define dbtob(x) ((x) << DEV_BSHIFT) /* - * Map a ``block device block'' to a file system block. - * This should be device dependent, and should use the bsize - * field from the disk label. - * For now though just use DEV_BSIZE. - */ -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) - -/* * Mach derived conversion macros */ #define round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1)) ==== //depot/projects/mips/sys/mips/include/pmap.h#12 (text+ko) ==== @@ -87,30 +87,6 @@ #endif /*!LOCORE*/ -#define NLPT 3 /* levels of page tables */ -#define MIPS_PTSHIFT (PAGE_SHIFT-NLPT) /* bits that index within page tables */ -#define MIPS_PGBYTES (1 << PAGE_SHIFT) -#define MIPS_L3SHIFT PAGE_SHIFT -#define MIPS_L2SHIFT (MIPS_L3SHIFT+MIPS_PTSHIFT) -#define MIPS_L1SHIFT (MIPS_L2SHIFT+MIPS_PTSHIFT) - -/* - * Pte related macros - */ -#define VADDR(l1, l2, l3) (((l1) << MIPS_L1SHIFT) \ - + ((l2) << MIPS_L2SHIFT) \ - + ((l3) << MIPS_L3SHIFT) - -#ifndef NKPT -#define NKPT 9 /* initial number of kernel page tables */ -#endif -#define NKLEV2MAPS 255 /* max number of lev2 page tables */ -#define NKLEV3MAPS (NKLEV2MAPS << MIPS_PTSHIFT) /* max number of lev3 page tables */ - -#define PTLEV1I (NPTEPG-1) /* Lev0 entry that points to Lev0 */ -#define K0SEGLEV1I (NPTEPG/2) -#define K1SEGLEV1I (K0SEGLEV1I+(NPTEPG/4)) - #define NUSERLEV2MAPS (NPTEPG/2) #define NUSERLEV3MAPS (NUSERLEV2MAPS << MIPS_PTSHIFT) ==== //depot/projects/mips/sys/mips/include/pte.h#13 (text+ko) ==== @@ -79,9 +79,9 @@ #define MIPS_HI_FILL_SHIFT 40 #define MIPS_HI_VPN2_SHIFT 13 #ifdef LOCORE -#define MIPS_HI_VPN2_BMASK 0xFFFFFFE +#define MIPS_HI_VPN2_BMASK 0xFFFFFFF #else -#define MIPS_HI_VPN2_BMASK 0xFFFFFFEUL +#define MIPS_HI_VPN2_BMASK 0xFFFFFFFUL #endif #define MIPS_HI_VPN2_MASK (MIPS_HI_VPN2_BMASK << MIPS_HI_VPN2_SHIFT) #define MIPS_HI_VA_TO_VPN2(va) ((va) & MIPS_HI_VPN2_MASK) ==== //depot/projects/mips/sys/mips/mips/exception.S#7 (text+ko) ==== ==== //depot/projects/mips/sys/mips/mips/pmap.c#21 (text+ko) ==== @@ -622,7 +622,7 @@ pmap_kenter(vm_offset_t va, vm_offset_t pa) { - tlb_enter(kernel_pmap, va, pa, PG_V | PG_W); + tlb_enter(kernel_pmap, va, pa, PG_G | PG_V | PG_W); } /* @@ -903,34 +903,7 @@ pmap_pinit(pmap) register struct pmap *pmap; { - vm_page_t lev1pg; - - /* - * allocate object for the ptes - */ - if (pmap->pm_pteobj == NULL) - pmap->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, NUSERLEV3MAPS + NUSERLEV2MAPS + 1); - - /* - * allocate the page directory page - */ - lev1pg = vm_page_grab(pmap->pm_pteobj, NUSERLEV3MAPS + NUSERLEV2MAPS, - VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); - - vm_page_lock_queues(); - vm_page_flag_clear(lev1pg, PG_BUSY); - lev1pg->valid = VM_PAGE_BITS_ALL; - vm_page_unlock_queues(); - - pmap->pm_lev1 = (pt_entry_t*) MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(lev1pg)); - if ((lev1pg->flags & PG_ZERO) == 0) - bzero(pmap->pm_lev1, PAGE_SIZE); - - - /* install self-referential address mapping entry (no ASID) */ - pmap->pm_lev1[PTLEV1I] = pmap_phys_to_pte(VM_PAGE_TO_PHYS(lev1pg)) - | PG_G | PG_V; - + panic("pmap_pinit %p", pmap); pmap->pm_ptphint = NULL; pmap->pm_active = 0; pmap->pm_asid = 0; @@ -980,9 +953,12 @@ curgeneration = object->generation; for (p = TAILQ_FIRST(&object->memq); p != NULL; p = n) { n = TAILQ_NEXT(p, listq); + panic("release p from pmap (%p, %p)", p, pmap); +#if 0 /* XXX */ if (p->pindex >= NUSERLEV3MAPS) { continue; } +#endif while (1) { if (/*!pmap_release_free_page(pmap, p) &&*/ (object->generation != curgeneration)) @@ -991,6 +967,7 @@ } for (p = TAILQ_FIRST(&object->memq); p != NULL; p = n) { n = TAILQ_NEXT(p, listq); +#if 0 /* XXX */ if (p->pindex < NUSERLEV3MAPS) { /* can this happen? maybe panic */ goto retry; @@ -999,6 +976,7 @@ lev1pg = p; continue; } +#endif while (1) { if (/*!pmap_release_free_page(pmap, p) &&*/ (object->generation != curgeneration)) ==== //depot/projects/mips/sys/mips/mips/tlb.c#10 (text+ko) ==== @@ -109,7 +109,7 @@ if ((bits & PG_V) == 0) printf("pmap %p entering invalid mapping for va %lx to pa %lx [%lx]\n", pmap, (u_long)va, (u_long)pa, (u_long)bits); - *pte = MIPS_PA_TO_PFN(pa) | bits | PG_G; + *pte = MIPS_PA_TO_PFN(pa) | bits; } void @@ -176,7 +176,7 @@ u_long ehi; /* Bogus VPN2. */ - ehi = MIPS_XKSEG_START + 2 * i * PAGE_SIZE; + ehi = MIPS_KSEG1_END + 2 * i * PAGE_SIZE; mips_wr_index(i); mips_wr_entryhi(ehi); mips_tlbwi();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311030001.hA301w0a046544>