I think I know the answer to this but I want to check;
I am using EFI boot services GetMemoryMap and it returns me a list of regions that I can separate out as usable RAM, reserved, etc.
However, the amount of memory reported (even when taking all the types into account) is not at all what I've set in the VM I'm running.
From discussions elsewhere and in the Linux kernel it appears that this is "as expected" because the boot services simply don't map out all of RAM, just some of it and that it will depend on firmware. I'm using VirtualBox and VMWare which I believe both use Tianocore (OVMF I suppose).
The other alternative I know of is a full E820 solution, but I was hoping I wouldn't have to deal with that by booting as EFI.
Is this The Way..?
[UEFI] Holes and missing regions in GetMemoryMap?
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: [UEFI] Holes and missing regions in GetMemoryMap?
What amount is reported? What amount did you configure the VM for? It probably won't match, since the memory map includes some non-RAM MMIO and doesn't include RAM that's only available in SMM, but it should be pretty close. Big differences usually indicate a bug in your code.psjarlo wrote:However, the amount of memory reported (even when taking all the types into account) is not at all what I've set in the VM I'm running.
Re: [UEFI] Holes and missing regions in GetMemoryMap?
You have to love the rubber ducky...
As you suggested it could be a bug I edited the code into my reply and and while virtually explaining it to you, I found it...
I was iterating the descriptor list using a pointer and index "desc" instead of adding the reported size of each descriptor on each round...so I was basically interpreting garbage.
As you suggested it could be a bug I edited the code into my reply and and while virtually explaining it to you, I found it...
I was iterating the descriptor list using a pointer and index "desc" instead of adding the reported size of each descriptor on each round...so I was basically interpreting garbage.