Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 1998 20:55:34 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        zhihuizhang <bf20761@binghamton.edu>
Cc:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: Simple Virtual Memory Questions
Message-ID:  <Pine.BSF.3.95q.980520205314.4241B-100000@herring.nlsystems.com>
In-Reply-To: <Pine.SOL.L3.93.980519113903.5341A-100000@bingsun2>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 May 1998, zhihuizhang wrote:

> 
> I believe the following VM questions are simple to experts and hope one of
> them will help me out (simple answer is OK):
> 
> (1) I think the linked address should be the virtual address.  The
> kernel is linked at virtual address 0xf0100000 (specified by the linker
> option -T ) and loaded at 0x00100000 (that is the reason why the
> relocation macro R(foo) works in locore.s). So what is the meaning of
> KERNBASE (0xf0000000)? The kernel image should start at 0xf0100000, not
> 0xf0000000.  Besides, we have constants like UPT_MIN_ADDRESS and
> UPT_MAX_ADDRESS which are even less than KERNBASE.  Can anyone clarify
> the use of virtual memory address space in kernel for me?

KERNBASE is the 4Mb aligned address of the start of kernel virtual memory.
It needs to be aligned since it is silly to share a pagetable between user
and kernel mode.

> 
> (2) In locore.s, we install a pde for a temporary double map of bottom of
> VA by the following statements:
> 
>         movl    R(_KPTphys), %eax
>         xorl    %ebx, %ebx
>         movl    $1, %ecx
>         fillkpt(R(_IdlePTD), $PG_RW)
> 
> The mapping is cleared, if I am correct, in pmap_bootstrap() by the
> following statement:
> 
> 	* (int *) PTD = 0;

I think this just clears the mapping for 0-4Mb.  Not sure why its there.

> 
> I have not found any usage of this mapping before it is cleared. Am I
> wrong?  If yes, what is the usage for this temporary mapping? 
> 
> (3) In routine pmap_growkernel(), we have the following statement:
> 
> 	*pmap_pde(kernel_pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
> 
> Is this redundant?  Because we already have a statement in the same
> routine (before the above statement) which says: 
> 
> 	pdir_pde(PTD, kernel_vm_end) =
> 	(pd_entry_t)(VM_PAGE_TO_PHYS(nkpg) | PG_V |PG_RW);

I believe that the earlier statement is just to install the new mapping in
the current PTD.  The rest is to copy it into all the other pmaps (all
pmaps share the mappings for all the kernel segments).

--
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.3.95q.980520205314.4241B-100000>