OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:53 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Got strange reaction when trying to get memory map
PostPosted: Tue Jun 21, 2022 12:24 am 
Offline

Joined: Thu Jun 09, 2022 9:48 pm
Posts: 10
When I'm in EFI trying to get memory map and exit boot service, I use AllocatePool to get memory used by GetMemoryMap. But the efi application stuck after showing "Trying to get memory map with size xxx, buffer xxx. I try to Print something after function get_memory_map, and it shows:

Code:
Trying to get memory map with size: 1920, buffer: BE6B5018...
1631 -1100263400 2448
Trying to get memory map with size: 3088, buffer: BE6B5018...
?
Trying to get memory map with size: 1920, buffer: BE6B4018...
1656 -1100267496 2448
Trying to get memory map with size: 3088, buffer: BE6B4018...
?
Trying to get memory map with size: 1920, buffer: BE6B3018...
1681 -1100271592 2448
Trying to get memory map with size: 3088, buffer: BE6B3018...
?
Unable to successfully exit boot services. Last status: 2
Error: Image at 000BE54D000 start failed: Aborted


This is the code after I added some debug part:
https://pastebin.com/NeD85uz6


Top
 Profile  
 
 Post subject: Re: Got strange reaction when trying to get memory map
PostPosted: Tue Jun 21, 2022 6:03 am 
Offline
Member
Member

Joined: Mon Jul 05, 2021 6:57 pm
Posts: 118
It is possible that the call to "Print" (which prints the "?") allocates memory and thus renders the memory map key invalid, which causes ExitBootServices to fail. I had a similar issue with a UEFI loader I wrote. I strongly suggest doing as little as possible between successfully getting the memory map and calling ExitBootServices, i.e. avoid directly or indirectly calling any other EFI API.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Google [Bot] and 75 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