From owner-freebsd-arch@FreeBSD.ORG Thu Nov 4 23:06:48 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FC0516A4CE for ; Thu, 4 Nov 2004 23:06:48 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDED843D1F for ; Thu, 4 Nov 2004 23:06:47 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from [192.168.254.11] (junior-wifi.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id iA4N8iQm028383; Thu, 4 Nov 2004 16:08:45 -0700 (MST) (envelope-from scottl@freebsd.org) Message-ID: <418AB649.80809@freebsd.org> Date: Thu, 04 Nov 2004 16:07:53 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20040929 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Willem Jan Withagen References: <418AB176.9030604@withagen.nl> In-Reply-To: <418AB176.9030604@withagen.nl> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: "arch@freebsd.org" Subject: Re: Booting questions .... X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2004 23:06:48 -0000 Willem Jan Withagen wrote: > Hi, > > I'm looking for a place to sensibly insert memorytest routines.... > > Currently I'd like to do that not in the loader, but in the kernel where > memory is already setup to be one flat address space. This makes > programming a lot simpler. > > A sensible place, from what I can deduct, would be before the > vm_ksubmap_init in the chunck from machdep.c: > ---- > /* > * Display any holes after the first chunk of extended memory. > */ > if (bootverbose) { > int indx; > > printf("Physical memory chunk(s):\n"); > for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { > vm_paddr_t size; > > size = phys_avail[indx + 1] - phys_avail[indx]; > printf( > "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n", > (uintmax_t)phys_avail[indx], > (uintmax_t)phys_avail[indx + 1] - 1, > (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); > } > } > #ifdef MEMTEST > if (bootmemtest) { > for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { > vm_paddr_t size; > > size = phys_avail[indx + 1] - phys_avail[indx]; > memtest ( > /* start */ (uintmax_t)phys_avail[indx], > /* end */ (uintmax_t)phys_avail[indx + 1] > - 1, > /*size */ (uintmax_t)size > ); > } > } > #endif MEMTEST > vm_ksubmap_init(&kmi); > ---- > > And in memtest I can just linearly iterate over the memory between these > pointers without getting pagefaults.... > > Next question is where to watch for already taken memory: > - code > - data > - stack > What modules are already setup by the time we enter the code above??? > > Or the alternative would be to just exclude for the code and data of the > memtests routines them selves. But then printf would probably be > destroyed as well, and there would be no "tracing" of memtest activity. > > Thanx, > --WjW > The loader has a protected mode environment. It is apparently not all that hard to port memtest86 into it. I'd highly recommend doing this rather than trying to hack up the early pmap initialization. Scott