Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2001 21:02:21 -0400
From:      "Jonathan M. Slivko" <jslivko@4EverMail.com>
To:        "'XuYifeng'" <xuyifeng@peoplemail.com.cn>, <freebsd-hackers@freebsd.org>
Subject:   RE: A stupid question about pmap
Message-ID:  <000101c15c27$89207450$6501a8c0@sioux>
In-Reply-To: <001b01c15c27$2332db60$ef01a8c0@davidwnt>

next in thread | previous in thread | raw e-mail | index | archive | help
[forwarded to -hackers]

---------------------------------------------------
Jonathan Slivko - 4EverMail.COM - www.4evermail.com
   Web Hosting - Web Desgin - UNIX Shell Accounts
   jslivko@4EverMail.com - Phone: (212) 663-1109


-----Original Message-----
From: owner-freebsd-questions@FreeBSD.ORG
[mailto:owner-freebsd-questions@FreeBSD.ORG] On Behalf Of XuYifeng
Sent: Tuesday, October 23, 2001 9:00 PM
To: freebsd-questions@freebsd.org
Subject: A stupid question about pmap

Hi,

I am learning pmap code in FreeBSD 4.4-stable, and confused by some
code, 
for example, in function get_ptbase, the code is: 

--------
static unsigned *
get_ptbase(pmap)
    pmap_t pmap;
{
    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)){
        return (unsigned *) PTmap;
    }
    /* otherwise, we are alternate address space */
    if (frame != (((unsigned) APTDpde) & PG_FRAME)) {
        APTDpde = (pd_entry_t) (frame | PG_RW | PG_V);
#if defined(SMP)
    /* The page directory is not shared between CPUs */
    cpu_invltlb();
#else
    invltlb();
#endif
    }
    return (unsigned *) APTmap;
}
-----

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.

question is why could (pmap->pm_pdir[PTDPTDI] & PG_FRAME) and (PTDpde &
PG_FRAME)
be same thing? a physical address = a virtual address?
I am really confused by this.

Any help will be appreciated,
---
XuYifeng



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000101c15c27$89207450$6501a8c0>