Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2001 08:59:30 +0800
From:      "XuYifeng" <xuyifeng@peoplemail.com.cn>
To:        <freebsd-questions@freebsd.org>
Subject:   A stupid question about pmap
Message-ID:  <001b01c15c27$2332db60$ef01a8c0@davidwnt>

index | next in thread | raw e-mail

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



help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001b01c15c27$2332db60$ef01a8c0>