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>

next in thread | raw e-mail | index | archive | help
Hi,

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

--------
static unsigned *
get_ptbase(pmap)
    pmap_t pmap;
{
    unsigned frame =3D (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME;

    /* are we current address space or kernel? */
    if (pmap =3D=3D kernel_pmap || frame =3D=3D (((unsigned) PTDpde) & =
PG_FRAME)){
        return (unsigned *) PTmap;
    }
    /* otherwise, we are alternate address space */
    if (frame !=3D (((unsigned) APTDpde) & PG_FRAME)) {
        APTDpde =3D (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=20
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 =3D 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




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