From owner-freebsd-hackers Wed Jul 29 00:57:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA06442 for freebsd-hackers-outgoing; Wed, 29 Jul 1998 00:57:31 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA06436 for ; Wed, 29 Jul 1998 00:57:27 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from herring.nlsystems.com (herring.nlsystems.com [10.0.0.2]) by nlsystems.com (8.8.8/8.8.5) with SMTP id IAA08172; Wed, 29 Jul 1998 08:58:28 +0100 (BST) Date: Wed, 29 Jul 1998 08:58:28 +0100 (BST) From: Doug Rabson To: zhihuizhang cc: hackers Subject: Re: Still confused with PTDpde/APTDpde In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 28 Jul 1998, zhihuizhang wrote: > > I spend another day thinking about the usage of PTDpde/APTDpde in pmap.c > and still confused with them. It must have something to do with VA->PA > translation and mixed assembly / C programming: > > (1) First of all, If we have the following lines in GAS: > > .global _xx > .set _xx, 30 > > We have defined a global (absolute?) symbol _xx whose value is 30. Now, I > refer to _xx in C by xx. What is the value (left or right?) of xx? In > other words, is the address of xx 30 or is the value of xx 30? The address of xx is 30. If we declare xx in C as: pd_entry_t xx; then one can use xx to reference the pd_entry_t which is stored at address 30. > > (2) If the value of xx is 30. Then look at locore.s where PTDped/APTDpde > is defined in the same way. Both PTDpde and APTDpde has very special > values (an address whose PDE, PTE, offset parts are the same). The > question is what is the meaning of (unsigned)PTDpde & PG_FRAME and > (unsigned)APTDpde & PG_FRAME in pmap.c? To make sense, the address (not > value) of xx must be 30. That is correct. The meaning of '(unsigned)PTDpde & PG_FRAME' is 'the physical address of the page directory of the current address space' (since PTmap maps the current address space's ptes). The meaning of '(unsigned)APTDpde & PG_FRAME is 'the physical address of the page directory of the alternate address space'. Note that both PTDpde and APTDpde reference pd_entry_t's in the current address space. > > (3) If this is correct, only PTDpde works well because we set up the > self-referential pde entry in pmap_pinit(). But for APTDpde, it does not > work the same way. How can APTDpde used to access other process's page > tables? This confused me as well when I reviewed the i386 pmap before porting it to alpha. When we access an alternate address space's page tables, we install it in APTmap by setting APTDpde to the alternate's page directory. Since the alternate address space has its own self referencial mapping at directory index PTDPTDI, the page directory for it is available at address APTD. This kind of thing is a whole lot easier on the alpha since there is a 1-1 virtual-physical window which can be used to access page tables. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891 Fax: +44 181 381 1039 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message