Date: Wed, 24 Oct 2001 13:22:07 -0500 (CDT) From: mark tinguely <tinguely@web.cs.ndsu.nodak.edu> To: freebsd-questions@FreeBSD.ORG, xuyifeng@peoplemail.com.cn Subject: Re: A stupid question about pmap Message-ID: <200110241822.f9OIM7605946@web.cs.ndsu.nodak.edu> In-Reply-To: <001b01c15c27$2332db60$ef01a8c0@davidwnt>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110241822.f9OIM7605946>