Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Nov 2004 23:47:18 +0100
From:      Willem Jan Withagen <wjw@withagen.nl>
To:        "arch@freebsd.org" <arch@freebsd.org>
Subject:   Booting questions ....
Message-ID:  <418AB176.9030604@withagen.nl>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?418AB176.9030604>