next up previous
Next: Paging start Up: MM Sub-System initialization. Previous: MM Sub-System initialization.

Memory categorization

File : arch/i386/boot/setup.S

First of all, we have to know about the memory that is present in the system. This data will be usefull as long as the kernel is alive and kicking. The amount of memory present can be found out by querying the BIOS. There are 3 ways to get a map of physical memory present in the system.All the 3 ways use bios int 15 and different contents in the registers. (TODO add detail of os_faq)

Memory maps are got using all these three methods and stored in separate places. Later in the setup sequence (in setup.c) they will be used one after other, on failure of previous, to generate a singe valid memory map The memory map structure (snipped from include/asm-i386/e820.h). This is an array of maximum 32 entries of the structure e820entry.

struct e820map {
int nr_map;
struct e820entry
{
unsigned long long addr; /* start of memory segment */
unsigned long long size; /* size of memory segment */
unsigned long type; /* type of memory segment */
} map[E820MAX];
};

The whole e820map is setup using bios interrupt 15 (and 0xe820 in %eax, hence the name), in the predefined  address "0x2d0".

If the bios does not support e820 query, then the size is setup as the number of 1k chunks of memory available got using 0xe801 method in the predefined memory "0x1e0".

If the bios does not support 0xe801 query then we take the 0x88 query result , which will work on most (fairly all of the)  bios. Here memory is given as the total MB available, but only till 64 MB.

Then a series of other initializations are done and  startup_32(in head.S) is called.


next up previous
Next: Paging start Up: MM Sub-System initialization. Previous: MM Sub-System initialization.
2002-09-22