From owner-p4-projects@FreeBSD.ORG Sun Jan 4 17:43:02 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EA93F16A4D0; Sun, 4 Jan 2004 17:43:01 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC38016A4CE for ; Sun, 4 Jan 2004 17:43:01 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 782FC43D1F for ; Sun, 4 Jan 2004 17:43:00 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i051h00B066186 for ; Sun, 4 Jan 2004 17:43:00 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i051h0BC066183 for perforce@freebsd.org; Sun, 4 Jan 2004 17:43:00 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Sun, 4 Jan 2004 17:43:00 -0800 (PST) Message-Id: <200401050143.i051h0BC066183@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 44796 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2004 01:43:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=44796 Change 44796 by jmallett@jmallett_oingo on 2004/01/04 17:42:37 Handle page sizing/masking appropriately, along with all the fun bit shifting that goes along with that. Did this on a hunch, due to bad things happening with allocated memory... And now I see SI_SUB_VFS scroll by. Affected files ... .. //depot/projects/mips/sys/mips/include/pte.h#19 edit .. //depot/projects/mips/sys/mips/mips/tlb.c#18 edit Differences ... ==== //depot/projects/mips/sys/mips/include/pte.h#19 (text+ko) ==== @@ -67,13 +67,11 @@ #define MIPS_HI_FILL_MASK ((0x7FFFFFUL) << MIPS_HI_FILL_SHIFT) #define MIPS_HI_VA_FILL(va) ((((va) & (1UL << 63)) != 0 ? MIPS_HI_FILL_MASK : 0)) #define MIPS_HI_VPN2_SHIFT (PAGE_SHIFT + 1) -/* XXX VPN2 masking is wrong. Should trim off below VPN2_SHIFT, and from FILL_SHIFT up. */ #ifdef LOCORE -#define MIPS_HI_VPN2_BMASK 0xFFFFFFF +#define MIPS_HI_VPN2_MASK (((~((1 << MIPS_HI_VPN2_SHIFT) - 1)) << (63 - MIPS_HI_FILL_SHIFT)) >> (63 - MIPS_HI_FILL_SHIFT)) #else -#define MIPS_HI_VPN2_BMASK 0xFFFFFFFUL +#define MIPS_HI_VPN2_MASK (((~((1UL << MIPS_HI_VPN2_SHIFT) - 1)) << (63 - MIPS_HI_FILL_SHIFT)) >> (63 - MIPS_HI_FILL_SHIFT)) #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) #define MIPS_HI_ENTRY(va, asid) ((MIPS_HI_VA_R((va))) /* Region. */ | \ (MIPS_HI_VA_FILL((va))) /* Fill. */ | \ ==== //depot/projects/mips/sys/mips/mips/tlb.c#18 (text+ko) ==== @@ -66,12 +66,32 @@ static int tlb_maxasid = MIPS_TLB_NUM_ASIDS; #endif +/* + * Set up the page size, chop off the low PAGE_SHIFT bits, + * and then shift off the upper bits. + */ +static u_long +tlb_pagemask(vm_size_t pageshift) +{ + u_long pm; + + pm = ~0UL; + pm >>= PAGE_SHIFT + 1; + pm <<= PAGE_SHIFT + 1; + pm <<= 7; + pm >>= 7; + + return (pm); +} + void tlb_bootstrap(vm_size_t pages, vm_offset_t (*ptalloc)(vm_size_t)) { pt_entry_t *pte; vm_size_t i; + mips_wr_pagemask(tlb_pagemask(PAGE_SHIFT)); + /* * Set up KPT. */ @@ -166,6 +186,7 @@ mips_wr_entrylo0(pte0); mips_wr_entrylo1(pte1); mips_wr_entryhi(ehi); + mips_wr_pagemask(tlb_pagemask(PAGE_SHIFT)); if (i < 0) mips_tlbwr(); else