From nobody Fri Apr 26 11:54:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45296+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45296+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565390653; cv=none; d=zoho.com; s=zohoarc; b=eIhLTX0yz3ya+Bn26Y7jXRFzos6gNYWmgyu8dfvdIb3Ae8noPox0gEfOQUxuRTG6kWKzD/r7JEk4iytEqVWgfFGMFfJ++4AxGPVUqqHHsG/bpgwvCeBX9NqWXiWKMnn+E6pylUrXerS1M7d4GtcuY3+Xupa/FP/Hz/kBeR+hW+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565390653; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=oN/aO/OoDwBgD9vQoLCS7tOh0lwbpiN/R/6XrPnv7X4=; b=ASYZJ+pU6OdLUFfgzsE+AmqGr/KHgcMIwH57i6sp5vUoiifB9G6Ahba0QDDy0iW3mp7jpOMtQ/YLStyKVdJH4bx1hoKkQJwsIcCH+wPA8/lHLEgaNpI0m2NWSrl7r+X/iHypK048MAry8KXDcnmMWW6z1aSCdj77FLpztlKdzN0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45296+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565390653821621.7715269711501; Fri, 9 Aug 2019 15:44:13 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Fri, 09 Aug 2019 15:44:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:44:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,367,1559545200"; d="scan'208";a="193481425" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2019 15:44:12 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni , Hao A Wu Subject: [edk2-devel] [Patch V3 1/4] EmulatorPkg: Fix VS20xx IA32 boot failure Date: Fri, 9 Aug 2019 15:44:02 -0700 Message-Id: <20190809224405.13536-2-michael.d.kinney@intel.com> In-Reply-To: <20190809224405.13536-1-michael.d.kinney@intel.com> References: <20190809224405.13536-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565390653; bh=3CNF0Ri9WoTsEl9SRGGm9Oyjpns7/+jtOq7JvXk4Puk=; h=Cc:Date:From:Reply-To:Subject:To; b=UqDm+Q0tx5PYhF3caIe9cQW/U9JfIGiCdzK7DVIazOG8dpHkeYrbMUlHs0e86i3JGc3 YjGPPj7SwtO1kRm6iqF2le6ISbGk4++K8V3sZrOmiU0IJ347FbDYNDHmBbqfDyvpM6zzR 1dmSeBBw10NHTg8v7r9GCr/9je5uRYzYlM8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D2056 The IA32 build of the EmulatorPkg for VS20xx does not boot because the default value of PCD PcdPeiServicesTablePage rarely succeeds to be mapped on IA32 Windows Host Environments. Change the DEC default value for this PCD to a value that is compatible with Windows and POSIX host environments for IA32 and X64. For IA32 builds, this 64-bit PCD is truncated to a 32-bit value. PcdPeiServicesTablePage is changed from 0x1003000000 to 0x1013000000. With this new value, no boot failures are observed. However, the use of this hard coded value can potentially cause a boot failure if this address specified by the PCD is already allocated in the user process. Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Michael D Kinney Reviewed-by: Hao A Wu Acked-by: Jordan Justen Reviewed-by: Jordan Justen --- EmulatorPkg/EmulatorPkg.dec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec index c36f2c4186..99250d9fe5 100644 --- a/EmulatorPkg/EmulatorPkg.dec +++ b/EmulatorPkg/EmulatorPkg.dec @@ -2,7 +2,7 @@ # # This is the Emu Emulation Environment Platform # -# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
# Portions copyright (c) 2011, Apple Inc. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -66,7 +66,7 @@ [PcdsFixedAtBuild] gEmulatorPkgTokenSpaceGuid.PcdEmuApCount|L"0"|VOID*|0x00001019 =20 ## Magic page to implement PEI Services Table Pointer Lib - gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage|0x1003000000|UINT64|0= x0000101b + gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage|0x1013000000|UINT64|0= x0000101b =20 ## Size of the packet filter gEmulatorPkgTokenSpaceGuid.PcdNetworkPacketFilterSize|524288|UINT32|0x00= 00101c --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45296): https://edk2.groups.io/g/devel/message/45296 Mute This Topic: https://groups.io/mt/32816072/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 11:54:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45298+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45298+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565390654; cv=none; d=zoho.com; s=zohoarc; b=d//MrOA7/eLVDVrPzZEFQKW6thvsx6z6XASZrQK2UI1IysuqLxCJyQQpqRbgx4Nwl6YY7aHB08roGckfbwWD652uWVL+zqN959dWI3vlvQrnhSa6n2yVwk0BbW2dffoID6P3AOzwrql8NytgAcgD85RLs5ZCyBNYzR8xpCSIJUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565390654; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=LQr1miplzLUTWAVE+1G6qQ/SIihjDMWGgd1n3tyv6NE=; b=bG29NR5YUudNk1hH78mhv881+mr/tMruJrbFlFagGeZjf3sKowE5TRTTwPLULZUpWB8FZhEIwJkOkBZpH065Jp3RBIdPgJcWqHpq/0P+CA+uB2jD6VZPqANrc1Kwx7L+bM4lE7Hd4qU4Czn8EsJg+WxUw48yTOrnpNhzJ10ENYM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45298+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565390654342526.3846209644998; Fri, 9 Aug 2019 15:44:14 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 09 Aug 2019 15:44:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:44:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,367,1559545200"; d="scan'208";a="193481428" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2019 15:44:12 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni , Hao A Wu Subject: [edk2-devel] [Patch V3 2/4] EmulatorPkg: Remove UNIX_SEC_BUILD/WIN_SEC_BUILD Date: Fri, 9 Aug 2019 15:44:03 -0700 Message-Id: <20190809224405.13536-3-michael.d.kinney@intel.com> In-Reply-To: <20190809224405.13536-1-michael.d.kinney@intel.com> References: <20190809224405.13536-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565390654; bh=zqqNUF7kKded+7JK03w0nlBc/IVXug9Bxb+fV3f97fQ=; h=Cc:Date:From:Reply-To:Subject:To; b=oixqCKEPPYLUtPto8gRrj7FvTKpjfI+IXKVEVOtcHMfTnNTTdcEtjZr2fqm5Xim3MiM 2C8Ou4W9faLTG6SASBkFwO+w2hTiSz6YVxOyY1nTyrz1q6Wvvc9hVPPiIZUU88aUdnlru v9Cm/O32cxMHrMW57f1RX5kjap2/WjWg4Co= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D2055 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 Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Michael D Kinney Reviewed-by: Hao A Wu Acked-by: Jordan Justen Reviewed-by: Jordan Justen --- EmulatorPkg/EmulatorPkg.dsc | 26 +++++++++++++------------- EmulatorPkg/Readme.md | 8 ++++---- EmulatorPkg/Win/VS2017/BuildVS.bat | 2 +- EmulatorPkg/build.sh | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index ea8b6ce76e..153da464f1 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -4,7 +4,7 @@ # The Emulation Platform can be used to debug individual modules, prior to= creating # a real platform. This also provides an example for how an DSC is created. # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
# Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -236,18 +236,18 @@ [PcdsDynamicHii.common.DEFAULT] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 =20 [Components] -!ifdef $(UNIX_SEC_BUILD) - ## - # Emulator, OS POSIX application - ## - EmulatorPkg/Unix/Host/Host.inf -!endif - -!ifdef $(WIN_SEC_BUILD) - ## - # Emulator, OS WIN application - ## - EmulatorPkg/Win/Host/WinHost.inf +!if "IA32" in $(ARCH) || "X64" in $(ARCH) + !if "MSFT" in $(FAMILY) + ## + # Emulator, OS WIN application + ## + EmulatorPkg/Win/Host/WinHost.inf + !else + ## + # Emulator, OS POSIX application + ## + EmulatorPkg/Unix/Host/Host.inf + !endif !endif =20 !ifndef $(SKIP_MAIN_BUILD) diff --git a/EmulatorPkg/Readme.md b/EmulatorPkg/Readme.md index 461975e859..5ea61ca7ab 100644 --- a/EmulatorPkg/Readme.md +++ b/EmulatorPkg/Readme.md @@ -21,19 +21,19 @@ https://github.com/tianocore/tianocore.github.io/wiki/E= mulatorPkg **You can use the following command to build.** * 32bit emulator in Windows: =20 - `build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD -a IA= 32` + `build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -a IA32` =20 * 64bit emulator in Windows: =20 - `build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD -a X6= 4` + `build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -a X64` =20 * 32bit emulator in Linux: =20 - `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -D UNIX_SEC_BUILD -a IA3= 2` + `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a IA32` =20 * 64bit emulator in Linux: =20 - `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -D UNIX_SEC_BUILD -a X64` + `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a X64` =20 **You can start/run the emulator using the following command:** * 32bit emulator in Windows: diff --git a/EmulatorPkg/Win/VS2017/BuildVS.bat b/EmulatorPkg/Win/VS2017/Bu= ildVS.bat index 83aebc77dc..6fcf40cc0a 100644 --- a/EmulatorPkg/Win/VS2017/BuildVS.bat +++ b/EmulatorPkg/Win/VS2017/BuildVS.bat @@ -1,3 +1,3 @@ cd ../../../ @call edksetup.bat -build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD %* +build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 %* diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh index 2dab035ed5..60056e1b6c 100755 --- a/EmulatorPkg/build.sh +++ b/EmulatorPkg/build.sh @@ -233,13 +233,13 @@ fi =20 case $CLEAN_TYPE in clean) - build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD -n 3 clean + build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $HOST_TOOLS -n 3 clean build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $TARGET_TOOLS -n 3 clean exit $? ;; cleanall) make -C $WORKSPACE/BaseTools clean - build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD -n 3 clean + build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $HOST_TOOLS -n 3 clean build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a $PROCESSOR -b $BUIL= DTARGET -t $TARGET_TOOLS -n 3 clean build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a IA32 -b $BUILDTARGET -t $= TARGET_TOOLS -n 3 clean exit $? @@ -251,9 +251,9 @@ esac # Build the edk2 EmulatorPkg # if [[ $HOST_TOOLS =3D=3D $TARGET_TOOLS ]]; then - build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCE= SSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_$ARCH_SIZE -D UNIX_SEC_BUILD= $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 + build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCE= SSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_$ARCH_SIZE $NETWORK_SUPPORT = $BUILD_NEW_SHELL $BUILD_FAT -n 3 else - build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCE= SSOR -b $BUILDTARGET -t $HOST_TOOLS -D BUILD_$ARCH_SIZE -D UNIX_SEC_BUILD = -D SKIP_MAIN_BUILD -n 3 modules + build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCE= SSOR -b $BUILDTARGET -t $HOST_TOOLS -D BUILD_$ARCH_SIZE -D SKIP_MAIN_BUILD= -n 3 modules build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc $BUILD_OPTIONS -a $PROCE= SSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_$ARCH_SIZE $NETWORK_SUPPORT = $BUILD_NEW_SHELL $BUILD_FAT -n 3 cp "$BUILD_OUTPUT_DIR/${BUILDTARGET}_$HOST_TOOLS/$PROCESSOR/Host" $BUILD= _ROOT_ARCH fi --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45298): https://edk2.groups.io/g/devel/message/45298 Mute This Topic: https://groups.io/mt/32816074/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 11:54:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45299+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45299+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565390654; cv=none; d=zoho.com; s=zohoarc; b=RqMz5+m/hnt+AJqcSN+GdSaee0YC7XOM+JSmONZkQlFUnY16eg7+5uEjorMGaD4aZ0dye/JPX5Iy2AH28dycsuO4EjVXqLL8ck7W4HsGvmRHjdHBKL9bs+/uuhPSRZQDBb5HA7PPHoNbyA2b9N4wsbkLD4a8RTTqwh0W7VNwsxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565390654; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=8HV6SMhCR+eJbqioyhqhMEKQpJJ5grb57xqYh4ewWic=; b=kJHGfLIdF4uEuuKjILp2Go7XB928MQgdlOfP8Z+KUzMWiiMt2td8qoh/9hUvtPmA9qe7IArEIKa3xQ0gaFZoQbyr3ba/iVCTBipzFqYd9IEN0YH/ii2SzRqwAUYmmAgxEfbxW3T1uv//yAFy3iI8B0xr+6BPmOy0Fqs2dTQiwRg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45299+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 156539065476424.234262967592258; Fri, 9 Aug 2019 15:44:14 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Fri, 09 Aug 2019 15:44:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:44:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,367,1559545200"; d="scan'208";a="193481432" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2019 15:44:12 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni , Hao A Wu Subject: [edk2-devel] [Patch V3 3/4] EmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACES Date: Fri, 9 Aug 2019 15:44:04 -0700 Message-Id: <20190809224405.13536-4-michael.d.kinney@intel.com> In-Reply-To: <20190809224405.13536-1-michael.d.kinney@intel.com> References: <20190809224405.13536-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565390654; bh=UsszHYdhGv1Dln9ptDxyhZDEWf3qlKxUscWq5nb3ZM4=; h=Cc:Date:From:Reply-To:Subject:To; b=c3xhr9XI9aC6aVGsrdtRY7gMrlsiHJRVT1x0Hjs34igVb/GBpoZrnOxvW8oRoYYlXKy okM8ZJQF8SkZSYtMs2bik196BS3UNfBdJBwsuQ7NXqXXIJGEHgF7wSmAE9c1cy8f1YUmA k/kmUdst8QWAV8IwVOZ0sQ+sz5VgynysK/Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D162 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 Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Michael D Kinney Reviewed-by: Hao A Wu Acked-by: Jordan Justen Reviewed-by: Jordan Justen --- EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c | 9 +- EmulatorPkg/EmulatorPkg.dsc | 6 +- EmulatorPkg/FlashMapPei/FlashMapPei.c | 8 +- EmulatorPkg/Library/SmbiosLib/SmbiosLib.c | 4 +- .../ThunkProtocolList/ThunkProtocolList.c | 11 +- EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c | 10 +- EmulatorPkg/Unix/Host/PosixFileSystem.c | 80 ++++++++---- EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 4 +- EmulatorPkg/Win/Host/WinFileSystem.c | 116 ++++++++++++------ 9 files changed, 172 insertions(+), 76 deletions(-) diff --git a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c b/EmulatorPkg/Em= uBusDriverDxe/EmuBusDriverDxe.c index 0bf6e723a1..d8380f2be9 100644 --- a/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c +++ b/EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.c @@ -1,7 +1,7 @@ /** @file Emu Bus driver =20 -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -256,7 +256,12 @@ EmuBusDriverBindingStart ( =20 EmuDevice->ControllerNameTable =3D NULL; =20 - StrnCpy (ComponentName, EmuIoThunk->ConfigString, sizeof (ComponentN= ame)/sizeof (CHAR16)); + StrnCpyS ( + ComponentName, + sizeof (ComponentName) / sizeof (CHAR16), + EmuIoThunk->ConfigString, + sizeof (ComponentName) / sizeof (CHAR16) + ); =20 EmuDevice->DevicePath =3D EmuBusCreateDevicePath ( ParentDevicePath, diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index 153da464f1..529adfe1fa 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -408,10 +408,14 @@ [Components] !include NetworkPkg/Network.dsc.inc =20 [BuildOptions] + # + # Disable deprecated APIs. + # + *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES + MSFT:DEBUG_*_*_CC_FLAGS =3D /Od /Oy- MSFT:NOOPT_*_*_CC_FLAGS =3D /Od /Oy- =20 MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CO= NSOLE MSFT:DEBUG_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_= POINT) /BASE:0x10000 MSFT:NOOPT_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_= POINT) /BASE:0x10000 - diff --git a/EmulatorPkg/FlashMapPei/FlashMapPei.c b/EmulatorPkg/FlashMapPe= i/FlashMapPei.c index 2a468e43ac..7744065dd6 100644 --- a/EmulatorPkg/FlashMapPei/FlashMapPei.c +++ b/EmulatorPkg/FlashMapPei/FlashMapPei.c @@ -1,7 +1,7 @@ /*++ @file PEIM to build GUIDed HOBs for platform specific flash map =20 -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -69,9 +69,9 @@ Returns: return Status; } =20 - PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStorag= eVariableBase) + FdFixUp); - PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvStor= ageFtwWorkingBase) + FdFixUp); - PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStorag= eFtwSpareBase) + FdFixUp); + PcdSet64S (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStora= geVariableBase) + FdFixUp); + PcdSet64S (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvSto= rageFtwWorkingBase) + FdFixUp); + PcdSet64S (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStora= geFtwSpareBase) + FdFixUp); =20 return EFI_SUCCESS; } diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c b/EmulatorPkg/Librar= y/SmbiosLib/SmbiosLib.c index 331122e200..3acbb23644 100644 --- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c +++ b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c @@ -4,7 +4,7 @@ =20 =20 Copyright (c) 2012, Apple Inc. All rights reserved. -Portitions Copyright (c) 2006 - 2012, Intel Corporation. All rights reserv= ed.
+Portitions Copyright (c) 2006 - 2019, Intel Corporation. All rights reserv= ed.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -223,7 +223,7 @@ SmbiosLibUpdateUnicodeString ( if (Ascii =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } - UnicodeStrToAsciiStr (String, Ascii); + UnicodeStrToAsciiStrS (String, Ascii, StrSize (String)); =20 StringIndex =3D StringNumber; Status =3D gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, = Ascii); diff --git a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c b/Em= ulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c index b7aacc851c..3a7b6d1ceb 100644 --- a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c +++ b/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c @@ -2,7 +2,7 @@ Emulator Thunk to abstract OS services from pure EFI code =20 Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -37,6 +37,7 @@ AddThunkProtocol ( IN BOOLEAN EmuBusDriver ) { + UINTN Size; CHAR16 *StartString; CHAR16 *SubString; UINTN Instance; @@ -47,8 +48,12 @@ AddThunkProtocol ( } =20 Instance =3D 0; - StartString =3D AllocatePool (StrSize (ConfigString)); - StrCpy (StartString, ConfigString); + Size =3D StrSize (ConfigString); + StartString =3D AllocatePool (Size); + if (StartString =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString); while (*StartString !=3D '\0') { =20 // diff --git a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c b/EmulatorPkg/Uni= x/Host/BerkeleyPacketFilter.c index e318a90740..8d0eb0d197 100644 --- a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c +++ b/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c @@ -4,7 +4,7 @@ =20 Tested on Mac OS X. =20 -Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
Portitions copyright (c) 2011, Apple Inc. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -242,7 +242,7 @@ EmuSnpStart ( // // Associate our interface with this BPF file descriptor. // - AsciiStrCpy (BoundIf.ifr_name, Private->InterfaceName); + AsciiStrCpyS (BoundIf.ifr_name, sizeof (BoundIf.ifr_name), Private->In= terfaceName); if (ioctl (Private->BpfFd, BIOCSETIF, &BoundIf) < 0) { goto DeviceErrorExit; } @@ -1016,7 +1016,11 @@ GetInterfaceMacAddr ( goto Exit; } =20 - UnicodeStrToAsciiStr (Private->Thunk->ConfigString, Private->InterfaceNa= me); + UnicodeStrToAsciiStrS ( + Private->Thunk->ConfigString, + Private->InterfaceName, + StrSize (Private->Thunk->ConfigString) + ); =20 Status =3D EFI_NOT_FOUND; If =3D IfAddrs; diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c b/EmulatorPkg/Unix/Hos= t/PosixFileSystem.c index 6ba3b59d7a..0a618abcd8 100644 --- a/EmulatorPkg/Unix/Host/PosixFileSystem.c +++ b/EmulatorPkg/Unix/Host/PosixFileSystem.c @@ -127,7 +127,11 @@ PosixOpenVolume ( if (PrivateFile->FileName =3D=3D NULL) { goto Done; } - AsciiStrCpy (PrivateFile->FileName, Private->FilePath); + AsciiStrCpyS ( + PrivateFile->FileName, + AsciiStrSize (Private->FilePath), + Private->FilePath + ); =20 PrivateFile->Signature =3D EMU_EFI_FILE_PRIVATE_SIGNATURE; PrivateFile->Thunk =3D Private->Thunk; @@ -377,7 +381,7 @@ PosixFileOpen ( EFI_FILE_INFO *Info; struct stat finfo; int res; - + UINTN Size; =20 PrivateFile =3D EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); PrivateRoot =3D EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (Priva= teFile->SimpleFileSystem); @@ -412,17 +416,18 @@ OpenRoot: =20 CopyMem (NewPrivateFile, PrivateFile, sizeof (EMU_EFI_FILE_PRIVATE)); =20 - NewPrivateFile->FileName =3D malloc (AsciiStrSize (PrivateFile->FileName= ) + 1 + StrLen (FileName) + 1); + Size =3D AsciiStrSize (PrivateFile->FileName) + 1 + StrLen (FileName) + = 1; + NewPrivateFile->FileName =3D malloc (Size); if (NewPrivateFile->FileName =3D=3D NULL) { goto Done; } =20 if (*FileName =3D=3D L'\\') { - AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath); + AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateRoot->FilePath); // Skip first '\'. Src =3D FileName + 1; } else { - AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName); + AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateFile->FileName); Src =3D FileName; } Dst =3D NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName= ); @@ -748,7 +753,7 @@ PosixFileRead ( UINTN NameSize; UINTN ResultSize; CHAR8 *FullFileName; - + UINTN FullFileNameSize; =20 PrivateFile =3D EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); =20 @@ -798,15 +803,16 @@ PosixFileRead ( =20 *BufferSize =3D ResultSize; =20 - FullFileName =3D malloc (AsciiStrLen(PrivateFile->FileName) + 1 + NameSi= ze); + FullFileNameSize =3D AsciiStrLen(PrivateFile->FileName) + 1 + NameSize; + FullFileName =3D malloc (FullFileNameSize); if (FullFileName =3D=3D NULL) { Status =3D EFI_OUT_OF_RESOURCES; goto Done; } =20 - AsciiStrCpy (FullFileName, PrivateFile->FileName); - AsciiStrCat (FullFileName, "/"); - AsciiStrCat (FullFileName, PrivateFile->Dirent->d_name); + AsciiStrCpyS (FullFileName, FullFileNameSize, PrivateFile->FileName); + AsciiStrCatS (FullFileName, FullFileNameSize, "/"); + AsciiStrCatS (FullFileName, FullFileNameSize, PrivateFile->Dirent->d_nam= e); Status =3D UnixSimpleFileSystemFileInfo ( PrivateFile, FullFileName, @@ -1017,7 +1023,11 @@ PosixFileGetInfo ( FileSystemInfoBuffer->BlockSize =3D buf.f_bsize; =20 =20 - StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->Vol= umeLabel); + StrCpyS ( + (CHAR16 *) FileSystemInfoBuffer->VolumeLabel, + (*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16), + PrivateRoot->VolumeLabel + ); *BufferSize =3D SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->V= olumeLabel); =20 } else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoI= dGuid)) { @@ -1026,7 +1036,11 @@ PosixFileGetInfo ( return EFI_BUFFER_TOO_SMALL; } =20 - StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel); + StrCpyS ( + (CHAR16 *) Buffer, + *BufferSize / sizeof (CHAR16), + PrivateRoot->VolumeLabel + ); *BufferSize =3D StrSize (PrivateRoot->VolumeLabel); =20 } @@ -1082,7 +1096,7 @@ PosixFileSetInfo ( CHAR16 *UnicodeFilePtr; int UnixStatus; struct utimbuf Utime; - + UINTN Size; =20 PrivateFile =3D EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); PrivateRoot =3D EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFi= le->SimpleFileSystem); @@ -1110,7 +1124,11 @@ PosixFileSetInfo ( goto Done; } =20 - StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel); + StrCpyS ( + PrivateRoot->VolumeLabel, + StrSize (NewFileSystemInfo->VolumeLabel) / sizeof (CHAR16), + NewFileSystemInfo->VolumeLabel + ); =20 Status =3D EFI_SUCCESS; goto Done; @@ -1125,7 +1143,11 @@ PosixFileSetInfo ( goto Done; } =20 - StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *) Buffer); + StrCpyS ( + PrivateRoot->VolumeLabel, + StrSize (PrivateRoot->VolumeLabel) / sizeof (CHAR16), + (CHAR16 *) Buffer + ); =20 Status =3D EFI_SUCCESS; goto Done; @@ -1183,28 +1205,34 @@ PosixFileSetInfo ( goto Done; } =20 - AsciiStrCpy (OldFileName, PrivateFile->FileName); + AsciiStrCpyS ( + OldFileName, + AsciiStrSize (PrivateFile->FileName), + PrivateFile->FileName + ); =20 // // Make full pathname from new filename and rootpath. // if (NewFileInfo->FileName[0] =3D=3D '\\') { - NewFileName =3D malloc (AsciiStrLen (PrivateRoot->FilePath) + 1 + StrL= en (NewFileInfo->FileName) + 1); + Size =3D AsciiStrLen (PrivateRoot->FilePath) + 1 + StrLen (NewFileInfo= ->FileName) + 1; + NewFileName =3D malloc (Size); if (NewFileName =3D=3D NULL) { goto Done; } =20 - AsciiStrCpy (NewFileName, PrivateRoot->FilePath); + AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath); AsciiFilePtr =3D NewFileName + AsciiStrLen(NewFileName); UnicodeFilePtr =3D NewFileInfo->FileName + 1; *AsciiFilePtr++ =3D'/'; } else { - NewFileName =3D malloc (AsciiStrLen (PrivateFile->FileName) + 2 + StrL= en (NewFileInfo->FileName) + 1); + Size =3D AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo= ->FileName) + 1; + NewFileName =3D malloc (Size); if (NewFileName =3D=3D NULL) { goto Done; } =20 - AsciiStrCpy (NewFileName, PrivateRoot->FilePath); + AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath); AsciiFilePtr =3D NewFileName + AsciiStrLen(NewFileName); if ((AsciiFilePtr[-1] !=3D '/') && (NewFileInfo->FileName[0] !=3D '/')= ) { // make sure there is a / between Root FilePath and NewFileInfo File= name @@ -1312,7 +1340,11 @@ PosixFileSetInfo ( goto Done; } =20 - AsciiStrCpy (PrivateFile->FileName, NewFileName); + AsciiStrCpyS ( + PrivateFile->FileName, + AsciiStrSize (NewFileName), + NewFileName + ); } else { Status =3D EFI_DEVICE_ERROR; goto Done; @@ -1493,7 +1525,11 @@ PosixFileSystmeThunkOpen ( free (Private); return EFI_OUT_OF_RESOURCES; } - StrCpy (Private->VolumeLabel, L"EFI_EMULATED"); + StrCpyS ( + Private->VolumeLabel, + StrSize (L"EFI_EMULATED") / sizeof (CHAR16), + L"EFI_EMULATED" + ); =20 Private->Signature =3D EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE; Private->Thunk =3D This; diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c b/EmulatorPkg/Unix/H= ost/X11GraphicsWindow.c index 9d03c13011..5325a0e35b 100644 --- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c +++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c @@ -1,6 +1,6 @@ /*++ @file =20 -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -957,7 +957,7 @@ X11GraphicsWindowOpen ( XDefineCursor (Drv->display, Drv->win, XCreateFontCursor (Drv->display, = XC_pirate)); =20 Drv->Title =3D malloc (StrSize (This->ConfigString)); - UnicodeStrToAsciiStr (This->ConfigString, Drv->Title); + UnicodeStrToAsciiStrS (This->ConfigString, Drv->Title, StrSize (This->Co= nfigString)); XStoreName (Drv->display, Drv->win, Drv->Title); =20 // XAutoRepeatOff (Drv->display); diff --git a/EmulatorPkg/Win/Host/WinFileSystem.c b/EmulatorPkg/Win/Host/Wi= nFileSystem.c index da6595228d..aab926889e 100644 --- a/EmulatorPkg/Win/Host/WinFileSystem.c +++ b/EmulatorPkg/Win/Host/WinFileSystem.c @@ -1,7 +1,7 @@ /*++ @file Support OS native directory access. =20 -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 =20 @@ -205,8 +205,14 @@ WinNtOpenVolume ( goto Done; } =20 - StrCpy (PrivateFile->FilePath, Private->FilePath); - StrCpy (PrivateFile->FileName, PrivateFile->FilePath); + StrCpyS (PrivateFile->FilePath, + StrSize (Private->FilePath) / sizeof (CHAR16), + Private->FilePath + ); + StrCpyS (PrivateFile->FileName, + StrSize (Private->FilePath) / sizeof (CHAR16), + PrivateFile->FilePath + ); PrivateFile->Signature =3D WIN_NT_EFI_FILE_PRIVATE_SIGNATURE; PrivateFile->Thunk =3D Private->Thunk; PrivateFile->SimpleFileSystem =3D This; @@ -243,8 +249,8 @@ WinNtOpenVolume ( if (TempFileName =3D=3D NULL) { goto Done; } - StrCpy (TempFileName, PrivateFile->FilePath); - StrCat (TempFileName, L"\\*"); + StrCpyS (TempFileName, Size / sizeof (CHAR16), PrivateFile->FilePath); + StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*"); =20 PrivateFile->LHandle =3D FindFirstFile (TempFileName, &PrivateFile->Find= Buf); FreePool (TempFileName); @@ -362,7 +368,7 @@ GetNextFileNameToken ( } else { Offset =3D SlashPos - *FileName; Token =3D AllocateZeroPool ((Offset + 1) * sizeof (CHAR16)); - StrnCpy (Token, *FileName, Offset); + StrnCpyS (Token, Offset + 1, *FileName, Offset); // // Point *FileName to the next character after L'\'. // @@ -496,7 +502,7 @@ WinNtFileOpen ( if (TempFileName =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } - StrCpy (TempFileName, FileName); + StrCpyS (TempFileName, StrSize (FileName) / sizeof (CHAR16), FileName); FileName =3D TempFileName; =20 if (FileName[StrLen (FileName) - 1] =3D=3D L'\\') { @@ -548,9 +554,17 @@ WinNtFileOpen ( } =20 if (PrivateFile->IsDirectoryPath) { - StrCpy (NewPrivateFile->FilePath, PrivateFile->FileName); + StrCpyS ( + NewPrivateFile->FilePath, + StrSize (PrivateFile->FileName) / sizeof (CHAR16), + PrivateFile->FileName + ); } else { - StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath); + StrCpyS ( + NewPrivateFile->FilePath, + StrSize (PrivateFile->FileName) / sizeof (CHAR16), + PrivateFile->FilePath + ); } =20 Size =3D StrSize (NewPrivateFile->FilePath); @@ -563,17 +577,17 @@ WinNtFileOpen ( } =20 if (*FileName =3D=3D L'\\') { - StrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath); - StrCat (NewPrivateFile->FileName, L"\\"); - StrCat (NewPrivateFile->FileName, FileName + 1); + StrCpyS (NewPrivateFile->FileName, Size / sizeof (CHAR16), PrivateRoot= ->FilePath); + StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), L"\\"); + StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), FileName + = 1); } else { - StrCpy (NewPrivateFile->FileName, NewPrivateFile->FilePath); + StrCpyS (NewPrivateFile->FileName, Size / sizeof (CHAR16), NewPrivateF= ile->FilePath); if (StrCmp (FileName, L"") !=3D 0) { // // In case the filename becomes empty, especially after trimming dot= s and blanks // - StrCat (NewPrivateFile->FileName, L"\\"); - StrCat (NewPrivateFile->FileName, FileName); + StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), L"\\"); + StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), FileName); } } =20 @@ -657,7 +671,11 @@ WinNtFileOpen ( goto Done; } =20 - StrCpy (NewPrivateFile->FilePath, NewPrivateFile->FileName); + StrCpyS ( + NewPrivateFile->FilePath, + StrSize (NewPrivateFile->FileName) / sizeof (CHAR16), + NewPrivateFile->FileName + ); if (TempChar !=3D 0) { *(RealFileName - 1) =3D TempChar; } @@ -715,7 +733,7 @@ WinNtFileOpen ( goto Done; } =20 - StrCpy (TempFileName, NewPrivateFile->FileName); + StrCpyS (TempFileName, Size / sizeof (CHAR16), NewPrivateFile->FileNam= e); =20 if ((OpenMode & EFI_FILE_MODE_CREATE)) { // @@ -769,7 +787,7 @@ WinNtFileOpen ( // // Find the first file under it // - StrCat (TempFileName, L"\\*"); + StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*"); NewPrivateFile->LHandle =3D FindFirstFile (TempFileName, &NewPrivateFi= le->FindBuf); FreePool (TempFileName); =20 @@ -1330,8 +1348,8 @@ WinNtFileSetPossition ( goto Done; } =20 - StrCpy (FileName, PrivateFile->FileName); - StrCat (FileName, L"\\*"); + StrCpyS (FileName, Size / sizeof (CHAR16), PrivateFile->FileName); + StrCatS (FileName, Size / sizeof (CHAR16), L"\\*"); =20 if (PrivateFile->LHandle !=3D INVALID_HANDLE_VALUE) { FindClose (PrivateFile->LHandle); @@ -1599,7 +1617,11 @@ WinNtFileGetInfo ( goto Done; } =20 - StrCpy (DriveName, PrivateFile->FilePath); + StrCpyS ( + DriveName, + (StrSize (PrivateFile->FilePath) + 1) / sizeof (CHAR16), + PrivateFile->FilePath + ); for (Index =3D 0; DriveName[Index] !=3D 0 && DriveName[Index] !=3D ':'= ; Index++) { ; } @@ -1664,7 +1686,11 @@ WinNtFileGetInfo ( } } =20 - StrCpy ((CHAR16 *)FileSystemInfoBuffer->VolumeLabel, PrivateRoot->Volu= meLabel); + StrCpyS ( + (CHAR16 *)FileSystemInfoBuffer->VolumeLabel, + (*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16), + PrivateRoot->VolumeLabel + ); *BufferSize =3D SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->V= olumeLabel); Status =3D EFI_SUCCESS; } @@ -1676,7 +1702,11 @@ WinNtFileGetInfo ( goto Done; } =20 - StrCpy ((CHAR16 *)Buffer, PrivateRoot->VolumeLabel); + StrCpyS ( + (CHAR16 *)Buffer, + *BufferSize / sizeof (CHAR16), + PrivateRoot->VolumeLabel + ); *BufferSize =3D StrSize (PrivateRoot->VolumeLabel); Status =3D EFI_SUCCESS; } @@ -1768,7 +1798,11 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel); + StrCpyS ( + PrivateRoot->VolumeLabel, + StrSize (NewFileSystemInfo->VolumeLabel) / sizeof (CHAR16), + NewFileSystemInfo->VolumeLabel + ); =20 Status =3D EFI_SUCCESS; goto Done; @@ -1783,7 +1817,11 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *)Buffer); + StrCpyS ( + PrivateRoot->VolumeLabel, + StrSize (PrivateRoot->VolumeLabel) / sizeof (CHAR16), + (CHAR16 *)Buffer + ); =20 Status =3D EFI_SUCCESS; goto Done; @@ -1852,7 +1890,11 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (OldFileName, PrivateFile->FileName); + StrCpyS ( + OldFileName, + StrSize (PrivateFile->FileName) / sizeof (CHAR16), + PrivateFile->FileName + ); =20 // // Make full pathname from new filename and rootpath. @@ -1867,9 +1909,9 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (NewFileName, PrivateRoot->FilePath); - StrCat (NewFileName, L"\\"); - StrCat (NewFileName, NewFileInfo->FileName + 1); + StrCpyS (NewFileName, Size / sizeof (CHAR16), PrivateRoot->FilePath); + StrCatS (NewFileName, Size / sizeof (CHAR16), L"\\"); + StrCatS (NewFileName, Size / sizeof (CHAR16), NewFileInfo->FileName + = 1); } else { Size =3D StrSize (PrivateFile->FilePath); Size +=3D StrSize (L"\\"); @@ -1880,9 +1922,9 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (NewFileName, PrivateFile->FilePath); - StrCat (NewFileName, L"\\"); - StrCat (NewFileName, NewFileInfo->FileName); + StrCpyS (NewFileName, Size / sizeof (CHAR16), PrivateFile->FilePath); + StrCatS (NewFileName, Size / sizeof (CHAR16), L"\\"); + StrCatS (NewFileName, Size / sizeof (CHAR16), NewFileInfo->FileName); } =20 // @@ -1990,13 +2032,13 @@ WinNtFileSetInfo ( goto Done; } =20 - StrCpy (PrivateFile->FileName, NewFileName); + StrCpyS (PrivateFile->FileName, StrSize (NewFileName) / sizeof (CHAR= 16), NewFileName); =20 Size =3D StrSize (NewFileName); Size +=3D StrSize (L"\\*"); TempFileName =3D AllocatePool (Size); =20 - StrCpy (TempFileName, NewFileName); + StrCpyS (TempFileName, Size / sizeof (CHAR16), NewFileName); =20 if (!PrivateFile->IsDirectoryPath) { PrivateFile->LHandle =3D CreateFile ( @@ -2029,7 +2071,7 @@ WinNtFileSetInfo ( NULL ); =20 - StrCat (TempFileName, L"\\*"); + StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*"); PrivateFile->LHandle =3D FindFirstFile (TempFileName, &FindBuf); =20 FreePool (TempFileName); @@ -2048,7 +2090,7 @@ WinNtFileSetInfo ( Size +=3D StrSize (L"\\*"); TempFileName =3D AllocatePool (Size); =20 - StrCpy (TempFileName, OldFileName); + StrCpyS (TempFileName, Size / sizeof (CHAR16), OldFileName); =20 if (!PrivateFile->IsDirectoryPath) { PrivateFile->LHandle =3D CreateFile ( @@ -2071,7 +2113,7 @@ WinNtFileSetInfo ( NULL ); =20 - StrCat (TempFileName, L"\\*"); + StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*"); PrivateFile->LHandle =3D FindFirstFile (TempFileName, &FindBuf); } =20 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45299): https://edk2.groups.io/g/devel/message/45299 Mute This Topic: https://groups.io/mt/32816075/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 11:54:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45300+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45300+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565390654; cv=none; d=zoho.com; s=zohoarc; b=l6rvwkXI4gQnHCG/7KVCu/ddNs2Y10IaD9NmX2KA3oQ4ASy0T8W8tzYD2pgP9/fCSMATMHBga1yN0hpwY5WifsbEwG85USbNP420oLmntpHkGRl3VoDd89w0ckypfhRlO6MTpCXuQVnb63P64qyAqMSNxRA/q4VFYjqIZLH/jj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565390654; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=H+h5Gbe5/uDP5m/MlJEX90ae9VuRbY9w/lXBLvpB2zc=; b=elSOf0cIwJyVVCIDNgMDqzzPda4NZ57Xh8yNvDyrRGOHqoHmCsq3NqmMYMPIoAwEEJjb0Ep710IdRTeitgx3vyNfZMbUTWEkIUtPKdIXMBq/qbzQXNQoIJCeS3XRwBabKqqHh1Kd9amOYBVpdo5ivFSruQ5vjk/aA+S2A2wL8iQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45300+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565390654613945.4298085721897; Fri, 9 Aug 2019 15:44:14 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Fri, 09 Aug 2019 15:44:14 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:44:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,367,1559545200"; d="scan'208";a="193481435" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2019 15:44:13 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni Subject: [edk2-devel] [Patch V3 4/4] EmulatorPkg: Add support for NOOPT target Date: Fri, 9 Aug 2019 15:44:05 -0700 Message-Id: <20190809224405.13536-5-michael.d.kinney@intel.com> In-Reply-To: <20190809224405.13536-1-michael.d.kinney@intel.com> References: <20190809224405.13536-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565390654; bh=K5p2GKjaQ3QSvstiUNMk05w9cxq+wanD8pnin9Iw/uk=; h=Cc:Date:From:Reply-To:Subject:To; b=jj19fEQHtBSVvShVXfFvG1XbUNam1zmC60w7XEZxLx6/mu0NwkkGH6hfcmZZ7kbBa7a iFN8GVEUKnZb6Psbwwx1O0ygPLbt1Q1nUof5B3hXFdM3vKhNMAkXlFhP0N6/KhGJQ7kIo ymEdgByUVfIugxFT+1hqH7H3V2ImD9AWlHI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add NOOPT to BUILD_TARGETS in DSC file. Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Michael D Kinney Acked-by: Jordan Justen Reviewed-by: Hao A Wu Reviewed-by: Jordan Justen --- EmulatorPkg/EmulatorPkg.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index 529adfe1fa..0af2d1ff95 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -19,7 +19,7 @@ [Defines] OUTPUT_DIRECTORY =3D Build/Emulator$(ARCH) =20 SUPPORTED_ARCHITECTURES =3D X64|IA32 - BUILD_TARGETS =3D DEBUG|RELEASE + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER =3D DEFAULT FLASH_DEFINITION =3D EmulatorPkg/EmulatorPkg.fdf =20 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45300): https://edk2.groups.io/g/devel/message/45300 Mute This Topic: https://groups.io/mt/32816076/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-