About multiboot modules...
Posted: Sun Dec 17, 2006 6:31 pm
Some time ago, when I was trying to build a free page stack to help in memory management, I eventually gave up because, when I wanted to know which pages were free without memory management, I didn't know what could I assume about *where* GRUB has loaded it's structures and the modules, so I didn't know where to put the stack...
I thought about starting in the uppermost longword of memory available, but I just don't know what I can assume about the location of the modules and the multiboot structures... So if I have many many modules loaded can I assume, for example, that the modules were loaded just above the kernel (page aligned if the header flags tells so)...
The obvious solution would be to look at the multiboot structures... in which case I have to check each page one by one to see if it's free or not! I think the multiboot should have a more defined behaviour... for example, it should specify that the kernel *must* be loaded above 1M (no section loaded below 1M), that the boot loaded should not write anything above 1M apart from the kernel and kernel modules (thus it's datastructures should be always written below 1M) and the modules should be placed exactly above the highest kernel section by default (aligned to a 4KB or 4MB page boudary if the kernel requires so)...
If the programmer wants to have some control about where (s)he wanted the modules loaded, the spec should provide a mechanism to override the default behaviour...
JJ
I thought about starting in the uppermost longword of memory available, but I just don't know what I can assume about the location of the modules and the multiboot structures... So if I have many many modules loaded can I assume, for example, that the modules were loaded just above the kernel (page aligned if the header flags tells so)...
The obvious solution would be to look at the multiboot structures... in which case I have to check each page one by one to see if it's free or not! I think the multiboot should have a more defined behaviour... for example, it should specify that the kernel *must* be loaded above 1M (no section loaded below 1M), that the boot loaded should not write anything above 1M apart from the kernel and kernel modules (thus it's datastructures should be always written below 1M) and the modules should be placed exactly above the highest kernel section by default (aligned to a 4KB or 4MB page boudary if the kernel requires so)...
If the programmer wants to have some control about where (s)he wanted the modules loaded, the spec should provide a mechanism to override the default behaviour...
JJ