summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg
Commit message (Collapse)AuthorAgeFilesLines
* EmulatorPkg PlatformBm: Fix duplicate BootManagerMenuApp boot option issueYang Gang2025-01-241-1/+1
| | | | Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
* EmulatorPkg: Move magic page to first allocationMichael D Kinney2025-01-231-22/+22
| | | | | | | | | | | 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>
* EmulatorPkg: Fix IA32 MSVC Linker WarningsOliver Smith-Denny2025-01-222-7/+7
| | | | | | | | | | | IA32 EmulatorPkg had many linker warnings because with the current set of linker flags, the MSVC linker was expecting the __stdcall calling convention on all entry points. This was an effect of having /SUBSYSTEM:CONSOLE on all binaries built in EmulatorPkg; this is only needed on WinHost, as that is what Windows launches. The linker options are adjusted to only set /SUBSYSTEM:CONSOLE on WinHost. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* EmulatorPkg: Fix Source Level Debug on WindowsNate DeSimone2025-01-221-24/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Visual Studio Windows debugger will only load symbols for PE/COFF images that Windows is aware of. Therefore, to enable source level debugging, all PEI/DXE modules must be loaded via LoadLibrary() or LoadLibraryEx() and the the instance in memory created by LoadLibrary() must be the one that is actually executed. The current source level debug implementation in EmulatorPkg for Windows is inherited from the old Nt32Pkg. This implementation makes the assumption that all PEI/DXE modules have a DLL export tables with a symbol named InitializeDriver. Therefore, this source level debug implementation requires all modules to be linked in a non-PI spec defined manner. Support for adding the InitializeDriver symbol was removed in EmulatorPkg, which broke source level debugging. To fix this, the source level debugging implementation has been modified to use the PE/COFF entry point directly. This brings the implementation into compliance with the PI spec and should work with any PEIM/DXE driver. Implementing this requires parsing the in-memory instance of the PE/COFF image created by Windows to find the entrypoint and since PEIMs/DXE drivers are not garunteed to have 4KB aligned sections, it also requires explicit configuration of the page table using VirtualProtect(). With this fix, the debugging experience is now so good it is unprecedented! In Visual Studio Code, add the following to launch.json: { "version": "0.2.0", "configurations": [ { "name": "EmulatorPkg Launch", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/<path_to_build>/Build/EmulatorX64/DEBUG_<tool_chain>/X64/WinHost", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}/<path_to_build>/Build/EmulatorX64/DEBUG_<tool_chain>/X64/", "environment": [], "console": false, } ] } Make modifications to the above template as nessesary and build EmulatorPkg. Now, just add breakpoints directly in Visual Studio Code the way you would with any other software project. When you start the debugger, it will halt at the breakpoint automatically without any extra configuration required. Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* EmulatorPkg/Win/Host: Use safe function _vsnprintf_s()Michael D Kinney2025-01-131-1/+1
| | | | | | | | | Update SecPrint() to use _vsnprintf_s() instead of _vsnprintf() that is a safe function and allows the defines _CRT_SECURE_NO_WARNINGS and _CRT_SECURE_NO_DEPRECATE to be removed from WinHost builds. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* EmulatorPkg: spurious failure in WriteBlocks on X64Doug Cook (WINDOWS)2024-12-171-2/+2
| | | | | | | | | | | | | | | | WinNtBlockIoWriteBlocks can spuriously fail on X64. This occurs because &BytesWritten is a `UINTN*` (i.e. `UINT64*`) but is cast to `LPDWORD` (i.e. `UINT32*`). Only the low 32 bits are initialized by WriteFile, so the high 32 bits are uninitialized. This means we will spuriously fail the `BytesWritten != BufferSize` test. This doesn't occur on X86-32 since UINTN is the same as DWORD in that case. Fix is to declare BytesWritten as DWORD to match the type expected by WriteFile. This also makes the cast unnecessary. Signed-off-by: Doug Cook <idigdoug@gmail.com>
* EmulatorPkg: Add minimum Python version for CI badgeMichael Kubacki2024-12-131-1/+2
| | | | | | | | | | The Python version used for build and CI should always be at least the minimum version supported by edk2-pytool-extensions. A badge is added that keeps this information dynamically up-to-date based on the minimum version specified in edk2-pytool-extensions pyproject.toml file. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* Update CI to VS2022Oliver Smith-Denny2024-12-104-11/+11
| | | | | | | | | This PR updates the CI pipelines to use VS2022 instead of VS2019 as that is the latest supported VS toolchain on edk2. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* EmulatorPkg: BlockIo2 APIs do not signal eventDoug Cook (WINDOWS)2024-12-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | BlockIo2 Read/Write/Flush APIs should signal the token's event when the I/O operation completes, but the Emulator APIs do not. As a result, any code that tries to implement async I/O will hang on emulator. Both Windows and Unix emulator hosts work the same way: - All I/O is completed synchronously. - All I/O implementations contain the comment: `// Caller is responsible for signaling EFI Event` However, the protocol implementations do not signal the event, so the event is never signalled. Fix is to signal the event in the appropriate protocol implementations. - If the host API returns success then the I/O is complete since it's always synchronous. - If there is a Token and Token->Event is not null and the I/O is successful then the event should be signalled. Signed-off-by: Doug Cook <idigdoug@gmail.com>
* EmulatorPkg WinThunk: Use Win32 API to get Performance Frequency and CountYang Gang2024-11-141-4/+15
| | | | | | | | | | Then we can use correct TimerLib in another code, such as dpDynamicCommand(PerformanceLib). These API are from profileapi.h header and can refer to the link: https://learn.microsoft.com/en-us/windows/win32/api/profileapi/ Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
* MdePkg: MdeLibs.dsc.inc: Apply StackCheckLibNull to All Module TypesOliver Smith-Denny2024-11-131-2/+0
| | | | | | | | | | | | | | | Now that the ResetVectors are USER_DEFINED modules, they will not be linked against StackCheckLibNull, which were the only modules causing issues. So, we can now remove the kludge we had before and the requirement for every DSC to include StackCheckLibNull for SEC modules and just apply StackCheckLibNull globally. This also changes every DSC to drop the SEC definition of StackCheckLibNull. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* EmulatorPkg/Win/Host: Source level debugging on already loaded DLLAshraf Ali2024-10-281-8/+2
| | | | Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* EmulatorPkg: Add Signature to Graphics StructureOliver Smith-Denny2024-10-082-0/+5
| | | | | | | | | | | | | When updating MdePkg's CR macro to enforce signature checking in all usages, it was discovered that EmulatorPkg was initializing a structure without setting the signature for it, causing an error to be returned when CR now checked the signature. This commit updates the graphics stack in EmulatorPkg to set the signature of the data structure and check the return value of the wrapper for the CR macro. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* EmulatorPkg: Add StackCheckLibNullOliver Smith-Denny2024-09-131-2/+16
| | | | | | | Remove the old stack check lib now that MdeLibs.inc includes the new one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* EmulatorPkg: fix X64 Unix/Host segfault with GCC toolchain profileLeif Lindholm2024-09-051-0/+1
| | | | | | | | | Add the necessary toolchain override flags for ms_abi and LTO on X64 for the unversioned GCC toolchain profile. This resolves a runtime segmentation fault. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* EmulatorPkg/EmulatorPkg.ci.yaml: Add PrEval CI configJoey Vagedes2024-09-021-0/+3
| | | | | | | | | | | Adds an entry to the package's CI configuration file that enable policy 5 for stuart_pr_eval. With this Policy, all INFs used by the package are extracted from the provided DSC file and compared against the list of changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval will specify that this package is affected by the PR and needs to be tested. Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
* EmulatorPkg: VS2022 Support on WinHost.edk2-stable202408Ashraf Ali2024-08-131-0/+2
| | | | | | | Currently EDK2 is supporting VS2022, with VS2022 EmulatorPkg build is failing, this patch is to add the VS2022 support for WinHost Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* EmulatorPkg: fix build error.Gerd Hoffmann2024-05-301-1/+1
| | | | | | | | | | | GasketSecSetTime is EMU_SET_TIME and returns EFI_STATUS. Fix the declaration accordingly. Fixes build error with gcc 14. /home/kraxel/projects/edk2/EmulatorPkg/Unix/Host/EmuThunk.c:429:3: error: initialization of ‘EFI_STATUS (__attribute__((ms_abi)) *)(EFI_TIME *)’ {aka ‘long long unsigned int (__attribute__((ms_abi)) *)(EFI_TIME *)’} from incompatible pointer type ‘void (__attribute__((ms_abi)) *)(EFI_TIME *)’ [-Wincompatible-pointer-types] 429 | GasketSecSetTime, | ^~~~~~~~~~~~~~~~ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* EmulatorPkg: Add Hash2DxeCrypto to EmulatorPkgDoug Flick2024-05-242-2/+12
| | | | | | | | | | | This patch adds Hash2DxeCrypto to EmulatorPkg. The Hash2DxeCrypto is used to provide the hashing protocol services. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ray Ni <ray.ni@Intel.com>
* EmulatorPkg: Add RngDxe to EmulatorPkgFlickdm2024-05-242-2/+11
| | | | | | | | | | | This patch adds RngDxe to EmulatorPkg. The RngDxe is used to provide random number generation services to the UEFI firmware. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg/Redfish: Use edk2 Redfish debug PCDsAbner Chang2024-04-041-0/+21
| | | | | | Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Nickle Wang <nicklew@nvidia.com> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
* EmulatorPkg: Update the comments of ReadKeyStroke and ReadKeyStrokeExQingyu2024-04-031-0/+2
| | | | | | | | | | | | | Refer to Uefi spec 2.10 section 12.3.3, Add a new retval EFI_UNSUPPORTED to EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke(). Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Qingyu <qingyu.shang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* EmulatorPkg: auto-generate SEC ProcessLibraryConstructorList() declLaszlo Ersek2024-03-082-10/+1
| | | | | | | | | | | | | | | | | Rely on AutoGen for declaring ProcessLibraryConstructorList(). Build-tested with: build -a X64 -b DEBUG -m EmulatorPkg/Sec/Sec.inf \ -p EmulatorPkg/EmulatorPkg.dsc -t GCC5 Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240305113843.68812-8-lersek@redhat.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* Add EFI_STATUS return to EMU_THUNK_PROTOCOL.SetTime()Nate DeSimone2024-01-052-4/+5
| | | | | | | | | | | | | | | | | | | | | | There is an inconsistency between the UNIX and Windows implementations of EMU_THUNK_PROTOCOL.SetTime(). The Windows version returns an EFI_STATUS value whereas the the UNIX implementation is VOID. However, the UNIX implementation is an unimplemented stub whereas the Windows version is implementated. The current EMU_THUNK_PROTOCOL function pointer definition specifies a VOID return type. However, EMU_THUNK_PROTOCOL.SetTime() is close to the spec defined gRT->SetTime() except for missing the EFI_STATUS return type. Therefore, I conclude that the most sensible reconciliation is to add the EFI_STATUS return type to the protocol definition. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* EmulatorPkg: Update MMTimerThread() signatureNate DeSimone2024-01-051-5/+5
| | | | | | | | | | | | | | In the early 2000s as part of the x64 transition the definition for LPTIMECALLBACK changed from (UINT, UINT, DWORD, DWORD, DWORD) to (UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR). However, the MMTimerThread() function was never updated to the new signature. Since the implementation does not use the last three parameters, this issue has not been caught until now. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* EmulatorPkg: Improve comments in WinThunk.cNate DeSimone2024-01-051-12/+5
| | | | | | | | | | | File description has not been updated since Nt32Pkg was merged with EmulatorPkg, and several details were no longer technically accurate. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variableMike Maslenkin2023-12-271-2/+0
| | | | | | Cc: Nickle Wang <nicklew@nvidia.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com> Reviewed-by: Abner Chang <abner.chang@amd.com>
* EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishServiceMike Maslenkin2023-12-273-14/+14
| | | | | | Cc: Nickle Wang <nicklew@nvidia.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com> Reviewed-by: Abner Chang <abner.chang@amd.com>
* EmulatorPkg: Format with Uncrustify 73.0.8Michael Kubacki2023-11-271-3/+3
| | | | | | | | Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: Add ImagePropertiesRecordLib InstanceTaylor Beebe2023-11-271-0/+1
| | | | | | | | | | Add an instance of ImagePropertiesRecordLib which will be used by the DXE Core. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* EmulatorPkg: Fix Terminal IssuesNate DeSimone2023-09-272-2/+57
| | | | | | | | | | | | After running EmulatorPkg, one will notice that their terminal acts strangely. This is caused by the EmulatorPkg Host changing the terminal mode and not restoring the original mode, which is now fixed. Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* MdeModulePkg: Duplicate BaseRngLibTimerLib to MdeModulePkgPierre Gondois2023-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4504 The BaseRngLibTimerLib allows to generate number based on a timer. This mechanism allows to have a basic non-secure implementation for non-production platforms. To bind and identify Random Number Generators implementations with a GUID, an unsafe GUID should be added. This GUID cannot be added to the MdePkg unless it is also added to a specification. To keep the MdePkg self-contained, copy the BaseRngLibTimerLib to the MdeModulePkg. This will allow to define an unsafe Rng GUID in a later patch in the MdeModulePkg. The MdePkg implementation will be removed later. This allows to give some time to platform owners to switch to the MdeModulePkg implementation. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Kun Qin <kun.qin@microsoft.com>
* EmulatorPkg/Win/Host: Fix RUNTIME_FUNCTION redefinition errorMichael D Kinney2023-07-241-4/+6
| | | | | | | | | | | | | | | Update WinInclude.h to prevent error due to redefinition of RUNTIME_FUNCTION using same technique that has been used in the past for structure types such as LIST_ENTRY. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* EmulatorPkg: Update code to be more C11 compliant by using __func__Rebecca Cran2023-04-102-2/+2
| | | | | | | | | | | | | | __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout EmulatorPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Abner Chang <Abner.Chang@amd.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg/PeiTimerLib: Bug fix in NanoSecondDelayDeric Cole2023-02-092-3/+3
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4339 Thunk->Sleep is expecting nanoseconds, no need to multiply by 100. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Deric Cole <deric.cole@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: CI: use ubuntu-22.04 vm_image (Linux only)Oliver Steffen2023-01-171-1/+1
| | | | | | | | | | | | Switch over to ubuntu-22.04 as the vm_image for Linux CI jobs. The previously used ubuntu-18.04 which is not available anymore since Dec 1st 2022. Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chris Fernald <chfernal@microsoft.com>
* EmulatorPkg: CI: Use Fedora 35 container (Linux only)Oliver Steffen2023-01-171-1/+3
| | | | | | | | | | | | | | Run the Linux jobs of the EmulatorPkg platform CI inside a container, in the same way the general CI does now. Make use of the default image specified in the defaults.yml template. Use Python from the container image, do not download at runtime. Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chris Fernald <chfernal@microsoft.com>
* EmulatorPkg: CI: use Python version from defaults templateOliver Steffen2023-01-172-0/+9
| | | | | | | | | | | | | | | | Use the default Python version from the defaults template (.azurepipelines/templates/defaults.yml) in the Windows and Linux CI jobs. Previous changes to the CI job templates make it necessary to specify a version number, if Python shall be pulled at CI runtime. Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chris Fernald <chfernal@microsoft.com>
* EmulatorPkg/RedfishHostInterface: Add NULL functionAbner Chang2022-12-201-0/+24
| | | | | | | | | | | Add NULL function RedfishPlatformHostInterfaceNotification that returns EFI_UNSUPPORTED. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
* EmulatorPkg: Add reference to new build instructionsMichael Kubacki2022-12-161-0/+3
| | | | | | | | | | | | | | Adds a reference to the new build instructions on the TianoCore wiki that currently describe building with containers and Stuart. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
* EmulatorPkg: Record Argc, Argv and Envp in EmuThunk PpiLiu, Zhiguang2022-12-083-0/+9
| | | | | | | | | | Record Argc, Argv and Envp in EmuThunk Ppi so that other modules can use these fields to change behavior depends on boot parameters or environment. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* EmulatorPkg: Remove unnecessary dependency on EmbeddedPkgLiu, Zhiguang2022-12-083-6/+3
| | | | | | | | EmulatorPkg doesn't need depend on EmbeddedPkg, so remove the dependency. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* EmulatorPkg: Add persistent memory in EmuThunkPpiLiu, Zhiguang2022-12-086-7/+29
| | | | | | | | | | | The persistent memory is for PEIM to use, and won't lose during cold or warm reset. PcdPersistentMemorySize is only used by WinHost.c, other modules can check the persistent memory size using the field PersistentMemorySize. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* EmulatorPkg/Win: Unload DLLs before resetRay Ni2022-12-081-0/+14
| | | | | | | | | | | | | | | | | | | EmulatorPkg/Win calls LoadLibraryEx() when the corresponding DLL file is found for each PEIM or DXE driver. The module entry point is changed to point to the entry point from the DLL. This helps to notify Visual Studio that a new windows module is loaded and corresponding symbol parsing is performed for source level debugging. But entry point from the DLL is only executed when the module is not loaded by AddModHandle(). When reset happens, we need to clear the DLL loading so that in next boot the module can be loaded again by AddModHandle(). Without this patch, source level debugging doesn't work after reset. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/WinHost: Add Reset2 PPINi, Ray2022-12-053-10/+71
| | | | | | | | | | When shutdown is requested, WinHost exits. Otherwise, WinHost re-runs from SEC. Tested no extra memory consumption with multiple resets in PEI. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
* EmulatorPkg/WinHost: XIP for SEC and PEI_CORENi, Ray2022-12-051-12/+2
| | | | | | | | | | | | | | | | | | | | | | In EmulatorPkg/Win, SEC and PEI_CORE are loaded to memory allocated through VirtualAlloc. Though the corresponding DLL files are loaded and the entry points in DLL files are executed. The loading to memory allocated through VirtualAlloc is for the case when the DLL files can not be loaded. Actually some PEIMs like PcdPeim which are loaded before "physical" RAM is discovered, they are executing in the original location (FV) like XIP module in real platform. The SEC and PEI_CORE can follow the same mechanism. So, the VirtualAlloc call is removed. This is to prepare the "reset" support to avoid additional OS memory consumption when reset happens. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Andrew Fish <afish@apple.com
* EmulatorPkg/WinHost: pre-allocate "physical" RAMNi, Ray2022-12-051-35/+25
| | | | | | | | | | | Move the "physical" RAM allocation from WinPeiAutoScan to main() entrypoint. This is to prepare the changes for "reset" support. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
* EmulatorPkg/PosixFileSystem: Add NULL check on memory allocationShindo, Miki2022-07-211-1/+1
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4001 This commit adds NULL check on memory allocation of the size for FileName in ASCII string format at PosixFileSetInfo(). Signed-off-by: Miki Shindo <miki.shindo@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: Pipeline: Resolve SecureBootVariableLib dependencyKun Qin2022-07-071-0/+1
| | | | | | | | | | | | | | | | The new changes in SecureBootVariableLib brought in a new dependency of PlatformPKProtectionLib. This change added the new library instance from SecurityPkg to resolve pipeline builds. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Kun Qin <kuqin12@gmail.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
* EmulatorPkg: Add VariableFlashInfoLibMichael Kubacki2022-05-191-0/+1
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Adds an instance of VariableFlashInfoLib to the platform build as it is a new library class introduced in MdeModulePkg. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Abner Chang <abner.chang@hpe.com> Cc: Nickle Wang <nickle.wang@hpe.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Abner Chang <abner.chang@hpe.com>