From owner-freebsd-current Fri Aug 24 19:41:31 2001 Delivered-To: freebsd-current@freebsd.org Received: from InterJet.elischer.org (c421509-a.pinol1.sfba.home.com [24.7.86.9]) by hub.freebsd.org (Postfix) with ESMTP id DDFB937B406 for ; Fri, 24 Aug 2001 19:41:19 -0700 (PDT) (envelope-from julian@elischer.org) Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id TAA61270 for ; Fri, 24 Aug 2001 19:51:32 -0700 (PDT) Date: Fri, 24 Aug 2001 19:51:31 -0700 (PDT) From: Julian Elischer To: current@freebsd.org Subject: Silliness in pmap code? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Consider the folowing function: /* * Super fast pmap_pte routine best used when scanning * the pv lists. This eliminates many coarse-grained * invltlb calls. Note that many of the pv list * scans are across different pmaps. It is very wasteful * to do an entire invltlb for checking a single mapping. */ static unsigned * pmap_pte_quick(pmap, va) register pmap_t pmap; vm_offset_t va; { unsigned pde, newpf; /* * Check if the appropriate PDE is valid. If not, we're done. */ **A** if ((pde = (unsigned) pmap->pm_pdir[va >> PDRSHIFT]) != 0) { unsigned frame = (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME; unsigned index = i386_btop(va); /* are we current address space or kernel? */ /* If so, use the exsiting PTE mappings into KVE space */ if ((pmap == kernel_pmap) || (frame == (((unsigned) PTDpde) & PG_FRAME))) { return (unsigned *) PTmap + index; } /* * IF not, set up a single page to map * the approptiate PTEs into * thos doesn;t make sense since the PDIR test above * only applies to the current pmap */ newpf = pde & PG_FRAME; if ( ((* (unsigned *) PMAP1) & PG_FRAME) != newpf) { * (unsigned *) PMAP1 = newpf | PG_RW | PG_V; invltlb_1pg((vm_offset_t) PADDR1); } return PADDR1 + ((unsigned) index & (NPTEPG - 1)); } return (0); } The test marked **A** only applies to the current pmap However inside the test, we check to see if we are talking about the current pmap, or another pmap. If other pmaps are allowed top be examined, then the foirst test is flawed, otherwise, if other maps are not to be examined using this function, then the second part of the inside of the clause is not needed.. (and should be a panic) which is correct? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message