From owner-freebsd-questions Tue Oct 23 17:57:58 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.viasoft.com.cn (unknown [61.153.1.177]) by hub.freebsd.org (Postfix) with ESMTP id 098DA37B405 for ; Tue, 23 Oct 2001 17:57:55 -0700 (PDT) Received: from davidwnt (davidwnt.viasoft.com.cn [192.168.1.239]) by mail.viasoft.com.cn (8.9.3/8.9.3) with SMTP id JAA06039 for ; Wed, 24 Oct 2001 09:03:49 +0800 Message-ID: <001b01c15c27$2332db60$ef01a8c0@davidwnt> From: "XuYifeng" To: Subject: A stupid question about pmap Date: Wed, 24 Oct 2001 08:59:30 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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