I've just started working on memory allocation/paging/etc for my OS and I have a few questions:
I've seen a few implementations of kernel heap and they all seem to have a hardcoded size pool of a few megabytes just above the kernel.
1. Is this OK? For example if I load the kernel at 1 megabyte physical, then I should have a few free megabytes above me, is it safe to assume that I do?
2. If not, how does one handle setting up kernel heap without any free memory at hand? (so basically chicken and egg problem).
3. Can the kernel use other physical ranges of memory after its done parsing the memory map (or rather is this a normal practice?) or is it limited with that hardcoded heap size?
If I understand everything correctly the right memory initialization order is:
init basic kernel heap of hardcoded size -> init paging and move kernel to 3GB (obv. can be any other location) -> parse memory map and detect free pages -> init allocator with free pages
Is this accurate? ^
Would really appreciate any other memory handling advice and how to do things right from experienced osdev people.
