EmulatorPkg: Move magic page to first allocation #10660
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #10652
The magic page is allocated from a fixed address specified by
PcdPeiServicesTablePage
. This allocation has been observed to sometimes fail. Move the allocation of this buffer to the very beginning ofmain()
to minimize the chance that another allocation is allocated from thePcdPeiServicesTablePage
address.How This Was Tested
The issue was reproduced with a build of EmulatorPkg VS2022 IA32 RELEASE. In order to minimize the time required to boot cycle the EmulatorPkg build, the boot manager front page timeout is set to 0 and the Shell default delay is also set to 0.
A cmd script was then used to boot the EmulatorPkg in a loop and log the results to a file.
A
startup.nsh
file is used to automatically reset the EmulatorPkg when the boot to Shell completesWithin 10 to 20 boot cycles the allocation of the magic page fails.
With the fix in this PR that moves the allocation of the magic page to very beginning of
main()
the issue was not reproduced in over 11000 boot cycles of the EmulatorPkg.Integration Instructions
N/A