diff options
author | Jiamin Ma <mjmthy@gmail.com> | 2013-10-12 06:31:55 +0000 |
---|---|---|
committer | jyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-10-12 06:31:55 +0000 |
commit | f66a43b26e6e0f4c1e5871dd3a88f2970b3abf87 (patch) | |
tree | f381d6fe0136f2949e4afa2367ec9b31a2e6e367 | |
parent | 09acdc0b24ac50f8623609d67ccc52a785b4fe57 (diff) | |
download | edk2-f66a43b26e6e0f4c1e5871dd3a88f2970b3abf87.tar.gz edk2-f66a43b26e6e0f4c1e5871dd3a88f2970b3abf87.tar.bz2 edk2-f66a43b26e6e0f4c1e5871dd3a88f2970b3abf87.zip |
We enabled X64 native version NT32, and made it works on Windows 7 X64 OS.
Signed-off-by: Jiamin Ma <mjmthy@gmail.com>
Reviewed by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed by: Liming Gao <liming.gao@intel.com>
Reviewed by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14766 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | Nt32Pkg/CpuRuntimeDxe/Cpu.c | 4 | ||||
-rw-r--r-- | Nt32Pkg/CpuRuntimeDxe/CpuIo.c | 6 | ||||
-rw-r--r-- | Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c | 2 | ||||
-rw-r--r-- | Nt32Pkg/Include/Common/WinNTInclude.h | 6 | ||||
-rw-r--r-- | Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c | 6 | ||||
-rw-r--r-- | Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c | 4 | ||||
-rw-r--r-- | Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c | 6 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.dsc | 36 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.fdf | 31 | ||||
-rw-r--r-- | Nt32Pkg/Sec/SecMain.c | 14 | ||||
-rw-r--r-- | Nt32Pkg/Sec/SecMain.inf | 11 | ||||
-rw-r--r-- | Nt32Pkg/Sec/StackX64.asm | 110 | ||||
-rw-r--r-- | Nt32Pkg/SnpNt32Dxe/SnpNt32.c | 16 | ||||
-rw-r--r-- | Nt32Pkg/StallPei/Stall.c | 4 | ||||
-rw-r--r-- | Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c | 18 | ||||
-rw-r--r-- | Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c | 16 | ||||
-rw-r--r-- | Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c | 6 |
17 files changed, 234 insertions, 62 deletions
diff --git a/Nt32Pkg/CpuRuntimeDxe/Cpu.c b/Nt32Pkg/CpuRuntimeDxe/Cpu.c index d15ac989ea..9e7dfbb29f 100644 --- a/Nt32Pkg/CpuRuntimeDxe/Cpu.c +++ b/Nt32Pkg/CpuRuntimeDxe/Cpu.c @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -467,7 +467,7 @@ Returns: ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);
- TotalSize = sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1;
+ TotalSize = (UINT32)(sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1);
SmbiosRecord = AllocatePool(TotalSize);
ZeroMem(SmbiosRecord, TotalSize);
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c index 7f171e6094..9c3478f0a3 100644 --- a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c +++ b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -326,11 +326,11 @@ Returns: }
Width = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
- if (Address - 1 + (1 << Width) * Count > Limit) {
+ if (Address - 1 + ((UINTN)1 << Width) * Count > Limit) {
return EFI_UNSUPPORTED;
}
- AlignMask = (1 << Width) - 1;
+ AlignMask = ((UINTN)1 << Width) - 1;
if ((UINTN) Buffer & AlignMask) {
return EFI_UNSUPPORTED;
}
diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c index 00a5f18ef2..3400516f0c 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -950,7 +950,7 @@ Returns: //
// Check input parameters
//
- if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {
+ if ((NumOfLba == 0) || ((StartingLba + NumOfLba) > NumOfBlocks)) {
VA_END (args);
return EFI_INVALID_PARAMETER;
}
diff --git a/Nt32Pkg/Include/Common/WinNTInclude.h b/Nt32Pkg/Include/Common/WinNTInclude.h index 7d62c9d551..3f4fb23732 100644 --- a/Nt32Pkg/Include/Common/WinNTInclude.h +++ b/Nt32Pkg/Include/Common/WinNTInclude.h @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -34,9 +34,11 @@ Abstract: #define GUID _WINNT_DUP_GUID_____
#define _LIST_ENTRY _WINNT_DUP_LIST_ENTRY_FORWARD
#define LIST_ENTRY _WINNT_DUP_LIST_ENTRY
+#if defined (MDE_CPU_IA32)
#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
+#endif
#undef UNALIGNED
#undef CONST
#undef VOID
@@ -45,7 +47,9 @@ Abstract: // WQBugBug: This typedef is to make "windows.h" buildable.
// It should be removed after the root cause why
// size_t is undefined when go into the line below is found.
+#if defined (MDE_CPU_IA32)
typedef UINT32 size_t ;
+#endif
#include "windows.h"
diff --git a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c index b024a9157b..e6f072e996 100644 --- a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c +++ b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c @@ -1,7 +1,7 @@ /** @file
OEM hook status code library functions with no library constructor/destructor
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -145,7 +145,7 @@ OemHookStatusCodeReport ( mWinNt->WriteFile (
mStdOut,
Buffer,
- CharCount,
+ (DWORD)CharCount,
(LPDWORD)&CharCount,
NULL
);
@@ -228,7 +228,7 @@ OemHookStatusCodeReport ( mWinNt->WriteFile (
mStdOut,
Buffer,
- CharCount,
+ (DWORD)CharCount,
(LPDWORD)&CharCount,
NULL
);
diff --git a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c index cacd78db11..5ae0b25c37 100644 --- a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c +++ b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -319,6 +319,6 @@ PeCoffGetSizeOfHeaders ( SizeOfHeaders = 0;
}
- return SizeOfHeaders;
+ return (UINT32) SizeOfHeaders;
}
diff --git a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c index 882d1c4f4f..4e37683400 100644 --- a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c +++ b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c @@ -1,7 +1,7 @@ /** @file
OEM hook status code library functions with no library constructor/destructor
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -154,7 +154,7 @@ OemHookStatusCodeReport ( mWinNt->WriteFile (
mStdOut,
Buffer,
- CharCount,
+ (DWORD)CharCount,
(LPDWORD)&CharCount,
NULL
);
@@ -237,7 +237,7 @@ OemHookStatusCodeReport ( mWinNt->WriteFile (
mStdOut,
Buffer,
- CharCount,
+ (DWORD)CharCount,
(LPDWORD)&CharCount,
NULL
);
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index 923bc4e7a9..56c97e51b1 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -27,7 +27,7 @@ PLATFORM_VERSION = 0.4
DSC_SPECIFICATION = 0x00010005
OUTPUT_DIRECTORY = Build/NT32
- SUPPORTED_ARCHITECTURES = IA32
+ SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
FLASH_DEFINITION = Nt32Pkg/Nt32Pkg.fdf
@@ -119,6 +119,7 @@ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
+ LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
!if $(SECURE_BOOT_ENABLE) == TRUE
PlatformSecureLib|Nt32Pkg/Library/PlatformSecureLib/PlatformSecureLib.inf
@@ -208,6 +209,7 @@ [PcdsFeatureFlag]
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|TRUE
@@ -239,7 +241,6 @@ ################################################################################
[PcdsDynamicDefault.common.DEFAULT]
gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|20
- gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\Ia32\Apps"|VOID*|106
gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|52
gEfiNt32PkgTokenSpaceGuid.PcdWinNtConsole|L"Bus Driver Console Window"|VOID*|52
gEfiNt32PkgTokenSpaceGuid.PcdWinNtVirtualDisk|L"FW;40960;512"|VOID*|26
@@ -251,6 +252,12 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
+[PcdsDynamicDefault.Ia32]
+ gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\Ia32\Apps"|VOID*|106
+
+[PcdsDynamicDefault.x64]
+ gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\X64\Apps"|VOID*|106
+
[PcdsDynamicHii.common.DEFAULT]
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x0|80
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x4|25
@@ -275,11 +282,15 @@ # generated for it, but the binary will not be put into any firmware volume.
#
###################################################################################################
-[Components.IA32]
+[Components]
##
# SEC Phase modules
##
- Nt32Pkg/Sec/SecMain.inf
+ Nt32Pkg/Sec/SecMain.inf {
+ <BuildOptions>
+ # Add override here, because default X64_CC_FLAGS is already overriden in DSC
+ 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
+ }
##
# PEI Phase modules
@@ -315,7 +326,7 @@ NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
<BuildOptions>
- *_*_IA32_CC_FLAGS =
+ *_*_*_CC_FLAGS =
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -429,19 +440,24 @@ #
###################################################################################################
[BuildOptions]
- DEBUG_*_IA32_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
- RELEASE_*_IA32_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
+ DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
+ RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
*_*_IA32_CC_FLAGS = /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006
+# Add override here, because default X64_CC_FLAGS add /X
+ DEBUG_*_X64_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006
+RELEASE_*_X64_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006
+NOOPT_*_X64_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Od /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006
+
#############################################################################################################
# NOTE:
-# The following [Libraries.IA32] section is for building EDK module under the EDKII tool chain.
-# If you want build EDK module for Nt32 platform, please uncomment [Libraries.IA32] section and
+# The following [Libraries] section is for building EDK module under the EDKII tool chain.
+# If you want build EDK module for Nt32 platform, please uncomment [Libraries] section and
# libraries used by that EDK module.
# Currently, Nt32 platform do not has any EDK style module
#
#
-#[Libraries.IA32]
+#[Libraries]
#
# Libraries common to PEI and DXE
#
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index 7315d432fa..8282fcf2f4 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -270,13 +270,9 @@ INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf # for binary shell, binary fat and logo module.
#
################################################################################
-FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) {
- SECTION PE32 = EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi
- }
+INF EdkShellBinPkg/FullShell/FullShell.inf
-FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {
- SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi
- }
+INF FatBinPkg/EnhancedFatDxe/Fat.inf
FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
SECTION RAW = MdeModulePkg/Logo/Logo.bmp
@@ -391,3 +387,26 @@ FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { }
}
}
+
+[Rule.Common.UEFI_APPLICATION.BINARY]
+ FILE APPLICATION = $(NAMED_GUID) {
+ COMPRESS PI_STD {
+ GUIDED {
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+ }
+ }
+
+[Rule.Common.UEFI_DRIVER.BINARY]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional |.depex
+ COMPRESS PI_STD {
+ GUIDED {
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+ }
+ }
diff --git a/Nt32Pkg/Sec/SecMain.c b/Nt32Pkg/Sec/SecMain.c index a1d43d2eba..602cca9b1b 100644 --- a/Nt32Pkg/Sec/SecMain.c +++ b/Nt32Pkg/Sec/SecMain.c @@ -110,6 +110,16 @@ SecNt32PeCoffRelocateImage ( );
VOID
+EFIAPI
+PeiSwitchStacks (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *Context3, OPTIONAL
+ IN VOID *NewStack
+ );
+
+VOID
SecPrint (
CHAR8 *Format,
...
@@ -129,7 +139,7 @@ SecPrint ( WriteFile (
GetStdHandle (STD_OUTPUT_HANDLE),
Buffer,
- CharCount,
+ (DWORD)CharCount,
(LPDWORD)&CharCount,
NULL
);
@@ -505,6 +515,7 @@ Returns: return EFI_SUCCESS;
}
+#if defined (MDE_CPU_IA32)
/**
Transfers control to a function starting with a new stack.
@@ -562,6 +573,7 @@ PeiSwitchStacks ( //
ASSERT (FALSE);
}
+#endif
VOID
SecLoadFromCore (
diff --git a/Nt32Pkg/Sec/SecMain.inf b/Nt32Pkg/Sec/SecMain.inf index e9596b9b13..fee68e0952 100644 --- a/Nt32Pkg/Sec/SecMain.inf +++ b/Nt32Pkg/Sec/SecMain.inf @@ -31,8 +31,13 @@ WinNtThunk.c
FwVol.c
SecMain.c
+
+[Sources.ia32]
Stack.asm
+[Sources.x64]
+ StackX64.asm
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
@@ -68,6 +73,12 @@ MSFT:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
MSFT:*_*_IA32_ASMLINK_FLAGS == /link /nologo /tiny
+ MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib\AMD64" /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:*_*_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
+ MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
+
INTEL:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"C:\Program Files\Intel\Compiler\C++\9.1\IA32\Lib" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib
INTEL:*_*_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
INTEL:*_*_IA32_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
diff --git a/Nt32Pkg/Sec/StackX64.asm b/Nt32Pkg/Sec/StackX64.asm new file mode 100644 index 0000000000..2327e2eeac --- /dev/null +++ b/Nt32Pkg/Sec/StackX64.asm @@ -0,0 +1,110 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2013, 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.
+;
+; Module Name:
+;
+; Stack.asm
+;
+; Abstract:
+;
+; Switch the stack from temporary memory to permenent memory.
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; SecSwitchStack (
+; UINT32 TemporaryMemoryBase,
+; UINT32 PermenentMemoryBase
+; );
+;------------------------------------------------------------------------------
+SecSwitchStack PROC
+ mov [rsp + 08h], rcx
+ mov [rsp + 10h], rdx
+
+ ;
+ ; Save three register: eax, ebx, ecx
+ ;
+ push rax
+ push rbx
+ push rcx
+ push rdx
+
+ ;
+ ; !!CAUTION!! this function address's is pushed into stack after
+ ; migration of whole temporary memory, so need save it to permenent
+ ; memory at first!
+ ;
+
+ mov rbx, [rsp + 28h] ; Save the first parameter
+ mov rcx, [rsp + 30h] ; Save the second parameter
+
+ ;
+ ; Save this function's return address into permenent memory at first.
+ ; Then, Fixup the esp point to permenent memory
+ ;
+ mov rax, rsp
+ sub rax, rbx
+ add rax, rcx
+ mov rdx, qword ptr [rsp] ; copy pushed register's value to permenent memory
+ mov qword ptr [rax], rdx
+ mov rdx, qword ptr [rsp + 8]
+ mov qword ptr [rax + 8], rdx
+ mov rdx, qword ptr [rsp + 10h]
+ mov qword ptr [rax + 10h], rdx
+ mov rdx, qword ptr [rsp + 18h]
+ mov qword ptr [rax + 18h], rdx
+ mov rdx, qword ptr [rsp + 20h] ; Update this function's return address into permenent memory
+ mov qword ptr [rax + 20h], rdx
+ mov rsp, rax ; From now, esp is pointed to permenent memory
+
+ ;
+ ; Fixup the ebp point to permenent memory
+ ;
+ mov rax, rbp
+ sub rax, rbx
+ add rax, rcx
+ mov rbp, rax ; From now, ebp is pointed to permenent memory
+
+ pop rdx
+ pop rcx
+ pop rbx
+ pop rax
+ ret
+SecSwitchStack ENDP
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; PeiSwitchStacks (
+; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+; IN VOID *Context1, OPTIONAL
+; IN VOID *Context2, OPTIONAL
+; IN VOID *Context3, OPTIONAL
+; IN VOID *NewStack
+; )
+;------------------------------------------------------------------------------
+PeiSwitchStacks PROC
+ mov rax, rcx
+ mov rcx, rdx
+ mov rdx, r8
+ mov r8, r9
+ mov rsp, [rsp + 28h]
+ sub rsp, 20h
+ call rax
+ jmp $
+ ret
+PeiSwitchStacks ENDP
+
+ END
diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32.c b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c index 86414696c4..4dee182ad8 100644 --- a/Nt32Pkg/SnpNt32Dxe/SnpNt32.c +++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -704,7 +704,7 @@ SnpNt32ReceiveFilters ( ReturnValue = GlobalData->NtNetUtilityTable.SetReceiveFilter (
Instance->InterfaceInfo.InterfaceIndex,
EnableBits,
- McastFilterCount,
+ (UINT32)McastFilterCount,
McastFilter
);
@@ -863,7 +863,7 @@ SnpNt32GetStatus ( {
if (TxBuffer != NULL) {
- *((UINT8 **) TxBuffer) = (UINT8 *) 1;
+ *((UINT8 **) TxBuffer) = (UINT8 *)(UINTN) 1;
}
if (InterruptStatus != NULL) {
@@ -933,8 +933,8 @@ SnpNt32Transmit ( ReturnValue = GlobalData->NtNetUtilityTable.Transmit (
Instance->InterfaceInfo.InterfaceIndex,
- HeaderSize,
- BufferSize,
+ (UINT32)HeaderSize,
+ (UINT32)BufferSize,
Buffer,
SrcAddr,
DestAddr,
@@ -1189,7 +1189,7 @@ SnpNt32InitializeGlobalData ( //
// Set the interface information.
//
- Instance->InterfaceInfo = NetInterfaceInfoBuffer[Index];
+ CopyMem (&Instance->InterfaceInfo, &NetInterfaceInfoBuffer[Index], sizeof(Instance->InterfaceInfo));
//
// Initialize this instance
//
@@ -1265,8 +1265,8 @@ SnpNt32InitializeInstanceData ( //
// Copy Current/PermanentAddress MAC address
//
- Instance->Mode.CurrentAddress = Instance->InterfaceInfo.MacAddr;
- Instance->Mode.PermanentAddress = Instance->InterfaceInfo.MacAddr;
+ CopyMem (&Instance->Mode.CurrentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.CurrentAddress));
+ CopyMem (&Instance->Mode.PermanentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.PermanentAddress));
//
// Since the fake SNP is based on a real NIC, to avoid conflict with the host
diff --git a/Nt32Pkg/StallPei/Stall.c b/Nt32Pkg/StallPei/Stall.c index e89338dcdf..c00ada872d 100644 --- a/Nt32Pkg/StallPei/Stall.c +++ b/Nt32Pkg/StallPei/Stall.c @@ -1,7 +1,7 @@ /**@file
EFI_PEI_STALL implementation for NT32 simulation environment.
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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
@@ -100,7 +100,7 @@ Stall ( // so micro second units need be divided by 1000 to convert to ms
//
NtThunk = (EFI_WIN_NT_THUNK_PROTOCOL*) PeiNtService->NtThunk();
- NtThunk->Sleep ((Microseconds + 999) / 1000);
+ NtThunk->Sleep ((DWORD)((Microseconds + 999) / 1000));
return EFI_SUCCESS;
}
diff --git a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c index 12924e659f..f9f286705f 100644 --- a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c +++ b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c @@ -529,7 +529,7 @@ Returns: BlockIo = &Private->BlockIo;
BlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
BlockIo->Media = &Private->Media;
- BlockIo->Media->BlockSize = Private->BlockSize;
+ BlockIo->Media->BlockSize = (UINT32)Private->BlockSize;
BlockIo->Media->LastBlock = Private->NumberOfBlocks - 1;
BlockIo->Media->MediaId = 0;;
@@ -626,10 +626,10 @@ Returns: //
Private->NtHandle = Private->WinNtThunk->CreateFile (
Private->Filename,
- Private->ReadMode,
- Private->ShareMode,
+ (DWORD)Private->ReadMode,
+ (DWORD)Private->ShareMode,
NULL,
- Private->OpenMode,
+ (DWORD)Private->OpenMode,
0,
NULL
);
@@ -658,7 +658,7 @@ Returns: Status = SetFilePointer64 (Private, 0, &FileSize, FILE_END);
if (EFI_ERROR (Status)) {
- FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
+ FileSize = MultU64x32 (Private->NumberOfBlocks, (UINT32)Private->BlockSize);
if (Private->DeviceType == EfiWinNtVirtualDisks) {
DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n", Private->Filename));
Status = EFI_UNSUPPORTED;
@@ -667,10 +667,10 @@ Returns: }
if (Private->NumberOfBlocks == 0) {
- Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);
+ Private->NumberOfBlocks = DivU64x32 (FileSize, (UINT32)Private->BlockSize);
}
- EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
+ EndOfFile = MultU64x32 (Private->NumberOfBlocks, (UINT32)Private->BlockSize);
if (FileSize != EndOfFile) {
//
@@ -832,7 +832,7 @@ Returns: return EFI_MEDIA_CHANGED;
}
- if ((UINT32) Buffer % Private->Media.IoAlign != 0) {
+ if ((UINTN) Buffer % Private->Media.IoAlign != 0) {
return EFI_INVALID_PARAMETER;
}
@@ -858,7 +858,7 @@ Returns: //
// Seek to End of File
//
- DistanceToMove = MultU64x32 (Lba, BlockSize);
+ DistanceToMove = MultU64x32 (Lba, (UINT32)BlockSize);
Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, FILE_BEGIN);
if (EFI_ERROR (Status)) {
diff --git a/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c b/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c index 607caad2e9..b15d621b3b 100644 --- a/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c +++ b/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -379,7 +379,7 @@ WinNtGopSetMode ( //
// Adjust the window size
//
- Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);
+ Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, (INT32)Width, (INT32)Height, TRUE);
}
@@ -582,10 +582,10 @@ WinNtGopBlt ( //
// Mark the area we just blted as Invalid so WM_PAINT will update.
//
- Rect.left = DestinationX;
- Rect.top = DestinationY;
- Rect.right = DestinationX + Width;
- Rect.bottom = DestinationY + Height;
+ Rect.left = (LONG)DestinationX;
+ Rect.top = (LONG)DestinationY;
+ Rect.right = (LONG)(DestinationX + Width);
+ Rect.bottom = (LONG)(DestinationY + Height);
Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);
//
@@ -900,7 +900,7 @@ WinNtGopThreadWinMain ( Private->WindowsClass.hInstance = NULL;
Private->WindowsClass.hIcon = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
Private->WindowsClass.hCursor = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);
- Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;
+ Private->WindowsClass.hbrBackground = (HBRUSH)(UINTN)COLOR_WINDOW;
Private->WindowsClass.lpszMenuName = NULL;
Private->WindowsClass.lpszClassName = WIN_NT_GOP_CLASS_NAME;
Private->WindowsClass.hIconSm = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
@@ -963,7 +963,7 @@ WinNtGopThreadWinMain ( Private->WinNtThunk->DispatchMessage (&Message);
}
- return Message.wParam;
+ return (DWORD)Message.wParam;
}
diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index 63ab71fb2b..1c300b6930 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -1593,7 +1593,7 @@ Returns: Status = PrivateFile->WinNtThunk->ReadFile (
PrivateFile->LHandle,
Buffer,
- *BufferSize,
+ (DWORD)*BufferSize,
(LPDWORD)BufferSize,
NULL
) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
@@ -1764,7 +1764,7 @@ Returns: Status = PrivateFile->WinNtThunk->WriteFile (
PrivateFile->LHandle,
Buffer,
- *BufferSize,
+ (DWORD)*BufferSize,
(LPDWORD)BufferSize,
NULL
) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
|