From owner-freebsd-questions Wed Oct 24 11:23:32 2001 Delivered-To: freebsd-questions@freebsd.org Received: from web.cs.ndsu.nodak.edu (web.cs.ndsu.NoDak.edu [134.129.125.7]) by hub.freebsd.org (Postfix) with ESMTP id 7FF8837B405 for ; Wed, 24 Oct 2001 11:23:29 -0700 (PDT) Received: (from tinguely@localhost) by web.cs.ndsu.nodak.edu (8.11.4/8.11.4) id f9OIM7605946; Wed, 24 Oct 2001 13:22:07 -0500 (CDT) (envelope-from tinguely) Date: Wed, 24 Oct 2001 13:22:07 -0500 (CDT) From: mark tinguely Message-Id: <200110241822.f9OIM7605946@web.cs.ndsu.nodak.edu> To: freebsd-questions@FreeBSD.ORG, xuyifeng@peoplemail.com.cn Subject: Re: A stupid question about pmap In-Reply-To: <001b01c15c27$2332db60$ef01a8c0@davidwnt> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > unsigned frame = (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME; > > /* are we current address space or kernel? */ > if (pmap == kernel_pmap || frame == (((unsigned) PTDpde) & PG_FRAME)){ > > I know pm_pdir[PTDPTDI] contains page directory page's physical address, > while PTDpde is a virtual address to access page directory's page directory > entry which is recursivly mapped on virtual address space. pm_pdir[] entries are in kernel virtual address. see how it is being loaded/initialize, for example the kernel's pmap is loaded: kernel_pmap->pm_pdir = (pd_entry_t *) (KERNBASE + (u_int)IdlePTD); or more obvious: pmap->pm_pdir = (pd_entry_t *)kmem_alloc_pageable(kernel_map, PAGE_SIZE); and when we need to load the CR3 register, it gets turns it into a physical address: load_cr3(p->p_addr->u_pcb.pcb_cr3 = vtophys(pmap->pm_pdir)); This routine is simply checking to see this is the kernel map, or if the address space is the current PTD, if not we need to load the PTD into the Alternative PTD. --mark. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message