Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 1998 12:33:11 -0400 (EDT)
From:      zhihuizhang <bf20761@binghamton.edu>
To:        David Greenman <dg@root.com>
Cc:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: APTDpde question (pmap) 
Message-ID:  <Pine.SOL.L3.93.980727115948.406A-100000@ultra3>
In-Reply-To: <199807262229.PAA16544@implode.root.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 26 Jul 1998, David Greenman wrote:

> >In pmap.c module, we set PTDPTDI entry of the page directory page to point
> >to itself.  So PTDpde and PTmap works well.  However, I do not find a
> >similar setting of APTDTDI (=1023) in pmap.c.  My question is how APTDpde
> >and the alternate address space it's supposed to relate to (APTmap) are
> >used. (has something to do with pmap copy?)
> 
>    The alternate page table map is used when the kernel wants to access the
> page tables of a non-current process. The page directory of the target
> process is mapped at PTD offset 1023, which causes the target process's page
> tables to become accessable in the final 4MB of the current address space.
> 

(Please note that PTDPTDI = 959)

I read the get_ptbase() again.  The way it judges whether we are current
address space is by comparing pmap->pm_pdir[PTDPTDI] & PG_FRAME and
(((unsigned) PTDpde) & PG_FRAME).  The value of pmap->pm_pdir[PTDPTDI] &
PG_FRAME is the physical address of the page directory page of the pmap
(set up by pmap_pinit()).  But I am confused with the meaning of
(((unsigned)PTDpde) & PG_FRAME). 

I thought the value of PTDpde (and similar things happen for APTDpde) is
fixed as 959|959|959 (I divide the linear address into three parts,
separating them by "|").  But the address, not the value, of the PTDpde
should be 959|959|959 to make things work, because I believe that the way
to determine that we are the current address space is to make sure that we
are using the same page directory page.

So I go to locore.s where PTDpde is defined.  locore.s uses the .set
directive. I guess the .set directive is not equal to assignment statement
in C programming language.  I looked the info file and find the following: 

"The value of a symbol is (usually) 32 bits.  For a symbol which
labels a location in the text, data, bss or absolute sections the value
is the number of addresses from the start of that section to the label.
Naturally for text, data and bss sections the value of a symbol changes
as `ld' changes section base addresses during linking.  Absolute
symbols' values do not change during linking: that is why they are
called absolute."

So for assembly, the *value* of the absolute symbol PTDpde (actually
_PTDpde) is 959|959|959.  But for C, PTDpde has the address (not the
value) of 959|959|959.

Am I right? Please clarify this for me. Thanks for your help.


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.SOL.L3.93.980727115948.406A-100000>