From owner-freebsd-hackers Wed May 20 12:55:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA12799 for freebsd-hackers-outgoing; Wed, 20 May 1998 12:55:32 -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 MAA12712 for ; Wed, 20 May 1998 12:54:58 -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 UAA04246; Wed, 20 May 1998 20:55:34 +0100 (BST) Date: Wed, 20 May 1998 20:55:34 +0100 (BST) From: Doug Rabson To: zhihuizhang cc: hackers Subject: Re: Simple Virtual Memory Questions 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, 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