[forwarded to -hackers]

---------------------------------------------------
Jonathan Slivko - 4EverMail.COM - www.4evermail.com
   Web Hosting - Web Desgin - UNIX Shell Accounts
   [EMAIL PROTECTED] - Phone: (212) 663-1109


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of XuYifeng
Sent: Tuesday, October 23, 2001 9:00 PM
To: [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to