[Prev][Next][Index][Thread]

Re: x86 physical memory probe?



> From: "Jonathan S. Shapiro" <shap@eros-os.org>
> To: <oskit-users@fast.cs.utah.edu>
> Subject: x86 physical memory probe?
> Date: Sun, 26 Nov 2000 01:28:25 -0500
> 
> The biggest thing I'm currently confused about is who goes out and probes
> the physical memory configuration, how this gets passed to the initial
> memory map, and where the call is made to initialize that memory map. Clues
> greatfully accepted on this.
> 

Caveat: Guess what?  I'm not a multiboot expert either :-)

I'll answer the question up front and then give you some background:

It is the responsibility of the various multiboot boot adaptors to
determine how much physical memory there is in a machine.  Specifically,
boot/extendend_mem_size.c (which uses EEPROM values or manual probing)
is used by the BSD boot adaptor while the Linux boot adaptor makes a BIOS
call (see boot/linux/misc.c).  You can also boot an OSKit kernel with GRUB
which also uses BIOS calls to size memory.

Startup code in your kernel (kern/x86/pc/base_multiboot_init_mem) takes
these values and initializes the base LMM (malloc_lmm).

In case you are confused, I'll give you some additional background:

OSKit kernels are so-called "Multiboot kernels", that is, they have embedded
startup code (base_multiboot_*) that expects to find Multiboot data structures
telling it cool things like how much memory there is and where its loaded
and what its command line is.  To create multiboot images, that you can boot
with LILO or whatever, you post-process your kernel to include a "multiboot
adaptor" using one of the mk<FOO>image scripts (e.g., mklinuximage).  See
the various subdirs under boot/ for details.  Supported adaptors:

linux:
	mklinuximage creates a file that can be booted with LILO
bsd:
	mkbsdimage creates a file that can be booted with an old (a.out)
	FreeBSD boot loader

netboot:
	this is actually an OSKit kernel which allows you to load other
	oskit kernels across the net.  It can load straight ELF binaries
	as they come out of your OSKit build.  Netboot provides the
	adaptor for these kernels.  Note that to boot netboot, the netboot
	binary has to be in a suitable format; i.e., processed by
	mklinuximage, mkbsdimage, (or itself booted by another instance
	of netboot :-)

ofw:
	mkofwimage creates a file that can be booted by a PPC Open Firmware
	boot loader


So ultimately, the physical memory size is determined by either the code
code in boot/extended_mem_size.c or boot/linux/misc.c or by GRUB depending
on how you booted your kernel (or booted the netboot which booted your
kernel).

Hope this helps.