From nobody Wed Dec 25 02:04:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510662769226972.2647176040782; Tue, 14 Nov 2017 04:32:49 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D19C42035BB05; Tue, 14 Nov 2017 04:28:39 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7F84A2035A7B1 for ; Tue, 14 Nov 2017 04:28:38 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id r68so21050475wmr.1 for ; Tue, 14 Nov 2017 04:32:45 -0800 (PST) Received: from localhost.localdomain ([84.203.87.147]) by smtp.gmail.com with ESMTPSA id i17sm14574556ede.64.2017.11.14.04.32.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Nov 2017 04:32:43 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=eSONhRX5BSro3KSc0SDTb3JQ2TzOgp6irA8oHLzno1I=; b=uIR+Tr3aPYceJGGpuezU0SyIOS+fG1Lr3NQEsOk2Aax9s3MqTRcZvSZgAbnebAXpxs CoOFovlVye+o9I96KKi1Kr44JU2Nml1Y9shSfycGdYjpQVTb5SodggFZmAwj5OCt3Hv+ x40CVcykXThGZe46i2OyejVmTrxNg3Pvz8uQdeSrNoTQzzWgyS790wBcMEj9XwjwYOgL QygJoK3X0wZTdBApoOvsIbb9wxJOX1Wv9mrLSEdzFsCtB/KAjDmaxm/WuLa/rkS1RXfI y1p5FZFgaedlWKPPdbEB/OoOcpQdNX+MkicMlmyz9eJUAqyvruOZNvBEwu1M+PdFDn9j 50vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=eSONhRX5BSro3KSc0SDTb3JQ2TzOgp6irA8oHLzno1I=; b=H+OqsuHyguo4VQdTXNHVG3diDz25WM2KK0isOEE/bUM5ePD/V0rIP9cikujpQ35tay upu0OqLFK7rrQr2OjD4aBSIUggyApypOyNXaGrwvtjjFTEo3qZoLG0GwUIpmWegK6HfA xxvoBpFx23KKYVQAYG9U66bXC6zdZ7kKdDrHpijvnq2pwCHjEWxuCUKquCCiUb97leRz pAj6nRh/9HmFMx88XLP/8pEmqPquoJyDJ3qXSQn0HxR0VyQH3FQV6imNmDrRnGnRtA6q AOq84rtWek+nv2+wEfUeTsOVB9VzhwFU1tgZK6r+t4k5/A6Z4hDBkofiL0PIZsuzZpJX W5rg== X-Gm-Message-State: AJaThX6l1v4mBmi3JvmPDmNVhduxAjLGMwNZ4NyLOrOTCKF0hq1jkUP+ AbTR2Ox4tp5myvBS+LVxQH2/ISQnjA8= X-Google-Smtp-Source: AGs4zMZ6Ac+ENFuc0DQfsujTV3smrCSulW57sefVVZWnAobBSrXwIY4354CbDQ0FtufMwgWS/hNyJw== X-Received: by 10.80.209.193 with SMTP id i1mr128664edg.107.1510662764078; Tue, 14 Nov 2017 04:32:44 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Date: Tue, 14 Nov 2017 12:32:26 +0000 Message-Id: <20171114123229.3516-2-pete@akeo.ie> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20171114123229.3516-1-pete@akeo.ie> References: <20171114123229.3516-1-pete@akeo.ie> Subject: [edk2] [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is a preliminary patch before the introduction of VS2017 support. Without this, IA32 compilation will produce the following warnings: * warning C4701: potentially uninitialized local variable used * warning C4703: potentially uninitialized local pointer variable used Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Pete Batard --- MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c = | 2 +- MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCus= tomizedUiSupport.c | 2 +- MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c = | 2 +- MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c = | 2 +- NetworkPkg/HttpBootDxe/HttpBootImpl.c = | 2 +- NetworkPkg/HttpBootDxe/HttpBootSupport.c = | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c = b/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c index 17fc3db507d0..fdab07f9738c 100644 --- a/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c +++ b/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c @@ -512,7 +512,7 @@ RequiredDriver ( EFI_STATUS Status; UINT8 ClassGuidNum; EFI_GUID *ClassGuid; - EFI_IFR_FORM_SET *Buffer; + EFI_IFR_FORM_SET *Buffer =3D NULL; UINTN BufferSize; UINT8 *Ptr; UINTN TempSize; diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenan= ceManagerCustomizedUiSupport.c b/MdeModulePkg/Library/BootMaintenanceManage= rUiLib/BootMaintenanceManagerCustomizedUiSupport.c index 6dd4fce13938..4ddfb0926dc2 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= erCustomizedUiSupport.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= erCustomizedUiSupport.c @@ -308,7 +308,7 @@ IsRequiredDriver ( EFI_STATUS Status; UINT8 ClassGuidNum; EFI_GUID *ClassGuid; - EFI_IFR_FORM_SET *Buffer; + EFI_IFR_FORM_SET *Buffer =3D NULL; UINTN BufferSize; UINT8 *Ptr; UINTN TempSize; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeMod= ulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 646864f4dfc1..9e92ff5874b7 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -5307,7 +5307,7 @@ HiiConfigRoutingRouteConfig ( EFI_STRING ConfigResp; UINTN Length; EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_DEVICE_PATH_PROTOCOL *DevicePath =3D NULL; EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; LIST_ENTRY *Link; HII_DATABASE_RECORD *Database; diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c b/MdeModulePkg= /Universal/Network/MnpDxe/MnpMain.c index 31c2e3e5b849..04adae62572b 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c @@ -520,7 +520,7 @@ MnpTransmit ( EFI_STATUS Status; MNP_INSTANCE_DATA *Instance; MNP_SERVICE_DATA *MnpServiceData; - UINT8 *PktBuf; + UINT8 *PktBuf =3D NULL; UINT32 PktLen; EFI_TPL OldTpl; =20 diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe= /HttpBootImpl.c index 06a8a6a38615..2687696b0de1 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -121,7 +121,7 @@ HttpBootStart ( { UINTN Index; EFI_STATUS Status; - CHAR8 *Uri; + CHAR8 *Uri =3D NULL; =20 =20 if (Private =3D=3D NULL || FilePath =3D=3D NULL) { diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBoot= Dxe/HttpBootSupport.c index d508e2c1a979..787dd24e3c71 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -1199,7 +1199,7 @@ HttpBootCheckImageType ( { EFI_STATUS Status; EFI_HTTP_HEADER *Header; - CHAR8 *FilePath; + CHAR8 *FilePath =3D NULL; CHAR8 *FilePost; =20 if (Uri =3D=3D NULL || UriParser =3D=3D NULL || ImageType =3D=3D NULL) { --=20 2.14.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:04:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510662772132905.8202060551209; Tue, 14 Nov 2017 04:32:52 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1D2EB2035BB0C; Tue, 14 Nov 2017 04:28:41 -0800 (PST) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E8CFF2035BB08 for ; Tue, 14 Nov 2017 04:28:39 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id b189so14242230wmd.5 for ; Tue, 14 Nov 2017 04:32:47 -0800 (PST) Received: from localhost.localdomain ([84.203.87.147]) by smtp.gmail.com with ESMTPSA id i17sm14574556ede.64.2017.11.14.04.32.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Nov 2017 04:32:45 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=O7VgwK5tZKzE1Qp2GI3TxC4o4f+WpjoEr6CEVk+fjuI=; b=M3bep8NJx+HPUvEEW1AzHjtDL+G3U+vC2hLOvpr+vxnIov2+s5yVlpDVkvjAZBG4cL ZyUT4mk0zoBQU8lkc5UcHf6if5hoJZiABZ476oYL1QRyML5L0wMnRzblqq8yDGkrpwxs IEB6+OMDwL44Z3PRkLKh7IjQCh+pYqb7OVon2J/R+9UFzRgja/4flVQ0EBlmfc3TQaHl pERiSdUuQ+Ja6RXKkgI0ADQeuIazRaMU9ibAlDCKAfHMEr0J4UC/nOzaBujKHFv4qjnE ryVctVr5cCNB3h3GfecjE5wGjUx4EgTYo4Z4C6pJAEcRWhiLyKmpj05bE33aZa+ePqPg vq6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=O7VgwK5tZKzE1Qp2GI3TxC4o4f+WpjoEr6CEVk+fjuI=; b=QxJPzc+EUtG4PYfNaFTONNq44l9TOQvoaCQGgSpI1NZZOXNqC2raLiJMx2yONxcx4E gI+rbrMhlY1rGSfuQ5w6WD8tEhMngT6d/3rUSvzZLIjfnRhydiVQFnsRVRSSWq6gk2nd TEbekYCrwJ5QuORIWYH2H7L01UyKmPb6m+LgJ4WiSzx8LE9oHO1kDhmF67zzhXvr0rDM UZolbKOjAadX6RyZhyRR8UmbWJ2Fsuio/Fi3kjB6xtCcEK5xvrKp94elQE1H4rMkPPja SDNo0Fv4M+RpQbzX3LbecpOAekDaC4+5ngH22rmjzANcTWpwe5wRZTxXiik+B741YRaI +xvg== X-Gm-Message-State: AJaThX4Al39qZnweg/Iz9HJO6Jq5W7iDkgkrPp/ximeB742kInl7Hl2w TakwiUTyIWsrwcOXlx4ALPiLLZxTq6A= X-Google-Smtp-Source: AGs4zMaccXupkeonmMFNlDE5mhX2nMsNsg67ltYQFc9LWiy16zUqmqRwl6i3NGvcYpMTQhJGf8K+7A== X-Received: by 10.80.180.142 with SMTP id w14mr17175681edd.66.1510662765660; Tue, 14 Nov 2017 04:32:45 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Date: Tue, 14 Nov 2017 12:32:27 +0000 Message-Id: <20171114123229.3516-3-pete@akeo.ie> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20171114123229.3516-1-pete@akeo.ie> References: <20171114123229.3516-1-pete@akeo.ie> Subject: [edk2] [PATCH 2/4] BaseTools: Add VS2017 IA32 and X64 support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For the sake of reducing toolchain combinations, only one variation is supported: x86 tools (MS default) with External ASL and no EBC. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Pete Batard --- BaseTools/Conf/tools_def.template | 108 ++++++++++++++++++++ BaseTools/set_vsprefix_envs.bat | 9 ++ Nt32Pkg/Sec/SecMain.inf | 2 + 3 files changed, 119 insertions(+) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index aebd7d558633..0346750886a2 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -74,6 +74,10 @@ DEFINE VS2015x86_BIN =3D ENV(VS2015_PREFIX)Vc\bin DEFINE VS2015x86_DLL =3D ENV(VS2015_PREFIX)Common7\IDE;DEF(VS2015x86_BI= N) DEFINE VS2015x86_BINX64 =3D DEF(VS2015x86_BIN)\x86_amd64 =20 +DEFINE VS2017_BIN =3D ENV(VS2017_PREFIX)bin\Hostx86 +DEFINE VS2017_BIN_IA32 =3D DEF(VS2017_BIN)\x86 +DEFINE VS2017_BIN_X64 =3D DEF(VS2017_BIN)\x64 + DEFINE WINSDK_BIN =3D ENV(WINSDK_PREFIX) DEFINE WINSDKx86_BIN =3D ENV(WINSDKx86_PREFIX) =20 @@ -93,6 +97,9 @@ DEFINE WINSDK8x86_BIN =3D ENV(WINSDK8x86_PREFIX)x64 DEFINE WINSDK81_BIN =3D ENV(WINSDK81_PREFIX)x86\ DEFINE WINSDK81x86_BIN =3D ENV(WINSDK81x86_PREFIX)x64 =20 +# Microsoft Visual Studio 2017 Community Edition +DEFINE WINSDK10_BIN =3D ENV(WINSDK10_PREFIX)x86 + # These defines are needed for certain Microsoft Visual Studio tools that # are used by other toolchains. An example is that ICC on Windows normally # uses Microsoft's nmake.exe. @@ -318,6 +325,11 @@ DEFINE DTC_BIN =3D ENV(DTC_PREFIX)dtc # Required to build platforms or ACPI tables: # Intel(r) ACPI Compiler (iasl.exe) from # https://acpica.org/downloads +# VS2017 -win32- Requires: +# Microsoft Visual Studio 2017 Community Editi= on +# Intel(r) ACPI Compiler (iasl.exe) from https= ://acpica.org/downloads +# Unsupported: +# Building of EBC drivers # DDK3790 -win32- Requires: # Microsoft Windows Server 2003 Driver Develop= ment Kit (Microsoft WINDDK) version 3790.1830 # Optional: @@ -4060,6 +4072,102 @@ NOOPT_VS2015x86xASL_X64_DLINK_FLAGS =3D /NOLOGO = /NODEFAULTLIB /IGNORE:4001 /OPT *_VS2015x86xASL_EBC_SLINK_FLAGS =3D /lib /NOLOGO /MACHINE:EBC *_VS2015x86xASL_EBC_DLINK_FLAGS =3D "C:\Program Files (x86)\Intel\= EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IM= AGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER =20 +##########################################################################= ########## +# +# Microsoft Visual Studio 2017 +# +# VS2017 - Microsoft Visual Studio 2017 Professional Edition with Intel= ASL +# ASL - Intel ACPI Source Language Compiler +##########################################################################= ########## +# VS2017 - Microsoft Visual Studio 2017 Professional Edition +*_VS2017_*_*_FAMILY =3D MSFT + +*_VS2017_*_MAKE_PATH =3D DEF(VS2017_BIN_IA32)\nmake.exe +*_VS2017_*_MAKE_FLAGS =3D /nologo +*_VS2017_*_RC_PATH =3D DEF(WINSDK10_BIN)\rc.exe + +*_VS2017_*_SLINK_FLAGS =3D /NOLOGO /LTCG +*_VS2017_*_APP_FLAGS =3D /nologo /E /TC +*_VS2017_*_PP_FLAGS =3D /nologo /E /TC /FIAutoGen.h +*_VS2017_*_VFRPP_FLAGS =3D /nologo /E /TC /DVFRCOMPILE /FI$(MOD= ULE_NAME)StrDefs.h +*_VS2017_*_DLINK2_FLAGS =3D + +*_VS2017_*_ASM16_PATH =3D EF(VS2017_BIN_IA32)\ml.exe + +################## +# ASL definitions +################## +*_VS2017_*_ASL_PATH =3D DEF(DEFAULT_WIN_ASL_BIN) +*_VS2017_*_ASL_FLAGS =3D DEF(DEFAULT_WIN_ASL_FLAGS) +*_VS2017_*_ASL_OUTFLAGS =3D DEF(DEFAULT_WIN_ASL_OUTFLAGS) +*_VS2017_*_ASLCC_FLAGS =3D DEF(MSFT_ASLCC_FLAGS) +*_VS2017_*_ASLPP_FLAGS =3D DEF(MSFT_ASLPP_FLAGS) +*_VS2017_*_ASLDLINK_FLAGS =3D DEF(MSFT_ASLDLINK_FLAGS) + +################## +# IA32 definitions +################## +*_VS2017_IA32_*_DLL =3D DEF(VS2017_BIN_IA32) + +*_VS2017_IA32_CC_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_VFRPP_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_SLINK_PATH =3D DEF(VS2017_BIN_IA32)\lib.exe +*_VS2017_IA32_DLINK_PATH =3D DEF(VS2017_BIN_IA32)\link.exe +*_VS2017_IA32_APP_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_PP_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_ASM_PATH =3D DEF(VS2017_BIN_IA32)\ml.exe +*_VS2017_IA32_ASLCC_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_ASLPP_PATH =3D DEF(VS2017_BIN_IA32)\cl.exe +*_VS2017_IA32_ASLDLINK_PATH =3D DEF(VS2017_BIN_IA32)\link.exe + + *_VS2017_IA32_MAKE_FLAGS =3D /nologo + DEBUG_VS2017_IA32_CC_FLAGS =3D /nologo /arch:IA32 /c /WX /GS- /W4 /= Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Gw = /Oi- +RELEASE_VS2017_IA32_CC_FLAGS =3D /nologo /arch:IA32 /c /WX /GS- /W4 /= Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi- +NOOPT_VS2017_IA32_CC_FLAGS =3D /nologo /arch:IA32 /c /WX /GS- /W4 /= Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od /Oi- + + DEBUG_VS2017_IA32_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /coff /Zd /Zi +RELEASE_VS2017_IA32_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /coff /Zd +NOOPT_VS2017_IA32_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /coff /Zd /Zi + + DEBUG_VS2017_IA32_NASM_FLAGS =3D -Ox -f win32 -g +RELEASE_VS2017_IA32_NASM_FLAGS =3D -Ox -f win32 +NOOPT_VS2017_IA32_NASM_FLAGS =3D -O0 -f win32 -g + + DEBUG_VS2017_IA32_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= OPT:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /M= ACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVI= CE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG +RELEASE_VS2017_IA32_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTIO= N:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:E= FI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data +NOOPT_VS2017_IA32_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= OPT:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /M= ACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVI= CE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG + +################## +# X64 definitions +################## +*_VS2017_X64_*_DLL =3D DEF(VS2017_BIN_X64) + +*_VS2017_X64_CC_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_PP_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_APP_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_VFRPP_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_ASM_PATH =3D DEF(VS2017_BIN_X64)\ml64.exe +*_VS2017_X64_SLINK_PATH =3D DEF(VS2017_BIN_X64)\lib.exe +*_VS2017_X64_DLINK_PATH =3D DEF(VS2017_BIN_X64)\link.exe +*_VS2017_X64_ASLCC_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_ASLPP_PATH =3D DEF(VS2017_BIN_X64)\cl.exe +*_VS2017_X64_ASLDLINK_PATH =3D DEF(VS2017_BIN_X64)\link.exe + + DEBUG_VS2017_X64_CC_FLAGS =3D /nologo /c /WX /GS- /W4 /Gs32768 /D UN= ICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Gw /Oi- +RELEASE_VS2017_X64_CC_FLAGS =3D /nologo /c /WX /GS- /W4 /Gs32768 /D UN= ICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi- +NOOPT_VS2017_X64_CC_FLAGS =3D /nologo /c /WX /GS- /W4 /Gs32768 /D UN= ICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Od /Oi- + + DEBUG_VS2017_X64_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /Zd /Zi +RELEASE_VS2017_X64_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /Zd +NOOPT_VS2017_X64_ASM_FLAGS =3D /nologo /c /WX /W3 /Cx /Zd /Zi + + DEBUG_VS2017_X64_NASM_FLAGS =3D -Ox -f win64 -g +RELEASE_VS2017_X64_NASM_FLAGS =3D -Ox -f win64 +NOOPT_VS2017_X64_NASM_FLAGS =3D -O0 -f win64 -g + + DEBUG_VS2017_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OP= T:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Mac= hine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE= _DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG +RELEASE_VS2017_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IG= NORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:= .pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI= _BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data +NOOPT_VS2017_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:= REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machi= ne:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_D= RIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG =20 ##########################################################################= ########## # diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.= bat index b05b1d222083..f45d50ac2de0 100644 --- a/BaseTools/set_vsprefix_envs.bat +++ b/BaseTools/set_vsprefix_envs.bat @@ -90,6 +90,15 @@ if defined VS140COMNTOOLS ( ) ) =20 +if defined VS150COMNTOOLS ( + if not defined VS2017_PREFIX ( + set "VS2017_PREFIX=3D%VCToolsInstallDir%" + ) + if not defined WINSDK10_PREFIX ( + set "WINSDK10_PREFIX=3D%WindowsSdkVerBinPath%" + ) +) + if not defined WINDDK3790_PREFIX ( set WINDDK3790_PREFIX=3DC:\WINDDK\3790.1830\bin\ ) diff --git a/Nt32Pkg/Sec/SecMain.inf b/Nt32Pkg/Sec/SecMain.inf index f2e1520b6dac..aae919415cf6 100644 --- a/Nt32Pkg/Sec/SecMain.inf +++ b/Nt32Pkg/Sec/SecMain.inf @@ -71,6 +71,7 @@ [BuildOptions] MSFT:*_*_IA32_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /base:0x1= 0000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPA= TH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCR= TVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\= x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /D= EBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winm= m.lib Advapi32.lib MSFT:*_VS2015_IA32_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /bas= e:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /= LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib= \%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion= %\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:R= EF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd= .lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib MSFT:*_VS2015x86_IA32_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /= base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib= " /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%= lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVers= ion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OP= T:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib uc= rtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib + MSFT:*_VS2017_IA32_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /bas= e:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /= LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib= \%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion= %\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:R= EF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd= .lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib MSFT:*_*_IA32_CC_FLAGS =3D=3D /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIA= utoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SEC= URE_NO_DEPRECATE MSFT:*_*_IA32_PP_FLAGS =3D=3D /nologo /E /TC /FIAutoGen.h MSFT:*_*_IA32_ASM_FLAGS =3D=3D /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi @@ -79,6 +80,7 @@ [BuildOptions] MSFT:*_*_X64_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /base:0x10= 000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /= LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%Windows= SdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEF= AULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib= MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib MSFT:*_VS2015_X64_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /base= :0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD= 64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /= NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel3= 2.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib A= dvapi32.lib MSFT:*_VS2015x86_X64_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /b= ase:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\= AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"= %WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOL= E /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kern= el32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.li= b Advapi32.lib + MSFT:*_VS2017_X64_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\SecMain.exe" /base= :0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD= 64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /= NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel3= 2.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib A= dvapi32.lib MSFT:*_*_X64_CC_FLAGS =3D=3D /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAu= toGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECU= RE_NO_DEPRECATE MSFT:*_*_X64_PP_FLAGS =3D=3D /nologo /E /TC /FIAutoGen.h MSFT:*_*_X64_ASM_FLAGS =3D=3D /nologo /W3 /WX /c /Cx /Zd /W0 /Zi --=20 2.14.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:04:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510662774706227.67254154921932; Tue, 14 Nov 2017 04:32:54 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5CDDA2035BB04; Tue, 14 Nov 2017 04:28:44 -0800 (PST) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EAE182035A7A9 for ; Tue, 14 Nov 2017 04:28:42 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id r68so17834932wmr.0 for ; Tue, 14 Nov 2017 04:32:50 -0800 (PST) Received: from localhost.localdomain ([84.203.87.147]) by smtp.gmail.com with ESMTPSA id i17sm14574556ede.64.2017.11.14.04.32.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Nov 2017 04:32:47 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=6/2RIntWK1JcFSewoQTqFosHay9Von3RxgvNTmFWQ/c=; b=WWcfOrT8X5gHuDZExjDHokOpXqG81ZqRyg6tVG6X8WYExM1rB++3NoZp3egfn2kHsh eU3/xubFGnVxZK3FQrVH0ooVh7uJgGAPr9nqL0QlPdnKbO4u57LFOOGTK7bdWaUn5ZIn GML/m8ZT+32MYWp2tXesdSjjNMHMv87Mn/MOXnYhLVnRMfJ1hcurZv46bhIthKWQ4sKy 8Nq/WeldhbwJTJn0ntVVTQH4gJifXbgkv5ete/0ExPkJm/K1Dd223mCi367cfRHeFf5p 3qKFKWK+yJa5l0uGpX60bGE4HMngfa6CcOoYdYKlit95j3jXKbIP1hdxsWuCJvDvRATS ia/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6/2RIntWK1JcFSewoQTqFosHay9Von3RxgvNTmFWQ/c=; b=icjCJW031TyJsJ04+txolklTysMaV32G0DZtHrXPIzNNDVJC5ep/zt/Hks2DZeshfR ttBwoxlvNgjXkc9fLxjL3fh/bWG7EA28XdxWAvpLXTx7vGiigyDZbd5j2Pm6fYAVU1zK LDgsyhi1X0Lve5/d2lYqaaOok0SNoTMX5FcZ4mF+le8fF/HAeM5wEL+3OUECLOKzTohp jLk6Kah091w1W8iJsFyvNYQwynWaO3lHvJ8KeSWCrwwImNHXxRXst5ca9gtnl9CscVRr crT1C55wRmHvgrZC75leqAe45XLe+F8RxYQOWzTnlNI02x4Cg/O9T4lK8r06CThQ/zNV yodQ== X-Gm-Message-State: AJaThX5uFMZenVCsLJ9LR6AzwlO9IsndfVwVTsQFQmN+/bDvGDjZ2s1L ZmowJLhfMvFv7WbEunCu7oSLq3wqEC4= X-Google-Smtp-Source: AGs4zMa0YqXMnz/ZzjmavMorfhxtb0PiSs4zm9PFo+q6nzFpMvhzokKzdnYfyaGSqgRPTgbNhCD26w== X-Received: by 10.80.173.56 with SMTP id y53mr7350804edc.202.1510662768475; Tue, 14 Nov 2017 04:32:48 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Date: Tue, 14 Nov 2017 12:32:28 +0000 Message-Id: <20171114123229.3516-4-pete@akeo.ie> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20171114123229.3516-1-pete@akeo.ie> References: <20171114123229.3516-1-pete@akeo.ie> Subject: [edk2] [PATCH 3/4] BaseTools: Add VS2017 ARM support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Requires the silencing of the following warnings: * warning C4100: unreferenced formal parameter * warning C4127: conditional expression is constant * warning C4214: nonstandard extension used: bit field types other than int Also requires _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE to be defined for the Windows SDK to allow ARM compilation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Pete Batard --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm | 255 +++++= +++++++++++++++ ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm | 45 ++++ ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 13 +- ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c | 30 +++ ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c | 29 +++ BaseTools/Conf/build_rule.template | 30 +++ BaseTools/Conf/tools_def.template | 30 +++ MdePkg/Include/Base.h | 15 ++ MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm | 5 +- MdePkg/Library/BaseLib/BaseLib.inf | 19 +- MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf | 5 +- MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c | 18 ++ 12 files changed, 486 insertions(+), 8 deletions(-) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm b/ArmPkg/Li= brary/CompilerIntrinsicsLib/Arm/rtdiv.asm new file mode 100644 index 000000000000..096dc6317318 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm @@ -0,0 +1,255 @@ +///** @file +// +// This code provides replacement for MSVC CRT division functions +// +// Copyright (c) 2017, Pete Batard. All rights reserved.
+// Based on generated assembly of ReactOS' sdk/lib/crt/math/arm/__rt_###d= iv.c, +// Copyright (c) Timo Kreuzer. All rights reserved.
+// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the = BSD License +// which accompanies this distribution. The full text of the license may= be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. +// +//**/ + + EXPORT _fltused + EXPORT __brkdiv0 + + EXPORT __rt_sdiv + EXPORT __rt_udiv + EXPORT __rt_udiv64 + EXPORT __rt_sdiv64 + + AREA Math, CODE, READONLY + +_fltused + dcd 0x9875 + +__brkdiv0 + udf #249 + +// +// uint64_t __rt_udiv(uint32_t divisor, uint32_t dividend) +// + +__rt_udiv + cmp r0, #0 + beq __brkdiv0 + push {r3-r5,lr} + mov r5,r0 + mov r4,r1 + cmp r5,r4 + it hi + movhi r0,#0 + bhi __rt_udiv_label3 + clz r2,r5 + clz r3,r4 + subs r3,r2,r3 + movs r1,#1 + lsl r2,r5,r3 + lsl r3,r1,r3 + movs r0,#0 +__rt_udiv_label1 + cmp r4,r2 + bcc __rt_udiv_label2 + orrs r0,r0,r3 + subs r4,r4,r2 +__rt_udiv_label2 + lsrs r2,r2,#1 + lsrs r3,r3,#1 + bne __rt_udiv_label1 +__rt_udiv_label3 + mov r1,r4 + pop {r3-r5,pc} + +// +// uint64_t __rt_sdiv(int32_t divisor, int32_t dividend) +// + +__rt_sdiv + cmp r0, #0 + beq __brkdiv0 + push {r4-r6,lr} + mov r4,r1 + ands r6,r0,#0x80000000 + it ne + rsbne r4,r4,#0 + mov r5,r0 + rsbs r5,r5,#0 + cmp r5,r4 + it hi + movhi r0,#0 + bhi __rt_sdiv_label3 + clz r2,r5 + clz r3,r4 + subs r3,r2,r3 + movs r1,#1 + lsl r2,r5,r3 + lsl r3,r1,r3 + movs r0,#0 +__rt_sdiv_label1 + cmp r4,r2 + bcc __rt_sdiv_label2 + orrs r0,r0,r3 + subs r4,r4,r2 +__rt_sdiv_label2 + lsrs r2,r2,#1 + lsrs r3,r3,#1 + bne __rt_sdiv_label1 +__rt_sdiv_label3 + cbz r6,__rt_sdiv_label4 + rsbs r4,r4,#0 +__rt_sdiv_label4 + mov r1,r4 + pop {r4-r6,pc} + +// +// typedef struct { +// uint64_t quotient; +// uint64_t modulus; +// } udiv64_result_t; +// +// void __rt_udiv64_internal(udiv64_result_t *result, uint64_t divisor, ui= nt64_t dividend) +// + +__rt_udiv64_internal + orrs r1,r2,r3 + beq __brkdiv0 + push {r4-r8,lr} + mov r7,r3 + mov r6,r2 + mov r4,r0 + ldrd r0,r5,[sp,#0x18] + cmp r7,r5 + bcc __rt_udiv64_internal_label2 + bhi __rt_udiv64_internal_label1 + cmp r6,r0 + bls __rt_udiv64_internal_label2 +__rt_udiv64_internal_label1 + movs r3,#0 + strd r3,r3,[r4] + b __rt_udiv64_internal_label8 +__rt_udiv64_internal_label2 + clz r2,r7 + cmp r2,#0x20 + bne __rt_udiv64_internal_label3 + clz r3,r6 + add r2,r2,r3 +__rt_udiv64_internal_label3 + clz r1,r5 ; + cmp r1,#0x20 + bne __rt_udiv64_internal_label4 + clz r3,r0 + add r1,r1,r3 +__rt_udiv64_internal_label4 + subs r1,r2,r1 + rsb r3,r1,#0x20 + lsr r3,r6,r3 + lsl r2,r7,r1 + orrs r2,r2,r3 + sub r3,r1,#0x20 + lsl r3,r6,r3 + orrs r2,r2,r3 + lsl r7,r6,r1 + sub r3,r1,#0x20 + movs r6,#1 + lsls r6,r6,r3 + movs r3,#1 + mov lr,#0 + lsl r1,r3,r1 + mov r8,lr +__rt_udiv64_internal_label5 + cmp r5,r2 + bcc __rt_udiv64_internal_label7 + bhi __rt_udiv64_internal_label6 + cmp r0,r7 + bcc __rt_udiv64_internal_label7 +__rt_udiv64_internal_label6 + subs r0,r0,r7 + sbcs r5,r5,r2 + orr lr,lr,r1 + orr r8,r8,r6 +__rt_udiv64_internal_label7 + lsls r3,r2,#0x1F + orr r7,r3,r7,lsr #1 + lsls r3,r6,#0x1F + orr r1,r3,r1,lsr #1 + lsrs r6,r6,#1 + lsrs r2,r2,#1 + orrs r3,r1,r6 + bne __rt_udiv64_internal_label5 + strd lr,r8,[r4] +__rt_udiv64_internal_label8 + str r5,[r4,#0xC] + str r0,[r4,#8] + pop {r4-r8,pc} + +// +// {int64_t, int64_t} __rt_sdiv64(int64_t divisor, int64_t dividend) +// + +__rt_sdiv64 + push {r4-r6,lr} + sub sp,sp,#0x18 + and r6,r1,#0x80000000 + movs r4,r6 + mov r5,r0 + beq __rt_sdiv64_label1 + movs r0,#0 + rsbs r2,r2,#0 + sbc r3,r0,r3 +__rt_sdiv64_label1 + movs r4,r6 + beq __rt_sdiv64_label2 + movs r0,#0 + rsbs r5,r5,#0 + sbc r1,r0,r1 +__rt_sdiv64_label2 + str r2,[sp] + str r3,[sp,#4] + mov r3,r1 + mov r2,r5 + add r0,sp,#8 + bl __rt_udiv64_internal + movs r3,r6 + beq __rt_sdiv64_label3 + ldrd r3,r2,[sp,#0x10] + movs r1,#0 + rsbs r3,r3,#0 + sbcs r1,r1,r2 + b __rt_sdiv64_label4 +__rt_sdiv64_label3 + ldrd r3,r1,[sp,#0x10] +__rt_sdiv64_label4 + mov r2,r3 + ldr r0,[sp,#8] + mov r3,r1 + ldr r1,[sp,#0xC] + add sp,sp,#0x18 + pop {r4-r6,pc} + +// +// {uint64_t, uint64_t} __rt_udiv64(uint64_t divisor, uint64_t dividend) +// + +__rt_udiv64 + push {r4,r5,lr} + sub sp,sp,#0x1C + mov r4,r2 + mov r2,r0 + mov r5,r3 + add r0,sp,#8 + mov r3,r1 + str r4,[sp] + str r5,[sp,#4] + bl __rt_udiv64_internal + ldrd r2,r3,[sp,#0x10] + ldrd r0,r1,[sp,#8] + add sp,sp,#0x1C + pop {r4,r5,pc} + + END diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm b/ArmPkg/L= ibrary/CompilerIntrinsicsLib/Arm/rtsrsh.asm new file mode 100644 index 000000000000..2332dda823f2 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm @@ -0,0 +1,45 @@ +///** @file +// +// This code provides replacement for MSVC CRT __rt_srsh +// +// Copyright (c) Timo Kreuzer. All rights reserved.
+// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the = BSD License +// which accompanies this distribution. The full text of the license may= be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. +// +//**/ + + EXPORT __rt_srsh + + AREA Math, CODE, READONLY + +// +// int64_t __rt_srsh(int64_t value, uint32_t shift); +// + +__rt_srsh + rsbs r3, r2, #32 + bmi __rt_srsh_label1 + lsr r0, r0, r2 + lsl r3, r1, r3 + orr r0, r0, r3 + asr r1, r1, r2 + bx lr +__rt_srsh_label1 + cmp r2, 64 + bhs __rt_srsh_label2 + sub r3, r2, #32 + asr r0, r1, r3 + asr r1, r1, #32 + bx lr +__rt_srsh_label2 + asr r1, r1, #32 + mov r0, r1 + bx lr + + END diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf= b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf index 44333141a70a..0dacc5e5117d 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf +++ b/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -23,8 +23,12 @@ [Defines] LIBRARY_CLASS =3D CompilerIntrinsicsLib =20 [Sources] - memcpy.c - memset.c + memcpy.c | RVCT + memcpy.c | GCC + memcpy_ms.c | MSFT + memset.c | RVCT + memset.c | GCC + memset_ms.c | MSFT =20 [Sources.ARM] Arm/mullu.asm | RVCT @@ -94,6 +98,8 @@ [Sources.ARM] Arm/llsr.S | GCC Arm/llsl.S | GCC =20 + Arm/rtdiv.asm | MSFT + Arm/rtsrsh.asm | MSFT =20 [Packages] MdePkg/MdePkg.dec @@ -101,3 +107,6 @@ [Packages] =20 [LibraryClasses] =20 +[BuildOptions] + MSFT:*_*_ARM_CC_FLAGS =3D /GL- + MSFT:*_*_AARCH64_CC_FLAGS =3D /GL- diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/ArmPkg/Libr= ary/CompilerIntrinsicsLib/memcpy_ms.c new file mode 100644 index 000000000000..19d89c190362 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------= ------ +// +// Copyright (c) 2017, Pete Batard. All rights reserved.
+// +// This program and the accompanying materials are licensed and made +// available under the terms and conditions of the BSD License which +// accompanies this distribution. The full text of the license may be +// found at http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +// IMPLIED. +// +//------------------------------------------------------------------------= ------ + +#include // For size_t + +void* memcpy(void *, const void *, size_t); +#pragma intrinsic(memcpy) +#pragma function(memcpy) +void* memcpy(void *dest, const void *src, size_t n) +{ + unsigned char *d =3D dest; + unsigned char const *s =3D src; + + while (n--) + *d++ =3D *s++; + + return dest; +} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/ArmPkg/Libr= ary/CompilerIntrinsicsLib/memset_ms.c new file mode 100644 index 000000000000..229466faef2f --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------= ------ +// +// Copyright (c) 2017, Pete Batard. All rights reserved.
+// +// This program and the accompanying materials are licensed and made +// available under the terms and conditions of the BSD License which +// accompanies this distribution. The full text of the license may be +// found at http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +// IMPLIED. +// +//------------------------------------------------------------------------= ------ + +#include // For size_t + +void* memset(void *, int, size_t); +#pragma intrinsic(memset) +#pragma function(memset) +void *memset(void *s, int c, size_t n) +{ + unsigned char *d =3D s; + + while (n--) + *d++ =3D (unsigned char)c; + + return s; +} diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule= .template index 3e6aa8ff0f34..08c1df14af90 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -207,6 +207,36 @@ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing is= sues "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii =20 +[Assembly-Code-File.COMMON.ARM] + # Remove --convert-hex for ARM as it breaks MSFT assemblers + + ?.asm, ?.Asm, ?.ASM + + + ?.S, ?.s + + + $(MAKE_FILE) + + + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_ba= se}.iii ${d_path}(+)${s_base}.i + "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s= _base}.iii + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii ${d_pa= th}(+)${s_base}.i + "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s= _base}.iii + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_pa= th}(+)${s_base}.i + # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing is= sues + "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii + [Nasm-Assembly-Code-File.COMMON.COMMON] ?.nasm diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 0346750886a2..4bc057f1a568 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -77,6 +77,7 @@ DEFINE VS2015x86_BINX64 =3D DEF(VS2015x86_BIN)\x86_amd64 DEFINE VS2017_BIN =3D ENV(VS2017_PREFIX)bin\Hostx86 DEFINE VS2017_BIN_IA32 =3D DEF(VS2017_BIN)\x86 DEFINE VS2017_BIN_X64 =3D DEF(VS2017_BIN)\x64 +DEFINE VS2017_BIN_ARM =3D DEF(VS2017_BIN)\arm =20 DEFINE WINSDK_BIN =3D ENV(WINSDK_PREFIX) DEFINE WINSDKx86_BIN =3D ENV(WINSDKx86_PREFIX) @@ -4169,6 +4170,35 @@ NOOPT_VS2017_X64_NASM_FLAGS =3D -O0 -f win64 -g RELEASE_VS2017_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IG= NORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:= .pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI= _BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data NOOPT_VS2017_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:= REF /OPT:ICF=3D10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machi= ne:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_D= RIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG =20 +################# +# ARM definitions +################# +*_VS2017_ARM_*_DLL =3D DEF(VS2017_BIN_ARM) + +*_VS2017_ARM_CC_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_VFRPP_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_SLINK_PATH =3D DEF(VS2017_BIN_ARM)\lib.exe +*_VS2017_ARM_DLINK_PATH =3D DEF(VS2017_BIN_ARM)\link.exe +*_VS2017_ARM_APP_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_PP_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_ASM_PATH =3D DEF(VS2017_BIN_ARM)\armasm.exe +*_VS2017_ARM_ASLCC_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_ASLPP_PATH =3D DEF(VS2017_BIN_ARM)\cl.exe +*_VS2017_ARM_ASLDLINK_PATH =3D DEF(VS2017_BIN_ARM)\link.exe + + *_VS2017_ARM_MAKE_FLAGS =3D /nologo + DEBUG_VS2017_ARM_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy= /Zi /Gm /Gw /Oi- /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +RELEASE_VS2017_ARM_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw= /Oi- /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +NOOPT_VS2017_ARM_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /= Od /Oi- /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE + + DEBUG_VS2017_ARM_ASM_FLAGS =3D /nologo /g +RELEASE_VS2017_ARM_ASM_FLAGS =3D /nologo +NOOPT_VS2017_ARM_ASM_FLAGS =3D /nologo + + DEBUG_VS2017_ARM_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM= /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER = /SAFESEH:NO /BASE:0 /DRIVER /DEBUG +RELEASE_VS2017_ARM_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D= /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SE= RVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data +NOOPT_VS2017_ARM_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM= /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER = /SAFESEH:NO /BASE:0 /DRIVER /DEBUG + ##########################################################################= ########## # # Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Ti= me Code Generation) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 02140a5ac2ee..3bf8ede016de 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -631,6 +631,21 @@ struct _LIST_ENTRY { =20 #define VA_COPY(Dest, Start) __va_copy (Dest, Start) =20 +#elif defined(_M_ARM) +// +// MSFT ARM variable argument list support. +// + +// Standard Visual Studio header +#include + +typedef char* VA_LIST; + +#define VA_START(ap, num) va_start(ap, num) +#define VA_ARG(ap, type) va_arg(ap, type) +#define VA_END(ap) va_end(ap) +#define VA_COPY(dest, src) va_copy(dest, src) + #elif defined(__GNUC__) =20 #if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS) diff --git a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm b/MdePkg/Library/= BaseLib/Arm/CpuBreakpoint.asm index 8a8065159bf2..2e508d6f1ad8 100644 --- a/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm +++ b/MdePkg/Library/BaseLib/Arm/CpuBreakpoint.asm @@ -16,7 +16,10 @@ =20 EXPORT CpuBreakpoint =20 - AREA Cpu_Breakpoint, CODE, READONLY +; Force ARM mode for this section, as MSFT assembler defaults to THUMB + AREA Cpu_Breakpoint, CODE, READONLY, ARM + + ARM =20 ;/** ; Generates a breakpoint on the CPU. diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/Ba= seLib.inf index 320ac457ea3d..4337a125d516 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -821,8 +821,9 @@ [Sources.EBC] [Sources.ARM] Arm/InternalSwitchStack.c Arm/Unaligned.c - Math64.c | RVCT=20 - =20 + Math64.c | RVCT + Math64.c | MSFT + Arm/SwitchStack.asm | RVCT Arm/SetJumpLongJump.asm | RVCT Arm/DisableInterrupts.asm | RVCT @@ -831,7 +832,16 @@ [Sources.ARM] Arm/CpuPause.asm | RVCT Arm/CpuBreakpoint.asm | RVCT Arm/MemoryFence.asm | RVCT -=20 + + Arm/SwitchStack.asm | MSFT + Arm/SetJumpLongJump.asm | MSFT + Arm/DisableInterrupts.asm | MSFT + Arm/EnableInterrupts.asm | MSFT + Arm/GetInterruptsState.asm | MSFT + Arm/CpuPause.asm | MSFT + Arm/CpuBreakpoint.asm | MSFT + Arm/MemoryFence.asm | MSFT + Arm/Math64.S | GCC Arm/SwitchStack.S | GCC Arm/EnableInterrupts.S | GCC @@ -870,3 +880,6 @@ [Pcd] =20 [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES + +[BuildOptions] + MSFT:*_*_ARM_CC_FLAGS =3D /GL- diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf b/MdePk= g/Library/BaseStackCheckLib/BaseStackCheckLib.inf index d02d97107b08..e280651b1199 100644 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf +++ b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf @@ -30,8 +30,9 @@ [Defines] # =20 [Sources] - BaseStackCheckGcc.c | GCC - BaseStackCheckGcc.c | RVCT + BaseStackCheckGcc.c | GCC + BaseStackCheckGcc.c | RVCT + BaseStackCheckNull.c | MSFT =20 [Packages] MdePkg/MdePkg.dec diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c b/MdePkg= /Library/BaseStackCheckLib/BaseStackCheckNull.c new file mode 100644 index 000000000000..fb2f65929d3e --- /dev/null +++ b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c @@ -0,0 +1,18 @@ +/*++ + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD= License + which accompanies this distribution. The full text of the license may be= found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPL= IED. + +Abstract: + + This file is purely empty as a work around for BaseStackCheck to pass MS= VC build. + +**/ + +extern int __BaseStackCheckNull; --=20 2.14.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:04:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510662777722427.5653907213572; Tue, 14 Nov 2017 04:32:57 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A02B02035BB08; Tue, 14 Nov 2017 04:28:46 -0800 (PST) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0D44F2035A7A9 for ; Tue, 14 Nov 2017 04:28:44 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id y80so20925783wmd.0 for ; Tue, 14 Nov 2017 04:32:52 -0800 (PST) Received: from localhost.localdomain ([84.203.87.147]) by smtp.gmail.com with ESMTPSA id i17sm14574556ede.64.2017.11.14.04.32.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Nov 2017 04:32:50 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=QjS7xm9Ek4K3vP2XI28PC02FOxiHBEBBQ+OzYVvmQEU=; b=YX4a6wWhGfYjlW54iReSUOkI2RXSIqQCYp7tPJVN67dEx8Yj11cRhhZz4GdSHHSQOj nWH/hQg5yYXd+Ayiv2X9+WPBji50LrPbmrb710XvZzC1OVvu/EQrTXuwhxLqtY9qKR+t PJe0ofpyLv1jRKJ61kBHJtqxV+QXZjV9h/gM6B938mdfi0JY+FmEs5pduQ78bgXu1RsG kX9jqzf+iyiOjLEgGewJ8V4DqaoSeyUnuFyz7d8t9dXX47bBBQW0ayWs6r3IGbGiMbtz UaFcEHdGq7kD7EF9XZob5AOYUwWNuTpLze/8mZ+ihoPTHlDemEx6OtuoVcaEt8jyWQ61 KHhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=QjS7xm9Ek4K3vP2XI28PC02FOxiHBEBBQ+OzYVvmQEU=; b=diYmb/ir5AzyG/qvQw9yedJBL2PuVd/sxNU5W8s447Mr+2IwqwKkO/b3/0U7uvviMC uaW8R2bQmwvXPQtRwEZFuL6LR2opZU/mBXnA8KbKAjtzy737bXkncxpwpjAtNxVl3PkU tWuEnAV6ui61cvSr3ghVuN+fol7E9dq3e3WP1TKwqTJ5Vo9RmDM1GB4n5TIFUKW31/8k 0FuThNtLy3gDPkkNjhmIr1/6WAj0giM/SlqBveDGteVDc58YOziSEiOUVYkYGnAAPJ7j 6al74Phs1jVIN9ozX+kwbXJyll7qg2VgWOdGd3PS1K9Lxbasv2BoIuUdGxnyafke5M6X p52Q== X-Gm-Message-State: AJaThX5Jt8vJ/BKj/Br2WZa5e+uRDCrktkjr8iP9oCs1lju2HHaObFLe Jbo+PRoWF2+3rv9oPR22OtYZDV83ZwY= X-Google-Smtp-Source: AGs4zMZlyo1GUbXrOpQpqvsLwHN9oIh8xWyt3hT+FXF7QeK96MzS6Lcxj/Pg3qGiIVlxKmFm9wIk6Q== X-Received: by 10.80.155.90 with SMTP id a26mr17561457edj.21.1510662770496; Tue, 14 Nov 2017 04:32:50 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Date: Tue, 14 Nov 2017 12:32:29 +0000 Message-Id: <20171114123229.3516-5-pete@akeo.ie> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20171114123229.3516-1-pete@akeo.ie> References: <20171114123229.3516-1-pete@akeo.ie> Subject: [edk2] [PATCH 4/4] BaseTools: Add VS2017 AARCH64 support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Requires the silencing of the same warnings as ARM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Pete Batard --- BaseTools/Conf/build_rule.template | 4 +- BaseTools/Conf/tools_def.template | 32 ++++++- MdePkg/Include/Base.h | 2 +- MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm | 39 ++++++++ MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm | 37 +++++++ MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm | 37 +++++++ MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm | 49 ++++++++++ MdePkg/Library/BaseLib/AArch64/MemoryFence.asm | 38 ++++++++ MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 101 ++++++++++++++= ++++++ MdePkg/Library/BaseLib/AArch64/SwitchStack.asm | 69 +++++++++++++ MdePkg/Library/BaseLib/BaseLib.inf | 8 ++ 11 files changed, 412 insertions(+), 4 deletions(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule= .template index 08c1df14af90..0cf9985cb333 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -207,8 +207,8 @@ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing is= sues "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii =20 -[Assembly-Code-File.COMMON.ARM] - # Remove --convert-hex for ARM as it breaks MSFT assemblers +[Assembly-Code-File.COMMON.ARM,Assembly-Code-File.COMMON.AARCH64] + # Remove --convert-hex for ARM/AARCH64 as it breaks MSFT assemblers ?.asm, ?.Asm, ?.ASM =20 diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 4bc057f1a568..9c81a06822e9 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -78,6 +78,7 @@ DEFINE VS2017_BIN =3D ENV(VS2017_PREFIX)bin\Hostx= 86 DEFINE VS2017_BIN_IA32 =3D DEF(VS2017_BIN)\x86 DEFINE VS2017_BIN_X64 =3D DEF(VS2017_BIN)\x64 DEFINE VS2017_BIN_ARM =3D DEF(VS2017_BIN)\arm +DEFINE VS2017_BIN_AARCH64 =3D DEF(VS2017_BIN)\arm64 =20 DEFINE WINSDK_BIN =3D ENV(WINSDK_PREFIX) DEFINE WINSDKx86_BIN =3D ENV(WINSDKx86_PREFIX) @@ -327,7 +328,7 @@ DEFINE DTC_BIN =3D ENV(DTC_PREFIX)dtc # Intel(r) ACPI Compiler (iasl.exe) from # https://acpica.org/downloads # VS2017 -win32- Requires: -# Microsoft Visual Studio 2017 Community Editi= on +# Microsoft Visual Studio 2017 Community Editi= on (with Update 4 for ARM64 support) # Intel(r) ACPI Compiler (iasl.exe) from https= ://acpica.org/downloads # Unsupported: # Building of EBC drivers @@ -4199,6 +4200,35 @@ NOOPT_VS2017_ARM_ASM_FLAGS =3D /nologo RELEASE_VS2017_ARM_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D= /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SE= RVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data NOOPT_VS2017_ARM_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 /= OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM= /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER = /SAFESEH:NO /BASE:0 /DRIVER /DEBUG =20 +##################### +# AARCH64 definitions +##################### +*_VS2017_AARCH64_*_DLL =3D DEF(VS2017_BIN_AARCH64) + +*_VS2017_AARCH64_CC_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_VFRPP_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_SLINK_PATH =3D DEF(VS2017_BIN_AARCH64)\lib.exe +*_VS2017_AARCH64_DLINK_PATH =3D DEF(VS2017_BIN_AARCH64)\link.exe +*_VS2017_AARCH64_APP_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_PP_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_ASM_PATH =3D DEF(VS2017_BIN_AARCH64)\armasm64.exe +*_VS2017_AARCH64_ASLCC_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_ASLPP_PATH =3D DEF(VS2017_BIN_AARCH64)\cl.exe +*_VS2017_AARCH64_ASLDLINK_PATH =3D DEF(VS2017_BIN_AARCH64)\link.exe + + *_VS2017_AARCH64_MAKE_FLAGS =3D /nologo + DEBUG_VS2017_AARCH64_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy= /Zi /Gm /Gw /Oi- +RELEASE_VS2017_AARCH64_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw= /Oi- +NOOPT_VS2017_AARCH64_CC_FLAGS =3D /nologo /c /WX /wd4100 /wd4127 /wd42= 14 /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /= Od /Oi- + + DEBUG_VS2017_AARCH64_ASM_FLAGS =3D /nologo /g +RELEASE_VS2017_AARCH64_ASM_FLAGS =3D /nologo +NOOPT_VS2017_AARCH64_ASM_FLAGS =3D /nologo + + DEBUG_VS2017_AARCH64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 = /OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:AR= M64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIV= ER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG +RELEASE_VS2017_AARCH64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 = /IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,= D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT= _SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=3D.data +NOOPT_VS2017_AARCH64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001 = /OPT:REF /OPT:ICF=3D10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:AR= M64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIV= ER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG + ##########################################################################= ########## # # Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Ti= me Code Generation) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 3bf8ede016de..e53ebd4ecb85 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -631,7 +631,7 @@ struct _LIST_ENTRY { =20 #define VA_COPY(Dest, Start) __va_copy (Dest, Start) =20 -#elif defined(_M_ARM) +#elif defined(_M_ARM) || defined(_M_ARM64) // // MSFT ARM variable argument list support. // diff --git a/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm b/MdePkg/Libr= ary/BaseLib/AArch64/CpuBreakpoint.asm new file mode 100644 index 000000000000..17e993f5b77e --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm @@ -0,0 +1,39 @@ +;-------------------------------------------------------------------------= ----- +; +; CpuBreakpoint() for AArch64 +; +; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + + EXPORT CpuBreakpoint + AREA BaseLib_LowLevel, CODE, READONLY + +;/** +; Generates a breakpoint on the CPU. +; +; Generates a breakpoint on the CPU. The breakpoint must be implemented s= uch +; that code can resume normal execution after the breakpoint. +; +;**/ +;VOID +;EFIAPI +;CpuBreakpoint ( +; VOID +; ); +; +CpuBreakpoint + svc 0xdbdb // Superviser exception. Takes 16bit arg -> Armv7 had = 'swi' here. + ret + + END diff --git a/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm b/MdePkg/= Library/BaseLib/AArch64/DisableInterrupts.asm new file mode 100644 index 000000000000..498493454c7d --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm @@ -0,0 +1,37 @@ +;-------------------------------------------------------------------------= ----- +; +; DisableInterrupts() for AArch64 +; +; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + EXPORT DisableInterrupts + AREA BaseLib_LowLevel, CODE, READONLY + +DAIF_WR_IRQ_BIT EQU (1 << 1) + +;/** +; Disables CPU interrupts. +; +;**/ +;VOID +;EFIAPI +;DisableInterrupts ( +; VOID +; ); +; +DisableInterrupts + msr daifset, #DAIF_WR_IRQ_BIT + ret + + END diff --git a/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm b/MdePkg/L= ibrary/BaseLib/AArch64/EnableInterrupts.asm new file mode 100644 index 000000000000..ec3d6e45ff8a --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm @@ -0,0 +1,37 @@ +;-------------------------------------------------------------------------= ----- +; +; EnableInterrupts() for AArch64 +; +; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + EXPORT EnableInterrupts + AREA BaseLib_LowLevel, CODE, READONLY + +DAIF_WR_IRQ_BIT EQU (1 << 1) + +;/** +; Enables CPU interrupts. +; +;**/ +;VOID +;EFIAPI +;EnableInterrupts ( +; VOID +; ); +; +EnableInterrupts + msr daifclr, #DAIF_WR_IRQ_BIT + ret + + END diff --git a/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm b/MdePkg= /Library/BaseLib/AArch64/GetInterruptsState.asm new file mode 100644 index 000000000000..d64b0d513ce3 --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm @@ -0,0 +1,49 @@ +;-------------------------------------------------------------------------= ----- +; +; GetInterruptState() function for AArch64 +; +; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + EXPORT GetInterruptState + AREA BaseLib_LowLevel, CODE, READONLY + +DAIF_RD_IRQ_BIT EQU (1 << 7) + +;/** +; Retrieves the current CPU interrupt state. +; +; Returns TRUE is interrupts are currently enabled. Otherwise +; returns FALSE. +; +; @retval TRUE CPU interrupts are enabled. +; @retval FALSE CPU interrupts are disabled. +; +;**/ +; +;BOOLEAN +;EFIAPI +;GetInterruptState ( +; VOID +; ); +; +GetInterruptState + mrs x0, daif + mov w0, wzr + tst x0, #DAIF_RD_IRQ_BIT // Check IRQ mask; set Z=3D1 if clear/un= masked + bne exit // if Z=3D1 (eq) return 1, else 0 + mov w0, #1 +exit + ret + + END diff --git a/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm b/MdePkg/Librar= y/BaseLib/AArch64/MemoryFence.asm new file mode 100644 index 000000000000..84dede698ee0 --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm @@ -0,0 +1,38 @@ +;-------------------------------------------------------------------------= ----- +; +; MemoryFence() for AArch64 +; +; Copyright (c) 2013, ARM Ltd. All rights reserved. +; +; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + EXPORT MemoryFence + AREA BaseLib_LowLevel, CODE, READONLY + +;/** +; Used to serialize load and store operations. +; +; All loads and stores that proceed calls to this function are guaranteed= to be +; globally visible when this function returns. +; +;**/ +;VOID +;EFIAPI +;MemoryFence ( +; VOID +; ); +; +MemoryFence + // System wide Data Memory Barrier. + dmb sy + ret + + END diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Li= brary/BaseLib/AArch64/SetJumpLongJump.asm new file mode 100644 index 000000000000..e0a9715ff2d1 --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm @@ -0,0 +1,101 @@ +;-------------------------------------------------------------------------= ----- +; +; Copyright (c) 2009-2013, ARM Ltd. All rights reserved. +; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e found at +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +; +;-------------------------------------------------------------------------= ----- + + EXPORT SetJump + EXPORT InternalLongJump + AREA BaseLib_LowLevel, CODE, READONLY + +#define GPR_LAYOUT \ + REG_PAIR (x19, x20, #0); \ + REG_PAIR (x21, x22, #16); \ + REG_PAIR (x23, x24, #32); \ + REG_PAIR (x25, x26, #48); \ + REG_PAIR (x27, x28, #64); \ + REG_PAIR (x29, x30, #80);/*FP, LR*/ \ + REG_ONE (x16, #96) /*IP0*/ + +#define FPR_LAYOUT \ + REG_PAIR ( d8, d9, #112); \ + REG_PAIR (d10, d11, #128); \ + REG_PAIR (d12, d13, #144); \ + REG_PAIR (d14, d15, #160); + +;/** +; Saves the current CPU context that can be restored with a call to LongJ= ump() and returns 0.# +; +; Saves the current CPU context in the buffer specified by JumpBuffer and= returns 0. The initial +; call to SetJump() must always return 0. Subsequent calls to LongJump()= cause a non-zero +; value to be returned by SetJump(). +; +; If JumpBuffer is NULL, then ASSERT(). +; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then = ASSERT(). +; +; @param JumpBuffer A pointer to CPU context buffer. +; +;**/ +; +;UINTN +;EFIAPI +;SetJump ( +; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // X0 +; ); +; +SetJump + mov x16, sp // use IP0 so save SP +#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] +#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] + GPR_LAYOUT + FPR_LAYOUT +#undef REG_PAIR +#undef REG_ONE + mov w0, #0 + ret + +;/** +; Restores the CPU context that was saved with SetJump().# +; +; Restores the CPU context from the buffer specified by JumpBuffer. +; This function never returns to the caller. +; Instead is resumes execution based on the state of JumpBuffer. +; +; @param JumpBuffer A pointer to CPU context buffer. +; @param Value The value to return when the SetJump() context is= restored. +; +;**/ +;VOID +;EFIAPI +;InternalLongJump ( +; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // X0 +; IN UINTN Value // X1 +; ); +; +InternalLongJump +#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] +#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] + GPR_LAYOUT + FPR_LAYOUT +#undef REG_PAIR +#undef REG_ONE + mov sp, x16 + cmp w1, #0 + mov w0, #1 + beq exit + mov w0, w1 +exit + // use br not ret, as ret is guaranteed to mispredict + br x30 + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED + + END + diff --git a/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm b/MdePkg/Librar= y/BaseLib/AArch64/SwitchStack.asm new file mode 100644 index 000000000000..c1b2de07e205 --- /dev/null +++ b/MdePkg/Library/BaseLib/AArch64/SwitchStack.asm @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------= ------ +// +// Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+// Portions copyright (c) 2011 - 2013, ARM Limited. All rights reserved. +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the B= SD License +// which accompanies this distribution. The full text of the license may = be found at +// http://opensource.org/licenses/bsd-license.php. +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +// +//------------------------------------------------------------------------= ------ + + EXPORT InternalSwitchStackAsm + EXPORT CpuPause + AREA BaseLib_LowLevel, CODE, READONLY + +/** +// +// This allows the caller to switch the stack and goes to the new entry p= oint +// +// @param EntryPoint The pointer to the location to enter +// @param Context Parameter to pass in +// @param Context2 Parameter2 to pass in +// @param NewStack New Location of the stack +// +// @return Nothing. Goes to the Entry Point passing in the new paramet= ers +// +VOID +EFIAPI +InternalSwitchStackAsm ( + SWITCH_STACK_ENTRY_POINT EntryPoint, + VOID *Context, + VOID *Context2, + VOID *NewStack + ); +**/ +InternalSwitchStackAsm + mov x29, #0 + mov x30, x0 + mov sp, x3 + mov x0, x1 + mov x1, x2 + ret + +/** +// +// Requests CPU to pause for a short period of time. +// +// Requests CPU to pause for a short period of time. Typically used in MP +// systems to prevent memory starvation while waiting for a spin lock. +// +VOID +EFIAPI +CpuPause ( + VOID + ) +**/ +CpuPause + nop + nop + nop + nop + nop + ret + + END diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/Ba= seLib.inf index 4337a125d516..e4abbbfe928f 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -864,6 +864,14 @@ [Sources.AARCH64] AArch64/SetJumpLongJump.S | GCC AArch64/CpuBreakpoint.S | GCC =20 + AArch64/MemoryFence.asm | MSFT + AArch64/SwitchStack.asm | MSFT + AArch64/EnableInterrupts.asm | MSFT + AArch64/DisableInterrupts.asm | MSFT + AArch64/GetInterruptsState.asm | MSFT + AArch64/SetJumpLongJump.asm | MSFT + AArch64/CpuBreakpoint.asm | MSFT + [Packages] MdePkg/MdePkg.dec =20 --=20 2.14.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel