mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
EmulatorPkg: Move magic page to first allocation
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 of main() to minimize the change that another allocation is allocated from the PcdPeiServicesTablePage address. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
parent
54c1460dd0
commit
81802056c8
@ -452,6 +452,28 @@ Returns:
|
||||
UINTN ResetJumpCode;
|
||||
EMU_THUNK_PPI *SecEmuThunkPpi;
|
||||
|
||||
//
|
||||
// If enabled use the magic page to communicate between modules
|
||||
// This replaces the PI PeiServicesTable pointer mechanism that
|
||||
// deos not work in the emulator. It also allows the removal of
|
||||
// writable globals from SEC, PEI_CORE (libraries), PEIMs
|
||||
//
|
||||
EmuMagicPage = (VOID *)(UINTN)(FixedPcdGet64 (PcdPeiServicesTablePage) & MAX_UINTN);
|
||||
if (EmuMagicPage != NULL) {
|
||||
UINT64 Size;
|
||||
Status = WinNtOpenFile (
|
||||
NULL,
|
||||
SIZE_4KB,
|
||||
0,
|
||||
&EmuMagicPage,
|
||||
&Size
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n\r", EmuMagicPage);
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Enable the privilege so that RTC driver can successfully run SetTime()
|
||||
//
|
||||
@ -575,28 +597,6 @@ Returns:
|
||||
exit (1);
|
||||
}
|
||||
|
||||
//
|
||||
// If enabled use the magic page to communicate between modules
|
||||
// This replaces the PI PeiServicesTable pointer mechanism that
|
||||
// deos not work in the emulator. It also allows the removal of
|
||||
// writable globals from SEC, PEI_CORE (libraries), PEIMs
|
||||
//
|
||||
EmuMagicPage = (VOID *)(UINTN)(FixedPcdGet64 (PcdPeiServicesTablePage) & MAX_UINTN);
|
||||
if (EmuMagicPage != NULL) {
|
||||
UINT64 Size;
|
||||
Status = WinNtOpenFile (
|
||||
NULL,
|
||||
SIZE_4KB,
|
||||
0,
|
||||
&EmuMagicPage,
|
||||
&Size
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n\r", EmuMagicPage);
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Open All the firmware volumes and remember the info in the gFdInfo global
|
||||
// Meanwhile, find the SEC Core.
|
||||
|
Loading…
x
Reference in New Issue
Block a user