summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg/Win
Commit message (Collapse)AuthorAgeFilesLines
* EmulatorPkg: Update code to be more C11 compliant by using __func__Rebecca Cran2023-04-101-1/+1
| | | | | | | | | | | | | | __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: Record Argc, Argv and Envp in EmuThunk PpiLiu, Zhiguang2022-12-081-0/+3
| | | | | | | | | | 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: Add persistent memory in EmuThunkPpiLiu, Zhiguang2022-12-082-2/+11
| | | | | | | | | | | 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: Apply uncrustify changesMichael Kubacki2021-12-0711-1567/+1631
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the EmulatorPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: Change OPTIONAL keyword usage styleMichael D Kinney2021-12-071-1/+1
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney2021-12-071-7/+5
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg/Win/Host: Update CC_FLAGSMichael D Kinney2021-11-291-1/+1
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3747 * Remove deprecated option /Gm that generates a warning. * Remove /Zi and use '=' instead of '== to let DEBUG/RELEASE/NOOPT profile from tools_def.txt enable debug information * Remove /Gs8192 option that is overriding the larger setting of /GS32768 from tools_def.txt that generates a warning. Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Ray Ni <ray.ni@Intel.com>
* EmulatorPkg/host: fix overflow in Multwenyi,xie via groups.io2020-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2947 When calculating memory regions and store the information in the gSystemMemory in file WinHost.c, the code below will cause overflow, because _wtoi (MemorySizeStr) return an int value and SIZE_1MB is also an int value, if MemorySizeStr is lager for example 2048, then result of multiplication will overflow. for (Index = 0, Done = FALSE; !Done; Index++) { // // Save the size of the memory and make a Unicode filename SystemMemory00 // gSystemMemory[Index].Size = _wtoi (MemorySizeStr) * SIZE_1MB; Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
* EmulatorPkg/WinHost: Enable network support.Nickle Wang2020-06-044-1/+1147
| | | | | | | | | | | Follow the implementation from Unix host to implement SNP EMU_IO_THUNK_PROTOCOL and EMU_SNP_PROTOCOL. The network IO driver is the same one as Nt32. Please refer to NETWORK-IO Subproject for network Io driver(SnpNt32Io.dll). Signed-off-by: Nickle Wang <nickle.wang@hpe.com> Signed-off-by: Derek Lin <derek.lin2@hpe.com> Acked-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg/WinHost: Add link flags for VS2019 tool chains.Guomin Jiang2020-04-131-0/+2
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2604 The link flags for VS2019 is absent and result the build fail. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg/Win: Fix various typosAntoine Coeur2020-02-107-19/+19
| | | | | | | | | | | | | Fix various typos in comments and documentation. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-7-philmd@redhat.com>
* EmulatorPkg DSC and WinHost.inf: Update tool chain name to CLANGPDBLiming Gao2019-11-151-4/+4
| | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2341 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* EmulatorPkg: Enable CLANG9 tool chainLiming Gao2019-10-242-4/+10
| | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603 1. Add WIN_HOST_BUILD macro check for CLANG9 tool chain build -p EmulatorPkg\EmulatorPkg.dsc -a IA32 -DWIN_HOST_BUILD=TRUE -t CLANG9 build -p EmulatorPkg\EmulatorPkg.dsc -a X64 -DWIN_HOST_BUILD=TRUE -t CLANG9 2. Append CLANG CC and LINK flags to generate windows HOST. 3. Fix WinHost issue to call GetProcessAffinityMask() API. The input parameter should be UINTN pointer instead of UINT32 pointer. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* WinHost: Add SimplePointer supportMarvin Haeuser2019-10-214-3/+69
| | | | | | | | | Catch WM mouse events and expose them via the SimplePointer protocol. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
* EmulatorPkg/Win/Host: Fix SecPrint() log line endingsMichael D Kinney2019-08-271-13/+13
| | | | | | | | | | | Update use of SecPrint() to consistently use \n\r for line endings to fix formatting issues in the debug log. Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Tested-by: Tim Lewis <tim.lewis@insyde.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* EmulatorPkg/Win/Host: Fix image unload regressionMichael D Kinney2019-08-271-6/+161
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2104 When UEFI Applications or UEFI Drivers are unloaded, the PeCoffLoaderUnloadImageExtraAction() needs to unload the image using FreeLibrary() if the image was successfully loaded using LoadLibrrayEx(). This is a regression from the Nt32Pkg that supported unloading applications and drivers as well as loading the same application or driver multiple times. Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Tested-by: Tim Lewis <tim.lewis@insyde.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* EmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACESMichael D Kinney2019-08-191-37/+79
| | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=162 Update EmulatorPkg specific modules and libraries to use safe string functions in BaseLib and safe PcdSetxx() functions in PcdLib. With these updates, the define DISABLE_NEW_DEPRECATED_INTERFACES is enabled in the DSC file. Cc: Jordan Justen <jordan.l.justen@intel.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: Hao A Wu <hao.a.wu@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Andrew Fish <afish@apple.com>
* EmulatorPkg: Remove UNIX_SEC_BUILD/WIN_SEC_BUILDMichael D Kinney2019-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2055 Remove the use of the defines UNIX_SEC_BUILD and WIN_SEC_BUILD. This simplifies the build command for the EmulatorPkg. Instead, use !if statements in the DSC file using $(ARCH) and $(FAMILY) to determine if the build is for a Windows or POSIX environment. The Readme.md, BAT, and sh files are also updated to remove the use of these defines. Cc: Jordan Justen <jordan.l.justen@intel.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: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Andrew Fish <afish@apple.com>
* EmulatorPkg: Fix VS2015 build when VS2017 also installedMichael Kinney2019-08-061-14/+8
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2045 * Remove INTEL family flags that are no longer used. * Remove [BuildOptions] statements that apply to all MSFT family tool chains * Update [BuildOptions] for VS2015 and VS2015x86 tool chain tags to use the correct path to tools when multiple VS20xx tool chains are installed. Cc: Jordan Justen <jordan.l.justen@intel.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>
* EmulatorPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-0911-76/+11
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* Emulator/Win: Fix build failure using VS2015x86 or old WinSDKRuiyu Ni2018-09-102-8/+17
| | | | | | | | | | | When build with WinSDK <= Win10 TH2, the terminal over CMD.exe doesn't work. Because Win10 later than TH2 starts to support VT terminal. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* EmulatorPkg/Win: Add VS2017 project fileRuiyu Ni2018-08-315-0/+211
| | | | | | | | | | | Developer can build the Win Host in VS2017 and launch to debug it. Platform 'x64' is to build 64bit EmulatorWin. Platform 'Win32' is to build 32bit EmulatorWin. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 64bit)Ruiyu Ni2018-08-312-2/+2
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyStateRuiyu Ni2018-08-311-0/+17
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1118 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Use FrameBufferBltLib for BLT operationRuiyu Ni2018-08-313-151/+72
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg: formalize line endingsRuiyu Ni2018-08-302-2/+2
| | | | | | | | | | | | The patch is the result of running "BaseTools/Scripts/FormatDosFiles.py EmulatorPkg/" No functionality impact. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com>
* EmulatorPkg/Win: Add BlockIo supportRuiyu Ni2018-08-274-0/+570
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Add SimpleFileSystem supportRuiyu Ni2018-08-274-0/+2424
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Add RTC supportRuiyu Ni2018-08-271-2/+56
| | | | | | | | | Now firmware can display the time correctly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Add timer and interrupt supportRuiyu Ni2018-08-271-0/+194
| | | | | | | | | | Now the firmware can boot to Shell and count down 5 seconds to command prompt. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Add input/output supportRuiyu Ni2018-08-276-0/+1507
| | | | | | | | | | The patch adds GOP and SimpleTextIn[Ex] support. Now firmware can boot to UI and Shell but timer doesn't work. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* EmulatorPkg/Win: Enable native OS console as firmware consoleRuiyu Ni2018-08-271-4/+105
| | | | | | | | | | | The patch implements Stdin/Stdout/Stderr access so that the native OS console (cmd.exe) can be used as the firmware console and debug message can also be routed to it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>
* EmulatorPkg/Win: Add Windows host supportRuiyu Ni2018-08-276-0/+1709
This is the initial patch to make it boot to early DXE phase without display (only debug message). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Andrew Fish <afish@apple.com>