OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:58 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [UEFI] Holes and missing regions in GetMemoryMap?
PostPosted: Thu Jul 08, 2021 1:27 pm 
Offline

Joined: Wed Sep 04, 2019 9:51 am
Posts: 13
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..?


Top
 Profile  
 
 Post subject: Re: [UEFI] Holes and missing regions in GetMemoryMap?
PostPosted: Thu Jul 08, 2021 2:23 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.

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.


Top
 Profile  
 
 Post subject: Re: [UEFI] Holes and missing regions in GetMemoryMap?
PostPosted: Fri Jul 09, 2021 1:24 am 
Offline

Joined: Wed Sep 04, 2019 9:51 am
Posts: 13
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[i]" instead of adding the reported size of each descriptor on each round...so I was basically interpreting garbage.

#-o


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Garnek0 and 50 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group