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.
I successfully got the multiboot information structure from GRUB and parsed the memory map. However, the last entry int the map seems very strange to me. It contains this information:
Start: 0xfffc0000
Length: 256KB
Type: Unavailable
So the last 256KB of 4GB RAM are reported as unavailable. The weird thing is that I'm running my kernel in QEMU with only 1GB of RAM.
Do you have a real clear idea of what a BIOS is? And a BIOS ROM?
The end of your 4G memory space is the address of your BIOS ROM. Your emulator is reserving 256K of memory for your BIOS ROM. Since it is ROM, it is not available as memory.
bewing wrote:Do you have a real clear idea of what a BIOS is? And a BIOS ROM?
The end of your 4G memory space is the address of your BIOS ROM. Your emulator is reserving 256K of memory for your BIOS ROM. Since it is ROM, it is not available as memory.
Well, I thought I had
My understanding is that the values returned in the memory map are physical addresses. So how can it be that if I only have 1GB of RAM, the BIOS ROM is located at an address close to 4GB?
Because RAM chips and ROM chips are two physically different things. They have different sets of addressing wires going to them. You have 1GB of addressing wires going to the RAM chips, and 256K of addressing wires going to the ROM chips. And those wires need to have different physical memory addresses, to access them. The Intel chip spec says that when the chip boots at poweron, the very first memory address that it tries to access is 0xfffffff0. This is expected to be 16 bytes before the very end of a boot ROM chip. (Then the boot ROM copies 64K of itself down to address 0xf0000, below 1M.) There is nothing anywhere that says that your computer's memory (especially the distinction between RAM and ROM!) must be contiguous. In fact, if you have more than 3GB of RAM, it is pretty much guaranteed that your RAM won't be contiguous, either.