From owner-freebsd-arch@FreeBSD.ORG Thu Nov 4 22:47:21 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 45E3E16A4CE for ; Thu, 4 Nov 2004 22:47:21 +0000 (GMT) Received: from freebee.digiware.nl (dsl439.iae.nl [212.61.63.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id E128843D55 for ; Thu, 4 Nov 2004 22:47:19 +0000 (GMT) (envelope-from wjw@withagen.nl) Received: from [212.61.27.71] (dual.digiware.nl [212.61.27.71]) by freebee.digiware.nl (8.12.10/8.12.10) with ESMTP id iA4MlI5p096680 for ; Thu, 4 Nov 2004 23:47:18 +0100 (CET) (envelope-from wjw@withagen.nl) Message-ID: <418AB176.9030604@withagen.nl> Date: Thu, 04 Nov 2004 23:47:18 +0100 From: Willem Jan Withagen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "arch@freebsd.org" Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: 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 22:47:21 -0000 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