From owner-freebsd-hackers Tue Jul 14 16:01:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA28001 for freebsd-hackers-outgoing; Tue, 14 Jul 1998 16:01:02 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA27995 for ; Tue, 14 Jul 1998 16:01:00 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id SAA28732; Tue, 14 Jul 1998 18:59:52 -0400 (EDT) (envelope-from luoqi) Date: Tue, 14 Jul 1998 18:59:52 -0400 (EDT) From: Luoqi Chen Message-Id: <199807142259.SAA28732@lor.watermarkgroup.com> To: bf20761@binghamton.edu, freebsd-hackers@FreeBSD.ORG Subject: Re: Wrong comment in pmap_bootstrap() about virtual_avail? Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > In file i386/pmap.c, routine pmap_bootstrap(), I find the following > comment: > > "XXX The calculation of virtual_avail is wrong. It's NKPT*PAGE_SIZE too > large. It should be instead be correctly calculated in locore.s and not > based on 'first'(which is a physical address, not a virtual address, for > the start of unused physical memory)..." > > I read this comment a long while ago and still do not understand it. I > believe that the calculation of virutal_avail which immediately follows is > correct and 'firstaddr' has to be a physical address (PA + KERNBASE == > VA). Why it is wrong? How come it is NKPT*PAGE_SIZE large? The kernel physical page table KPTphys is not mapped into the virtual address space. So from physical address 0 to firstaddr, only firstaddr-NKPT*PAGE_SIZE are mapped into the virtual space. The first available virtual address should be KERNBASE+firstaddr-NKPT*PAGE_SIZE. -lq > > Anyway, this piece of code appears in freebsd-stable. If the code IS > wrong, how can this bug not be removed? So maybe the comment is wrong. > > BTW, what does "XXX' mean which appear many times elsewhere? > > Any help is appreciated. > > -------------------------------------------------- > | Zhihui Zhang, http://cs.binghamton.edu/~zzhang | > | Dept. of Computer Science, SUNY at Binghamton | > -------------------------------------------------- > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message