The multiboot specification states that the mem_lower and mem_upper fields of the multiboot_info structure are the amount of lower and upper memory respectively.
Is it the memory I will have available for storing my OS structures, page frames, and so on...? Is it contiguous available space? What is the use for the mmap_* fields? When should are they needed?
Well, just some things I've been wondering about and I couldn't figure out, I hope someone can help me.
Thanks for the attention
Multiboot question
Re:Multiboot question
mmap_ fields (if you ask for them) will contain a memory map, that is, length and a pointer to an array of continuous blocks of memory (that is, each block is continuous, but they are sepparate from each other), including available memory and other types (which, IIRC multiboot just specifies as reserved).
The mem_lower and mem_upper do give you the amount of lower memory and upper memory, but aren't really that useful.
Look at how the example kernel (included in grub) reads the memory map, and then use that info when you initialize your physical memory allocation.
I personally don't use mem_lower/upper fields at all. Instead I just panic if I didn't get a memory map (not that I've seen it ever happen).
The mem_lower and mem_upper do give you the amount of lower memory and upper memory, but aren't really that useful.
Look at how the example kernel (included in grub) reads the memory map, and then use that info when you initialize your physical memory allocation.
I personally don't use mem_lower/upper fields at all. Instead I just panic if I didn't get a memory map (not that I've seen it ever happen).
Re:Multiboot question
In one sentence, mem_lower / mem_upper are for the user ("you have X kB lower and Y kB upper memory installed"), while mmap_* is for the kernel.
Every good solution is obvious once you've found it.
Re:Multiboot question
The best option is to use the MMAP where available and fall back on upper/lower memory sizes if you don't get a MMAP.