* [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
@ 2017-11-14 12:32 Pete Batard
2017-11-14 12:32 ` [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings Pete Batard
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 12:32 UTC (permalink / raw)
To: edk2-devel
Seeing that Visual Studio Update 4 finally added native ARM64 compilation
support and this is an open task:
https://github.com/tianocore/tianocore.github.io/wiki/Tasks
This series is broken down into:
- A preliminary patch, to eliminate new warnings that would be produced for
VS2017/IA32
- IA32 + X64 support
- ARM support
- AARCH64 support
Notes:
- Considering that the multiplication of toolchain flavours is probably not in
our best interest when it comes to maintenance, I deliberately chose not to
create extra VS2017 variants (for x64, ASL and EBC). For one thing, I had
some issues with the x64 tools for ARM compilation (which may very well have
been my own), and I'd rather see the variants being added after their need
has been justified by their potential users, rather than preemptively.
- ARM and ARM64 should be considered EXPERIMENTAL at this stage.
I've had some good success compiling and running moderately complex drivers
(e.g. ZFS file system driver) using the proposed patches on ARM/ARM64, and I
am also confident that simple applications should be fine, but more work is
required to produce QEMU ARM/AARCH64 firmware images, mostly due to missing
.asm files. Since most of the RVCT .asm files can be reused mostly unchanged
for MSFT, I was able to cajole the ARM process to go up to the QEMU image
generation (which failed due to some alignment issue), which gives me some
confidence that we should eventually be able to use the MSFT toolchain to
produce working images for ARM and ARM64, but this will require some work.
- While the VS2017 version of IA32 and X64 do not silence any level 4 warnings
by default, to bring them to par with VS2015, the ARM and ARM64 versions
have to silence 3 of them, as VS is a bit less leniant than gcc/Clang.
Again, it should be possible to remove the silencing of these warnings
eventually, but this will require some work.
- Finally, you'll see that a whole section of build_rule.template had to be
duplicated just so that we could remove the --convert-hex option for the
MSFT ARM/ARM64 assemblers. Maybe there is a better way to achieve the
removal of that option, but I haven't found it.
Regards,
/Pete
Pete Batard (4):
MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings
BaseTools: Add VS2017 IA32 and X64 support
BaseTools: Add VS2017 ARM support
BaseTools: Add VS2017 AARCH64 support
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 | 168 +++++++++++++
BaseTools/set_vsprefix_envs.bat | 9 +
MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c | 2 +-
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c | 2 +-
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 2 +-
MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c | 2 +-
MdePkg/Include/Base.h | 15 ++
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/Arm/CpuBreakpoint.asm | 5 +-
MdePkg/Library/BaseLib/BaseLib.inf | 27 ++-
MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf | 5 +-
MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c | 18 ++
NetworkPkg/HttpBootDxe/HttpBootImpl.c | 2 +-
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 +-
Nt32Pkg/Sec/SecMain.inf | 2 +
27 files changed, 1019 insertions(+), 14 deletions(-)
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
create mode 100644 MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/MemoryFence.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/SwitchStack.asm
create mode 100644 MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
--
2.14.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
@ 2017-11-14 12:32 ` Pete Batard
2017-11-14 12:32 ` [PATCH 2/4] BaseTools: Add VS2017 IA32 and X64 support Pete Batard
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 12:32 UTC (permalink / raw)
To: edk2-devel
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 <pete@akeo.ie>
---
MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c | 2 +-
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.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 = NULL;
UINTN BufferSize;
UINT8 *Ptr;
UINTN TempSize;
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
index 6dd4fce13938..4ddfb0926dc2 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
@@ -308,7 +308,7 @@ IsRequiredDriver (
EFI_STATUS Status;
UINT8 ClassGuidNum;
EFI_GUID *ClassGuid;
- EFI_IFR_FORM_SET *Buffer;
+ EFI_IFR_FORM_SET *Buffer = NULL;
UINTN BufferSize;
UINT8 *Ptr;
UINTN TempSize;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/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 = 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 = NULL;
UINT32 PktLen;
EFI_TPL OldTpl;
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 = NULL;
if (Private == NULL || FilePath == NULL) {
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/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 = NULL;
CHAR8 *FilePost;
if (Uri == NULL || UriParser == NULL || ImageType == NULL) {
--
2.14.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] BaseTools: Add VS2017 IA32 and X64 support
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
2017-11-14 12:32 ` [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings Pete Batard
@ 2017-11-14 12:32 ` Pete Batard
2017-11-14 12:32 ` [PATCH 3/4] BaseTools: Add VS2017 ARM support Pete Batard
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 12:32 UTC (permalink / raw)
To: edk2-devel
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 <pete@akeo.ie>
---
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.template
index aebd7d558633..0346750886a2 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -74,6 +74,10 @@ DEFINE VS2015x86_BIN = ENV(VS2015_PREFIX)Vc\bin
DEFINE VS2015x86_DLL = ENV(VS2015_PREFIX)Common7\IDE;DEF(VS2015x86_BIN)
DEFINE VS2015x86_BINX64 = DEF(VS2015x86_BIN)\x86_amd64
+DEFINE VS2017_BIN = ENV(VS2017_PREFIX)bin\Hostx86
+DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\x86
+DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\x64
+
DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
@@ -93,6 +97,9 @@ DEFINE WINSDK8x86_BIN = ENV(WINSDK8x86_PREFIX)x64
DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x86\
DEFINE WINSDK81x86_BIN = ENV(WINSDK81x86_PREFIX)x64
+# Microsoft Visual Studio 2017 Community Edition
+DEFINE WINSDK10_BIN = 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 = 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 Edition
+# Intel(r) ACPI Compiler (iasl.exe) from https://acpica.org/downloads
+# Unsupported:
+# Building of EBC drivers
# DDK3790 -win32- Requires:
# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
# Optional:
@@ -4060,6 +4072,102 @@ NOOPT_VS2015x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT
*_VS2015x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2015x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+####################################################################################
+#
+# 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 = MSFT
+
+*_VS2017_*_MAKE_PATH = DEF(VS2017_BIN_IA32)\nmake.exe
+*_VS2017_*_MAKE_FLAGS = /nologo
+*_VS2017_*_RC_PATH = DEF(WINSDK10_BIN)\rc.exe
+
+*_VS2017_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2017_*_APP_FLAGS = /nologo /E /TC
+*_VS2017_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2017_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2017_*_DLINK2_FLAGS =
+
+*_VS2017_*_ASM16_PATH = EF(VS2017_BIN_IA32)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2017_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2017_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2017_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2017_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2017_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2017_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2017_IA32_*_DLL = DEF(VS2017_BIN_IA32)
+
+*_VS2017_IA32_CC_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_VFRPP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_SLINK_PATH = DEF(VS2017_BIN_IA32)\lib.exe
+*_VS2017_IA32_DLINK_PATH = DEF(VS2017_BIN_IA32)\link.exe
+*_VS2017_IA32_APP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_PP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASM_PATH = DEF(VS2017_BIN_IA32)\ml.exe
+*_VS2017_IA32_ASLCC_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASLPP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASLDLINK_PATH = DEF(VS2017_BIN_IA32)\link.exe
+
+ *_VS2017_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_IA32_CC_FLAGS = /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 = /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 = /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 = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2017_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2017_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2017_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2017_X64_*_DLL = DEF(VS2017_BIN_X64)
+
+*_VS2017_X64_CC_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_PP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_APP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_VFRPP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASM_PATH = DEF(VS2017_BIN_X64)\ml64.exe
+*_VS2017_X64_SLINK_PATH = DEF(VS2017_BIN_X64)\lib.exe
+*_VS2017_X64_DLINK_PATH = DEF(VS2017_BIN_X64)\link.exe
+*_VS2017_X64_ASLCC_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASLPP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASLDLINK_PATH = DEF(VS2017_BIN_X64)\link.exe
+
+ DEBUG_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Gw /Oi-
+RELEASE_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Od /Oi-
+
+ DEBUG_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2017_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2017_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 /DEBUG
+RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /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=.data
+NOOPT_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 /DEBUG
####################################################################################
#
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 (
)
)
+if defined VS150COMNTOOLS (
+ if not defined VS2017_PREFIX (
+ set "VS2017_PREFIX=%VCToolsInstallDir%"
+ )
+ if not defined WINSDK10_PREFIX (
+ set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
+ )
+)
+
if not defined WINDDK3790_PREFIX (
set WINDDK3790_PREFIX=C:\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 == /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\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
MSFT:*_VS2015_IA32_DLINK_FLAGS == /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\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /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 == /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\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2017_IA32_DLINK_FLAGS == /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\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
MSFT:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
MSFT:*_*_IA32_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
MSFT:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
@@ -79,6 +80,7 @@ [BuildOptions]
MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /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 == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2017_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
MSFT:*_*_X64_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
MSFT:*_*_X64_ASM_FLAGS == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
--
2.14.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] BaseTools: Add VS2017 ARM support
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
2017-11-14 12:32 ` [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings Pete Batard
2017-11-14 12:32 ` [PATCH 2/4] BaseTools: Add VS2017 IA32 and X64 support Pete Batard
@ 2017-11-14 12:32 ` Pete Batard
2017-11-14 12:32 ` [PATCH 4/4] BaseTools: Add VS2017 AARCH64 support Pete Batard
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 12:32 UTC (permalink / raw)
To: edk2-devel
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 <pete@akeo.ie>
---
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/Library/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.<BR>
+// Based on generated assembly of ReactOS' sdk/lib/crt/math/arm/__rt_###div.c,
+// Copyright (c) Timo Kreuzer. All rights reserved.<BR>
+//
+// 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.
+//
+//**/
+
+ 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, uint64_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/Library/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.<BR>
+//
+// 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.
+//
+//**/
+
+ 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 = CompilerIntrinsicsLib
[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
[Sources.ARM]
Arm/mullu.asm | RVCT
@@ -94,6 +98,8 @@ [Sources.ARM]
Arm/llsr.S | GCC
Arm/llsl.S | GCC
+ Arm/rtdiv.asm | MSFT
+ Arm/rtsrsh.asm | MSFT
[Packages]
MdePkg/MdePkg.dec
@@ -101,3 +107,6 @@ [Packages]
[LibraryClasses]
+[BuildOptions]
+ MSFT:*_*_ARM_CC_FLAGS = /GL-
+ MSFT:*_*_AARCH64_CC_FLAGS = /GL-
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/ArmPkg/Library/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.<BR>
+//
+// 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 <stddef.h> // 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 = dest;
+ unsigned char const *s = src;
+
+ while (n--)
+ *d++ = *s++;
+
+ return dest;
+}
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/ArmPkg/Library/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.<BR>
+//
+// 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 <stddef.h> // 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 = s;
+
+ while (n--)
+ *d++ = (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 issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
+[Assembly-Code-File.COMMON.ARM]
+ # Remove --convert-hex for ARM as it breaks MSFT assemblers
+ <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
+ ?.asm, ?.Asm, ?.ASM
+
+ <InputFile.GCC, InputFile.GCCLD>
+ ?.S, ?.s
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command.INTEL>
+ "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+ Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
+ "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
+
+ <Command.MSFT>
+ "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+ Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
+ "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
+
+ <Command.GCC, Command.GCCLD, Command.RVCT>
+ "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+ Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
+ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
+ "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
+
[Nasm-Assembly-Code-File.COMMON.COMMON]
<InputFile>
?.nasm
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 0346750886a2..4bc057f1a568 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -77,6 +77,7 @@ DEFINE VS2015x86_BINX64 = DEF(VS2015x86_BIN)\x86_amd64
DEFINE VS2017_BIN = ENV(VS2017_PREFIX)bin\Hostx86
DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\x86
DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\x64
+DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\arm
DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
@@ -4169,6 +4170,35 @@ NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /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=.data
NOOPT_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 /DEBUG
+#################
+# ARM definitions
+#################
+*_VS2017_ARM_*_DLL = DEF(VS2017_BIN_ARM)
+
+*_VS2017_ARM_CC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_VFRPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_SLINK_PATH = DEF(VS2017_BIN_ARM)\lib.exe
+*_VS2017_ARM_DLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
+*_VS2017_ARM_APP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_PP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASM_PATH = DEF(VS2017_BIN_ARM)\armasm.exe
+*_VS2017_ARM_ASLCC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLDLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
+
+ *_VS2017_ARM_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_ARM_CC_FLAGS = /nologo /c /WX /wd4100 /wd4127 /wd4214 /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 = /nologo /c /WX /wd4100 /wd4127 /wd4214 /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 = /nologo /c /WX /wd4100 /wd4127 /wd4214 /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 = /nologo /g
+RELEASE_VS2017_ARM_ASM_FLAGS = /nologo
+NOOPT_VS2017_ARM_ASM_FLAGS = /nologo
+
+ DEBUG_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /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 /MERGE:.rdata=.data
+NOOPT_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 Time 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 {
#define VA_COPY(Dest, Start) __va_copy (Dest, Start)
+#elif defined(_M_ARM)
+//
+// MSFT ARM variable argument list support.
+//
+
+// Standard Visual Studio header
+#include <stdarg.h>
+
+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__)
#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 @@
EXPORT CpuBreakpoint
- AREA Cpu_Breakpoint, CODE, READONLY
+; Force ARM mode for this section, as MSFT assembler defaults to THUMB
+ AREA Cpu_Breakpoint, CODE, READONLY, ARM
+
+ ARM
;/**
; Generates a breakpoint on the CPU.
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.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
-
+ 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
-
+
+ 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]
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES
+
+[BuildOptions]
+ MSFT:*_*_ARM_CC_FLAGS = /GL-
diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf b/MdePkg/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]
#
[Sources]
- BaseStackCheckGcc.c | GCC
- BaseStackCheckGcc.c | RVCT
+ BaseStackCheckGcc.c | GCC
+ BaseStackCheckGcc.c | RVCT
+ BaseStackCheckNull.c | MSFT
[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.<BR>
+ 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.
+
+Abstract:
+
+ This file is purely empty as a work around for BaseStackCheck to pass MSVC build.
+
+**/
+
+extern int __BaseStackCheckNull;
--
2.14.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] BaseTools: Add VS2017 AARCH64 support
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
` (2 preceding siblings ...)
2017-11-14 12:32 ` [PATCH 3/4] BaseTools: Add VS2017 ARM support Pete Batard
@ 2017-11-14 12:32 ` Pete Batard
2017-11-14 16:03 ` [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Gao, Liming
2017-11-14 16:16 ` Kurt Kennett
5 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 12:32 UTC (permalink / raw)
To: edk2-devel
Requires the silencing of the same warnings as ARM.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Pete Batard <pete@akeo.ie>
---
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 issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
-[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
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 4bc057f1a568..9c81a06822e9 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -78,6 +78,7 @@ DEFINE VS2017_BIN = ENV(VS2017_PREFIX)bin\Hostx86
DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\x86
DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\x64
DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\arm
+DEFINE VS2017_BIN_AARCH64 = DEF(VS2017_BIN)\arm64
DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
@@ -327,7 +328,7 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Intel(r) ACPI Compiler (iasl.exe) from
# https://acpica.org/downloads
# VS2017 -win32- Requires:
-# Microsoft Visual Studio 2017 Community Edition
+# Microsoft Visual Studio 2017 Community Edition (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 = /nologo
RELEASE_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /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 /MERGE:.rdata=.data
NOOPT_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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
+#####################
+# AARCH64 definitions
+#####################
+*_VS2017_AARCH64_*_DLL = DEF(VS2017_BIN_AARCH64)
+
+*_VS2017_AARCH64_CC_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_VFRPP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_SLINK_PATH = DEF(VS2017_BIN_AARCH64)\lib.exe
+*_VS2017_AARCH64_DLINK_PATH = DEF(VS2017_BIN_AARCH64)\link.exe
+*_VS2017_AARCH64_APP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_PP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASM_PATH = DEF(VS2017_BIN_AARCH64)\armasm64.exe
+*_VS2017_AARCH64_ASLCC_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASLPP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASLDLINK_PATH = DEF(VS2017_BIN_AARCH64)\link.exe
+
+ *_VS2017_AARCH64_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /wd4100 /wd4127 /wd4214 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Gw /Oi-
+RELEASE_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /wd4100 /wd4127 /wd4214 /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /wd4100 /wd4127 /wd4214 /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od /Oi-
+
+ DEBUG_VS2017_AARCH64_ASM_FLAGS = /nologo /g
+RELEASE_VS2017_AARCH64_ASM_FLAGS = /nologo
+NOOPT_VS2017_AARCH64_ASM_FLAGS = /nologo
+
+ DEBUG_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 /DEBUG
+RELEASE_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /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=.data
+NOOPT_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /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 /DEBUG
+
####################################################################################
#
# Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Time 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 {
#define VA_COPY(Dest, Start) __va_copy (Dest, Start)
-#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/Library/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.<BR>
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+; 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.
+;
+;------------------------------------------------------------------------------
+
+
+ EXPORT CpuBreakpoint
+ AREA BaseLib_LowLevel, CODE, READONLY
+
+;/**
+; Generates a breakpoint on the CPU.
+;
+; Generates a breakpoint on the CPU. The breakpoint must be implemented such
+; 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.<BR>
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+; 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.
+;
+;------------------------------------------------------------------------------
+
+ 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/Library/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.<BR>
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+; 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.
+;
+;------------------------------------------------------------------------------
+
+ 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.<BR>
+; Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+; Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+; 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.
+;
+;------------------------------------------------------------------------------
+
+ 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=1 if clear/unmasked
+ bne exit // if Z=1 (eq) return 1, else 0
+ mov w0, #1
+exit
+ ret
+
+ END
diff --git a/MdePkg/Library/BaseLib/AArch64/MemoryFence.asm b/MdePkg/Library/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 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.
+;
+;------------------------------------------------------------------------------
+
+ 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/Library/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 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.
+;
+;------------------------------------------------------------------------------
+
+ 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 LongJump() 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/Library/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.<BR>
+// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+// Portions copyright (c) 2011 - 2013, ARM Limited. All rights reserved.<BR>
+// 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.
+//
+//------------------------------------------------------------------------------
+
+ EXPORT InternalSwitchStackAsm
+ EXPORT CpuPause
+ AREA BaseLib_LowLevel, CODE, READONLY
+
+/**
+//
+// This allows the caller to switch the stack and goes to the new entry point
+//
+// @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 parameters
+//
+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/BaseLib.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
+ 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
--
2.14.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
` (3 preceding siblings ...)
2017-11-14 12:32 ` [PATCH 4/4] BaseTools: Add VS2017 AARCH64 support Pete Batard
@ 2017-11-14 16:03 ` Gao, Liming
2017-11-14 17:07 ` Pete Batard
2017-11-14 16:16 ` Kurt Kennett
5 siblings, 1 reply; 9+ messages in thread
From: Gao, Liming @ 2017-11-14 16:03 UTC (permalink / raw)
To: Pete Batard, edk2-devel@lists.01.org
Pete:
Thanks for your contribution. In fact, I have sent one patch serial to add VS2017 tool chain for IA32 and X64. https://lists.01.org/pipermail/edk2-devel/2017-October/016175.html
In my patch, I disable warning 4701&4703, because they are also disabled in VS2015. In tools_def.template, to align other VS tool chain, I use VS2017_BIN for 32bit, VS2017_BINX64 for 64bit. Could you follow this rule to define VS2017_BINARM for arm, VS2017_BINAARCH64 for AARCH64? On VS2017, I notice it doesn't set VS150COMNTOOLS env by default. So, I use vswhere.exe to detect VS2017 installation path. When we build source code with VS tool chain, we open normal cmd instead of VS cmd. So, we need to consider the case without VS env. In your patch on ARM support, <stdarg.h> is included in Base.h. This is a windows header file. So, VS env must be setup to build source code with ARM arch. Right?
Last, I suggest you base on my patch to add VS2017 ARM and AARCH64 arch. I will still work on VS2017 IA32 and X64. For your patches, I suggest you separate them per package. For example, to add ARM arch, you can create one patch in BaseTools, one patch in MdePkg, another one is ArmPkg.
Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Pete Batard
> Sent: Tuesday, November 14, 2017 8:32 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
>
> Seeing that Visual Studio Update 4 finally added native ARM64 compilation
> support and this is an open task:
> https://github.com/tianocore/tianocore.github.io/wiki/Tasks
>
> This series is broken down into:
> - A preliminary patch, to eliminate new warnings that would be produced for
> VS2017/IA32
> - IA32 + X64 support
> - ARM support
> - AARCH64 support
>
> Notes:
> - Considering that the multiplication of toolchain flavours is probably not in
> our best interest when it comes to maintenance, I deliberately chose not to
> create extra VS2017 variants (for x64, ASL and EBC). For one thing, I had
> some issues with the x64 tools for ARM compilation (which may very well have
> been my own), and I'd rather see the variants being added after their need
> has been justified by their potential users, rather than preemptively.
> - ARM and ARM64 should be considered EXPERIMENTAL at this stage.
> I've had some good success compiling and running moderately complex drivers
> (e.g. ZFS file system driver) using the proposed patches on ARM/ARM64, and I
> am also confident that simple applications should be fine, but more work is
> required to produce QEMU ARM/AARCH64 firmware images, mostly due to missing
> .asm files. Since most of the RVCT .asm files can be reused mostly unchanged
> for MSFT, I was able to cajole the ARM process to go up to the QEMU image
> generation (which failed due to some alignment issue), which gives me some
> confidence that we should eventually be able to use the MSFT toolchain to
> produce working images for ARM and ARM64, but this will require some work.
> - While the VS2017 version of IA32 and X64 do not silence any level 4 warnings
> by default, to bring them to par with VS2015, the ARM and ARM64 versions
> have to silence 3 of them, as VS is a bit less leniant than gcc/Clang.
> Again, it should be possible to remove the silencing of these warnings
> eventually, but this will require some work.
> - Finally, you'll see that a whole section of build_rule.template had to be
> duplicated just so that we could remove the --convert-hex option for the
> MSFT ARM/ARM64 assemblers. Maybe there is a better way to achieve the
> removal of that option, but I haven't found it.
>
> Regards,
>
> /Pete
>
> Pete Batard (4):
> MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings
> BaseTools: Add VS2017 IA32 and X64 support
> BaseTools: Add VS2017 ARM support
> BaseTools: Add VS2017 AARCH64 support
>
> 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 | 168 +++++++++++++
> BaseTools/set_vsprefix_envs.bat | 9 +
> MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c | 2 +-
> MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c | 2 +-
> MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 2 +-
> MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c | 2 +-
> MdePkg/Include/Base.h | 15 ++
> 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/Arm/CpuBreakpoint.asm | 5 +-
> MdePkg/Library/BaseLib/BaseLib.inf | 27 ++-
> MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf | 5 +-
> MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c | 18 ++
> NetworkPkg/HttpBootDxe/HttpBootImpl.c | 2 +-
> NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 +-
> Nt32Pkg/Sec/SecMain.inf | 2 +
> 27 files changed, 1019 insertions(+), 14 deletions(-)
> create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm
> create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm
> create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
> create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
> create mode 100644 MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/MemoryFence.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
> create mode 100644 MdePkg/Library/BaseLib/AArch64/SwitchStack.asm
> create mode 100644 MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
>
> --
> 2.14.2
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
` (4 preceding siblings ...)
2017-11-14 16:03 ` [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Gao, Liming
@ 2017-11-14 16:16 ` Kurt Kennett
2017-11-14 17:30 ` Pete Batard
5 siblings, 1 reply; 9+ messages in thread
From: Kurt Kennett @ 2017-11-14 16:16 UTC (permalink / raw)
To: Pete Batard, edk2-devel@lists.01.org
Does this build and boot a platform?
This should not be committed until a platform is building and booting to UEFI shell, IMO.
K2
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Pete Batard
Sent: Tuesday, November 14, 2017 4:32 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
Seeing that Visual Studio Update 4 finally added native ARM64 compilation support and this is an open task:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Ftianocore.github.io%2Fwiki%2FTasks&data=02%7C01%7Ckurt.kennett%40microsoft.com%7C0062ea8181264455563b08d52b5bd042%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636462595702607346&sdata=L4JTYL92%2FYzobAaoY5GiTevCKF2f3KhByhmJHFCeVc4%3D&reserved=0
This series is broken down into:
- A preliminary patch, to eliminate new warnings that would be produced for
VS2017/IA32
- IA32 + X64 support
- ARM support
- AARCH64 support
Notes:
- Considering that the multiplication of toolchain flavours is probably not in
our best interest when it comes to maintenance, I deliberately chose not to
create extra VS2017 variants (for x64, ASL and EBC). For one thing, I had
some issues with the x64 tools for ARM compilation (which may very well have
been my own), and I'd rather see the variants being added after their need
has been justified by their potential users, rather than preemptively.
- ARM and ARM64 should be considered EXPERIMENTAL at this stage.
I've had some good success compiling and running moderately complex drivers
(e.g. ZFS file system driver) using the proposed patches on ARM/ARM64, and I
am also confident that simple applications should be fine, but more work is
required to produce QEMU ARM/AARCH64 firmware images, mostly due to missing
.asm files. Since most of the RVCT .asm files can be reused mostly unchanged
for MSFT, I was able to cajole the ARM process to go up to the QEMU image
generation (which failed due to some alignment issue), which gives me some
confidence that we should eventually be able to use the MSFT toolchain to
produce working images for ARM and ARM64, but this will require some work.
- While the VS2017 version of IA32 and X64 do not silence any level 4 warnings
by default, to bring them to par with VS2015, the ARM and ARM64 versions
have to silence 3 of them, as VS is a bit less leniant than gcc/Clang.
Again, it should be possible to remove the silencing of these warnings
eventually, but this will require some work.
- Finally, you'll see that a whole section of build_rule.template had to be
duplicated just so that we could remove the --convert-hex option for the
MSFT ARM/ARM64 assemblers. Maybe there is a better way to achieve the
removal of that option, but I haven't found it.
Regards,
/Pete
Pete Batard (4):
MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings
BaseTools: Add VS2017 IA32 and X64 support
BaseTools: Add VS2017 ARM support
BaseTools: Add VS2017 AARCH64 support
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 | 168 +++++++++++++
BaseTools/set_vsprefix_envs.bat | 9 +
MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c | 2 +-
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c | 2 +-
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 2 +-
MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c | 2 +-
MdePkg/Include/Base.h | 15 ++
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/Arm/CpuBreakpoint.asm | 5 +-
MdePkg/Library/BaseLib/BaseLib.inf | 27 ++-
MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf | 5 +-
MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c | 18 ++
NetworkPkg/HttpBootDxe/HttpBootImpl.c | 2 +-
NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 +-
Nt32Pkg/Sec/SecMain.inf | 2 +
27 files changed, 1019 insertions(+), 14 deletions(-) create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtdiv.asm
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/Arm/rtsrsh.asm
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
create mode 100644 ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
create mode 100644 MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/DisableInterrupts.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/EnableInterrupts.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/GetInterruptsState.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/MemoryFence.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm
create mode 100644 MdePkg/Library/BaseLib/AArch64/SwitchStack.asm
create mode 100644 MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c
--
2.14.2
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fedk2-devel&data=02%7C01%7Ckurt.kennett%40microsoft.com%7C0062ea8181264455563b08d52b5bd042%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636462595702607346&sdata=bQcyjBCjCRoXCWXiEcTKhFoKPaOvzlGxRozfwXYA35U%3D&reserved=0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
2017-11-14 16:03 ` [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Gao, Liming
@ 2017-11-14 17:07 ` Pete Batard
0 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 17:07 UTC (permalink / raw)
To: Gao, Liming, edk2-devel@lists.01.org
Hi Liming,
On 2017.11.14 16:03, Gao, Liming wrote:
> In fact, I have sent one patch serial to add VS2017 tool chain for
> IA32 and X64. https://lists.01.org/pipermail/edk2-devel/2017-October/016175.html
I missed that proposal, else I would have used it as my base. Thanks for
pointing it out.
> In my patch, I disable warning 4701&4703, because they are also disabled in VS2015.
Okay. Then I see no objections to disabling them.
I didn't see the /wd options for those in tools_def.template with
VS2015, so I thought these needed to be addressed.
But from your looking at your proposal, I realize that these are
disabled in ProcessorBind.h. Obviously, I'll update my ARM/AARCH64
proposal so that the warnings for these toolchains are disabled there as
well, instead of tools_def.template.
> In tools_def.template, to align other VS tool chain, I use VS2017_BIN for 32bit,
> VS2017_BINX64 for 64bit. Could you follow this rule to define VS2017_BINARM for
> arm, VS2017_BINAARCH64 for AARCH64?
I will do that.
> On VS2017, I notice it doesn't set VS150COMNTOOLS env by default.
> So, I use vswhere.exe to detect VS2017 installation path. When we build source
> code with VS tool chain, we open normal cmd instead of VS cmd.
I see. I've always been opening a VS command prompt before calling the
EDK setup script, so I built my proposal around that. But I agree that
it makes sense to be able to build from regular prompt, so I will try to
follow your lead.
My only concern is that it may be difficult to locate the relevant ARM
toolchains without %WindowsSdkVerBinPath% being properly defined.
In your proposal, you seem to be hardcoding WINSDK10_PREFIX to something
like "%ProgramFiles(x86)%\Windows Kits\10\bin\x86" but that won't work
with ARM/ARM64 as we will need to get the actual version of the defayult
SDK installed for VS2017 (e.g. "C:\Program Files (x86)\Windows
Kits\10\bin\10.0.16299.0\") as the ARM toolchains will not work otherwise.
For instance, on my VS2017 installation the "arm64\" under "Windows
Kits\10\bin\" does not contain the latest version of the ARM64 tools and
libraries, which is problematic as proper ARM64 compilation support was
only enabled with the latest update. Only the one under "Windows
Kits\10\bin\10.0.16299.0\" does.
All in all, rather than try to guess the SDK path, I think we should try
to locate and call "%ProgramFiles(x86)%\Microsoft Visual
Studio\2017\Community\Common7\Tools\vsdevcmd\core\winsdk.bat", to have
the VS environment provide us with the actual SDK version to use, as
determined by Microsoft.
> In your patch on ARM support, <stdarg.h> is included in Base.h.
> This is a windows header file. So, VS env must be setup to build source
> code with ARM arch. Right?
That is correct. I had a quick look at removing that header, but didn't
see much harm in keeping it. However, now that I understand our
constraints better, I will make sure that header is not referenced.
I will also do the same for memset_ms.c and memcpy_ms.c, introduced for
ARM/ARM64 (In CompilerIntrinsicsLib), as it references <stddef.h> for
size_t.
> Last, I suggest you base on my patch to add VS2017 ARM and AARCH64 arch.
> For your patches, I suggest you separate them per package.
I will follow both these suggestions and send a v2 when ready.
Regards,
/Pete
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64
2017-11-14 16:16 ` Kurt Kennett
@ 2017-11-14 17:30 ` Pete Batard
0 siblings, 0 replies; 9+ messages in thread
From: Pete Batard @ 2017-11-14 17:30 UTC (permalink / raw)
To: Kurt Kennett, edk2-devel@lists.01.org
Hi Kurt,
On 2017.11.14 16:16, Kurt Kennett wrote:
> Does this build and boot a platform?
Not yet, but I believe I got pretty close to a full build for ARM.
However, the resources I can devote to finalizing ARM image generation,
and even more so, to add the missing resources for AARCH64 image
generation are limited, even more so as I am no ARM specialist.
I was actually hoping that, with the application of these patches, EDK2
contributors would step in to help with the effort of filling the
assembly gaps, as well as finalize image generation for ARM and AARCH64.
> This should not be committed until a platform is building and booting to UEFI shell, IMO.
Well, I see it a bit as a catch 22.
If we don't get the VS2017 ARM toolchains in, I don't think many people
will be willing to help with the image generation, because there will be
very little incentive for them to do so. And if we wait for image
generation to be sorted out before adding the toolchains, it may very
well be a couple more years before everything is finalized... which
would penalize the people who simply want the convenience of VS2017
support to build regular ARM and AARCH64 applications.
IMO, a gradual approach to introducing VS2017 ARM/AARCH64 support might
be preferable to an "all or nothing" one.
Regards,
/Pete
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-11-14 17:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-14 12:32 [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Pete Batard
2017-11-14 12:32 ` [PATCH 1/4] MdeModulePkg, NetworkPkg: Fix VS2017 IA32 warnings Pete Batard
2017-11-14 12:32 ` [PATCH 2/4] BaseTools: Add VS2017 IA32 and X64 support Pete Batard
2017-11-14 12:32 ` [PATCH 3/4] BaseTools: Add VS2017 ARM support Pete Batard
2017-11-14 12:32 ` [PATCH 4/4] BaseTools: Add VS2017 AARCH64 support Pete Batard
2017-11-14 16:03 ` [PATCH 0/4] BaseTools: Add VS2017 support, including ARM and AARCH64 Gao, Liming
2017-11-14 17:07 ` Pete Batard
2017-11-14 16:16 ` Kurt Kennett
2017-11-14 17:30 ` Pete Batard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox