Multiboot question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
gustavo

Multiboot question

Post by gustavo »

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
mystran

Re:Multiboot question

Post by mystran »

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).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Multiboot question

Post by Solar »

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.
paulbarker

Re:Multiboot question

Post by paulbarker »

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.
gustavo

Re:Multiboot question

Post by gustavo »

Thanks for the answers, you were all very helpful ;D
Post Reply