Date: Tue, 14 Jul 1998 18:59:52 -0400 (EDT) From: Luoqi Chen <luoqi@watermarkgroup.com> To: bf20761@binghamton.edu, freebsd-hackers@FreeBSD.ORG Subject: Re: Wrong comment in pmap_bootstrap() about virtual_avail? Message-ID: <199807142259.SAA28732@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807142259.SAA28732>
