From owner-freebsd-current Fri Aug 24 22:17:17 2001 Delivered-To: freebsd-current@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 1EB1437B403 for ; Fri, 24 Aug 2001 22:17:13 -0700 (PDT) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.6/8.11.2) id f7P5GaX04651; Fri, 24 Aug 2001 22:16:36 -0700 (PDT) (envelope-from dillon) Date: Fri, 24 Aug 2001 22:16:36 -0700 (PDT) From: Matt Dillon Message-Id: <200108250516.f7P5GaX04651@earth.backplane.com> To: Julian Elischer Cc: current@FreeBSD.ORG Subject: Re: Silliness in pmap code? References: 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 :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 I think it applies to the passed pmap. pmap->pm_pdir is mapped into KVA independant of the fixed page table maps so any pmap's page directory page can be examined without having to pull any tricks. Then it checks to see if the passed pmap happens to be the current pmap. If it does, then it can use the linear PTmap in VM that represents the page tables to access the pte. If the passed pmap is not the current pmap then it maps the page table page via PMAP1 in order to access the pte. -Matt :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