Hi,
I implemented my page allocation system ages ago and it all works very nicely. I just had a bit of a worry about PCI configuration spaces etc... which I haven't really dealt with yet.
At the moment, I build my RAM bitmap from the system memory map provided by GRUB / the BIOS. Every area marked as 'available' is added to the physical memory bitmap as free (this happens in my boot loader which later builds a stack-based system for the kernel.
Supposing I am later using PCI memory mapped devices. Will the system RAM map take this in to account, or do I have to scan the PCI bus and manually ensure that memory mapped areas are not assigned as RAM?
Also, supposing VESA resides at 0xE0000000 and I had a system with 4GB RAM, will this area already have been marked as unavailable by the BIOS? At present, My system only has 2GB, so it doesn't really matter as VESA space is outside the physical RAM space.
The main reason for my concern is that I prefer the stack allocation method. Obviously this makes it difficult to remove pages later on if they are found to be within some device's configuration space.
Cheers,
Adam
Page Frame Bitmap - Reserved Areas
Re: Page Frame Bitmap - Reserved Areas
Hi,
If you've got 4 GB of RAM, then part of the physical address space will be reserved for PCI devices (e.g. from 0xC0000000 to 0xFFFFFFFF). For cheap motherboards this might mean you can only use 3 GB of RAM and the rest is wasted. For better motherboards the RAM will be remapped, so that (for e.g.) the fourth GB of RAM is from 0x0000000100000000 to 0x000000013FFFFFFF. In this case your OS will need to use PAE or PSE36 (or long mode) to access it.
Cheers,
Brendan
You shouldn't need to scan the PCI bus and manually ensure that memory mapped areas are not assigned as RAM.AJ wrote:Supposing I am later using PCI memory mapped devices. Will the system RAM map take this in to account, or do I have to scan the PCI bus and manually ensure that memory mapped areas are not assigned as RAM?
Also, supposing VESA resides at 0xE0000000 and I had a system with 4GB RAM, will this area already have been marked as unavailable by the BIOS? At present, My system only has 2GB, so it doesn't really matter as VESA space is outside the physical RAM space.
If you've got 4 GB of RAM, then part of the physical address space will be reserved for PCI devices (e.g. from 0xC0000000 to 0xFFFFFFFF). For cheap motherboards this might mean you can only use 3 GB of RAM and the rest is wasted. For better motherboards the RAM will be remapped, so that (for e.g.) the fourth GB of RAM is from 0x0000000100000000 to 0x000000013FFFFFFF. In this case your OS will need to use PAE or PSE36 (or long mode) to access it.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.