Booting questions ....

Willem Jan Withagen wjw at withagen.nl
Thu Nov 4 16:09:25 PST 2004


John Baldwin wrote:

> On Thursday 04 November 2004 05:47 pm, 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.
> 
> 
> The loader does use a flat address space, it is just rooted at 0xa000 rather 
> than 0x0, so you can't test the first few kb FWIW.

Nice,

But is it unsegmented? (perhaps I have a wrong idea of a flat address space)

What I mean with this is that I can iterate from 0xa000 to 0xffffffff with a 
"char *p" and do test_bytes( 0xa000, 0xffffffff, 0xff). (assuming this all has 
memory)

test_bytes( char *start, char* end, char mask) {
	char *save;
	while (start < end ) {
		*start = mask;
		start++;
	}
	start = save;
	while (start < end ) {
		if (*start != mask) error(start);
		start++;
	}
}

Next is then which ranges are valid to test, and then things really start to 
get complicated and arch dependant. Which is why I ended up in machdep.c right 
after the setting up of the memory ranges.

--WjW



More information about the freebsd-arch mailing list