diff options
-rw-r--r-- | EmulatorPkg/Win/Host/WinHost.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index a78ca2acff..9a5201f4d1 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -453,6 +453,28 @@ Returns: 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()
//
OpenProcessToken (GetCurrentProcess (), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &Token);
@@ -576,28 +598,6 @@ Returns: }
//
- // 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.
//
|