GRUB's physical-memory amounts in Qemu
Posted: Sun Jun 21, 2009 10:29 pm
I am currently working on setting up paging and a heap. In the so doing, I decided to try to make my paging manager use all available physical memory, instead of just a small constant amount. I use the mem_upper member of the multiboot info struct that GRUB gives me. The assembly wrapper of my C kernel is just as that in the 'Bare bones' tutorial. Code:
When I run this, it panics with 'no available frames'. (Note that I am loosely following JamesM's tutorial.) When I run it in Qemu's GDB stub and print mbd->mem_upper, it gives me 0x1fbc0, which is obviously wrong. Does anyone know why this would be?
Code: Select all
void kmain(multiboot_t *mbd, u32int magic)
{
if ( magic != 0x2BADB002 ) {
panic("Boot sequence invalid");
}
u32int avail_mem = mbd->mem_upper + 0x100000; // add 1M because it's upper memory
...
init_paging(avail_mem); // also creates kernel heap
...
}