From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.68; helo=ma1-aaemail-dr-lapp02.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E30E321A02937 for ; Sun, 4 Nov 2018 10:05:40 -0800 (PST) Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.22/8.16.0.22) with SMTP id wA4I1uDJ025245; Sun, 4 Nov 2018 10:05:37 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=mime-version : content-type : sender : from : message-id : subject : date : in-reply-to : cc : to : references; s=20180706; bh=n11Kkj0cJ43z4yX9LeKh4rn6gFMaxU7QkaY1YCwnBqc=; b=hmeF6nptL6oqU7HYdgpD9fz5IZg0afMn/Md87qeU4o5N8L93gRx70vo34sFm/ex+XHNZ aSxk7QzVXhdk1r2fc1ION9fj5HpCUeKqfTpI7rv+mq0dAgddXDaJ751hu3p59XOwYeDp g6mHSnJo4Ubii5FGzM5JAvCznup1ctAXnn/bMMpKqWZuqrulBfSHOoZo19EJQPIUrTJ4 nRFINeW5I0B/fh7NFLO/afRePUenccyrjfA42aJ0bNTAaTFAdAu480SFU79abdgPPvLi 2pFuPM4HwsCuHDOUshi4L0aQcIGN5myKlIA8+PW7GohW6/V0pxJTWBesdzLSBA2BBCdD fA== Received: from mr2-mtap-s03.rno.apple.com (mr2-mtap-s03.rno.apple.com [17.179.226.135]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 2nh8bvfsu4-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 04 Nov 2018 10:05:36 -0800 MIME-version: 1.0 Received: from ma1-mmpp-sz08.apple.com (ma1-mmpp-sz08.apple.com [17.171.128.176]) by mr2-mtap-s03.rno.apple.com (Oracle Communications Messaging Server 8.0.2.3.20180614 64bit (built Jun 14 2018)) with ESMTPS id <0PHO00HZ4KXCY620@mr2-mtap-s03.rno.apple.com>; Sun, 04 Nov 2018 10:05:36 -0800 (PST) Received: from process_viserion-daemon.ma1-mmpp-sz08.apple.com by ma1-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.2.3.20180629 64bit (built Jun 29 2018)) id <0PHO00400IKTG300@ma1-mmpp-sz08.apple.com>; Sun, 04 Nov 2018 10:05:36 -0800 (PST) X-Va-A: X-Va-T-CD: 4fafd5b5912966ac9494a9ce418e6367 X-Va-E-CD: 3dcd49a262554cd29ae98418a224c1ad X-Va-R-CD: 271156246fd3f0ab27fcb6797b2db959 X-Va-CD: 0 X-Va-ID: 7bf59d2c-21a1-430d-87a8-ac399d6a1317 X-V-A: X-V-T-CD: fbe447b60d40f260936e300fd54beff5 X-V-E-CD: 3dcd49a262554cd29ae98418a224c1ad X-V-R-CD: 271156246fd3f0ab27fcb6797b2db959 X-V-CD: 0 X-V-ID: 3d996f1e-8e97-4075-a9ac-115265c5c2e3 Received: from process_milters-daemon.ma1-mmpp-sz08.apple.com by ma1-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.2.3.20180629 64bit (built Jun 29 2018)) id <0PHO00400IKTG100@ma1-mmpp-sz08.apple.com>; Sun, 04 Nov 2018 10:05:35 -0800 (PST) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-04_14:,, signatures=0 Received: from [17.234.233.216] (unknown [17.234.233.216]) by ma1-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.2.3.20180629 64bit (built Jun 29 2018)) with ESMTPSA id <0PHO00M1UKX8UB30@ma1-mmpp-sz08.apple.com>; Sun, 04 Nov 2018 10:05:35 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <3679EADC-76D9-42E2-ADA7-029E7CC0D2C9@apple.com> Date: Sun, 04 Nov 2018 10:05:30 -0800 In-reply-to: Cc: liming.gao@intel.com, edk2-devel@lists.01.org To: Prem Kumar References: <4A89E2EF3DFEDB4C8BFDE51014F606A14E362114@SHSMSX104.ccr.corp.intel.com> <93E95713-95E9-442B-9AA2-2B2C46EFCA20@apple.com> <6AA7E964-7A49-4C24-84EF-F291D615EC3C@apple.com> X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-04_14:, , signatures=0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: Building EmulatorPkg and EDK2 project issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 18:05:41 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Nov 3, 2018, at 1:55 PM, Prem Kumar wrote: > > Hi Andrew, > Thanks for your explanation. > > After building for x64 I could see below error. > > C:\UEFIWorkspace\edk2-master_2018_Latest\Build\EmulatorX64\DEBUG_VS2015x86\X64>WinHost.exe > > EDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/ > BootMode 0x00 > OS Emulator passing in 128 KB of temp RAM at 0x65e70000 to SEC > ERROR : Can not open Firmware Device File ../FV/FV_RECOVERY.fd (0xE). Exiting. > > > I've searched for FV_RECOVERY.fd in entire project and found no such file generated after built. > Prem, The FD (Flash Device) image should be constructed by the build, and end up in the generated Build directory. The start of the path is the target name, and then a directory that represents some of the flags to the build command. So the FD should live in: Build\EmulatorX64\DEBUG_VS2015x86\FV\FV_RECOVERY.fd. If it is not present it would seem like your build failed? Did you get error messages at the end of the build? This is the fix for the Bugzilla and it does not seem to relate to your failure. /Volumes/Case/UDK2018(vUDK2018)>git show f4eaaf1a6d50c761e2af9a6dd0976fb8a3bd3c08 commit f4eaaf1a6d50c761e2af9a6dd0976fb8a3bd3c08 Author: Ruiyu Ni Date: Fri Aug 31 16:55:36 2018 +0800 Emulator/Win: Fix build failure using VS2015x86 or old WinSDK 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 Cc: Michael D Kinney Reviewed-by: Hao A Wu diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index 9b98d5330f..65e8960eff 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -673,7 +673,7 @@ Returns: // Transfer control to the SEC Core // SwitchStack ( - (SWITCH_STACK_ENTRY_POINT)SecCoreEntryPoint, + (SWITCH_STACK_ENTRY_POINT)(UINTN)SecCoreEntryPoint, SecCoreData, GetThunkPpiList (), TopOfStack diff --git a/EmulatorPkg/Win/Host/WinThunk.c b/EmulatorPkg/Win/Host/WinThunk.c index 306fe75ecd..6007db73b5 100644 --- a/EmulatorPkg/Win/Host/WinThunk.c +++ b/EmulatorPkg/Win/Host/WinThunk.c @@ -71,15 +71,23 @@ SecConfigStdIn ( // // Disable buffer (line input), echo, mouse, window // - Success = SetConsoleMode ( - GetStdHandle (STD_INPUT_HANDLE), - Mode | ENABLE_VIRTUAL_TERMINAL_INPUT & ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT) - ); - } - if (Success) { + Mode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); + +#if defined(NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && (NTDDI_VERSION > NTDDI_WIN10_TH2) // - // Enable terminal mode + // Enable virtual terminal input for Win10 above TH2 // + Mode |= ENABLE_VIRTUAL_TERMINAL_INPUT; +#endif + + Success = SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), Mode); + } + +#if defined(NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && (NTDDI_VERSION > NTDDI_WIN10_TH2) + // + // Enable terminal mode for Win10 above TH2 + // + if (Success) { Success = GetConsoleMode (GetStdHandle (STD_OUTPUT_HANDLE), &Mode); if (Success) { Success = SetConsoleMode ( @@ -88,6 +96,7 @@ SecConfigStdIn ( ); } } +#endif return Success ? EFI_SUCCESS : EFI_DEVICE_ERROR; } Thanks, Andrew Fish > -- > Thanks & Regards, > Prem. > > > > On Sun, Nov 4, 2018 at 1:56 AM Andrew Fish > wrote: > Prem, > > I've not run the emulator on Windows in a very very long time. But lets take a look at your error message. > > /Volumes/Case/UDK2018(vUDK2018)>git grep "Could not allocate PeiServicesTablePage" > EmulatorPkg/Unix/Host/Host.c:508: printf ("MapFd0(): Could not allocate PeiServicesTablePage @ %lx\n", (long unsigned int)EmuMagicPage); > > That seems to point to PcdPeiServicesTablePage > /Volumes/Case/UDK2018(vUDK2018)>git grep PcdPeiServicesTablePage -- *.dec > EmulatorPkg/EmulatorPkg.dec:73: gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage|0x1003000000|UINT64|0x0000101b > > Which has a default value of 0x1003000000. But since you built for IA32 it gets truncated to 0x03000000 > > Do you need 32-bit IA32? Can do a 64-bit build and use X64. Something like: > > build -p EmulatorPkg\EmulatorPkg.dsc -t VS2015x86 -D WIN_SEC_BUILD -a X64 -m EmulatorPkg/Win/Host/WinHost.inf > > It looks like that is hard coded address that needs to get allocated in the emulator, and in your case that allocation is failing. > > Thanks, > > Andrew Fish > > PS I'm not sure the printf is correct: printf ("MapFd0(): Could not allocate PeiServicesTablePage @ %lx\n", (long unsigned int)EmuMagicPage); > Given the width of long is different on different platforms. UINT64 uses long long to make sure things are 64-bits. Not to mention EmuMagicPage is a pointer, not an long unsigned int. > > >> On Nov 3, 2018, at 12:26 PM, Prem Kumar > wrote: >> >> Hi Andrew, >> Thanks for your reply. >> >> Below is the error when trying to launch Emulator after successful build, >> >> 1.Launching Emulator using below command: >> C:\UEFIWorkspace\edk2-master_2018_Latest>cd Build\EmulatorIA32\DEBUG_VS2015x86\IA32\ && WinHost.exe >> >> EDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/ >> BootMode 0x00 >> OS Emulator passing in 128 KB of temp RAM at 0x04400000 to SEC >> ERROR : Could not allocate PeiServicesTablePage @ 03000000 >> >> 2. Launching WinHose.exe directly: >> C:\UEFIWorkspace\edk2-master_2018_Latest\Build\EmulatorIA32\DEBUG_VS2015x86\IA32>WinHost.exe >> >> EDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/ >> BootMode 0x00 >> OS Emulator passing in 128 KB of temp RAM at 0x04ab0000 to SEC >> ERROR : Could not allocate PeiServicesTablePage @ 03000000 >> >> >> >> -- >> Regards, >> Prem. >