Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jul 1998 08:58:28 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        zhihuizhang <bf20761@binghamton.edu>
Cc:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: Still confused with PTDpde/APTDpde
Message-ID:  <Pine.BSF.4.01.9807290843040.631-100000@herring.nlsystems.com>
In-Reply-To: <Pine.SOL.L3.93.980728163817.15296A-100000@bingsun2>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.01.9807290843040.631-100000>